mirror of
https://github.com/status-im/cabot.git
synced 2025-02-24 18:38:07 +00:00
The web container could start running before the database/celery broker was launched. Add wait checks in docker-entrypoint
29 lines
497 B
Bash
Executable File
29 lines
497 B
Bash
Executable File
#!/bin/bash
|
|
|
|
set -e
|
|
set -o allexport
|
|
|
|
function wait_for_broker {(
|
|
set +e
|
|
until python -c "from kombu import Connection; x=Connection('$CELERY_BROKER_URL', timeout=1); x.connect()"
|
|
do
|
|
echo 'Waiting for celery broker to respond...'
|
|
sleep 1
|
|
done
|
|
)}
|
|
|
|
function wait_for_database {(
|
|
set +e
|
|
until python -c "from django.db import connection; connection.connect()"
|
|
do
|
|
echo 'Waiting for database to respond...'
|
|
sleep 1
|
|
done
|
|
)}
|
|
|
|
|
|
wait_for_broker
|
|
wait_for_database
|
|
|
|
exec "$@"
|