Use ENV for redis in db-setup and fix defaults (#5951)

* Use ENV for redis in db-setup and fix defaults

* Add default value for `DATABASE_HOST`
* Use ENV for `wait-for-it` redis and redis-slave

Signed-off-by: Adrian Nöthlich <git@promasu.tech>

* Match default value for DATABASE_HOST
This commit is contained in:
Adrian Nöthlich 2021-04-01 13:10:19 +02:00 committed by GitHub
parent 83549ce02b
commit 6430727590
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -24,14 +24,14 @@ source /run/secrets/django || true
} }
export SECRET_KEY="$DJANGO_SECRET_KEY" export SECRET_KEY="$DJANGO_SECRET_KEY"
until pg_isready -h "${DATABASE_HOST}" -p "${DATABASE_PORT:-5432}"; do until pg_isready -h "${DATABASE_HOST:-pgbouncer}" -p "${DATABASE_PORT:-5432}"; do
echo "Waiting for Postgres cluster to become available..." echo "Waiting for Postgres cluster to become available..."
sleep 3 sleep 3
done done
# Wait for redis # Wait for redis
wait-for-it redis:6379 wait-for-it "${REDIS_HOST:-redis}:${REDIS_PORT:-6379}"
wait-for-it redis-slave:6379 wait-for-it "${REDIS_SLAVE_HOST:-redis-slave}:${REDIS_SLAVE_PORT:-6379}"
echo 'running migrations' echo 'running migrations'
python -u manage.py migrate python -u manage.py migrate