|
|
@ -1,10 +1,20 @@
|
|
|
|
#!/bin/bash
|
|
|
|
#!/bin/bash
|
|
|
|
# startup script inside the container for tubearchivist
|
|
|
|
# startup script inside the container for tubearchivist
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# check environment
|
|
|
|
if [[ -z "$ELASTIC_USER" ]]; then
|
|
|
|
if [[ -z "$ELASTIC_USER" ]]; then
|
|
|
|
export ELASTIC_USER=elastic
|
|
|
|
export ELASTIC_USER=elastic
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ENV_VARS=("TA_USERNAME" "TA_PASSWORD" "ELASTIC_PASSWORD" "ELASTIC_USER")
|
|
|
|
|
|
|
|
for each in "${ENV_VARS[@]}"; do
|
|
|
|
|
|
|
|
if ! [[ -v $each ]]; then
|
|
|
|
|
|
|
|
echo "missing environment variable $each"
|
|
|
|
|
|
|
|
exit 1
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# wait for elasticsearch
|
|
|
|
counter=0
|
|
|
|
counter=0
|
|
|
|
until curl -u "$ELASTIC_USER":"$ELASTIC_PASSWORD" "$ES_URL" -fs; do
|
|
|
|
until curl -u "$ELASTIC_USER":"$ELASTIC_PASSWORD" "$ES_URL" -fs; do
|
|
|
|
echo "waiting for elastic search to start"
|
|
|
|
echo "waiting for elastic search to start"
|
|
|
@ -17,6 +27,7 @@ until curl -u "$ELASTIC_USER":"$ELASTIC_PASSWORD" "$ES_URL" -fs; do
|
|
|
|
sleep 10
|
|
|
|
sleep 10
|
|
|
|
done
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# start python application
|
|
|
|
python manage.py makemigrations
|
|
|
|
python manage.py makemigrations
|
|
|
|
python manage.py migrate
|
|
|
|
python manage.py migrate
|
|
|
|
export DJANGO_SUPERUSER_PASSWORD=$TA_PASSWORD && \
|
|
|
|
export DJANGO_SUPERUSER_PASSWORD=$TA_PASSWORD && \
|
|
|
|