c3nav.bash webworker/taskworker wait for docker and redis

This commit is contained in:
Laura Klünder 2016-12-25 16:36:15 +01:00
parent b091a2838c
commit 46c023754a

View file

@ -12,6 +12,18 @@ fi
ls /data/map ls /data/map
if [ "$1" == "webworker" ]; then if [ "$1" == "webworker" ]; then
until psql -h "postgres" -U "c3nav" -c '\l'; do
>&2 echo "Postgres is unavailable! waiting…"
sleep 1
done
>&2 echo "Postgres is available! continuing…"
while ! nc redis 6379; do
>&2 echo "Redis is unavailable - sleeping"
sleep 1
done
>&2 echo "Redis is available! continuing…"
python manage.py migrate --noinput python manage.py migrate --noinput
python manage.py loadmap -y python manage.py loadmap -y
mkdir -p /static.dist mkdir -p /static.dist
@ -27,6 +39,18 @@ if [ "$1" == "webworker" ]; then
fi fi
if [ "$1" == "taskworker" ]; then if [ "$1" == "taskworker" ]; then
until psql -h "postgres" -U "c3nav" -c '\l'; do
>&2 echo "Postgres is unavailable! waiting…"
sleep 1
done
>&2 echo "Postgres is available! continuing…"
while ! nc redis 6379; do
>&2 echo "Redis is unavailable - sleeping"
sleep 1
done
>&2 echo "Redis is available! continuing…"
export C_FORCE_ROOT=True export C_FORCE_ROOT=True
exec celery -A c3nav worker -l info exec celery -A c3nav worker -l info
fi fi