From 24f3c30a41b9068b350e9bd66a329aaba18efd33 Mon Sep 17 00:00:00 2001 From: Benjamin Bach Date: Wed, 24 Jul 2024 14:07:06 +0200 Subject: [PATCH] Revert "Remove health-check for Postgres (it's now in docker-compose.yml)" This reverts commit 0f1211fa83e25a058c1fb2d9507671944466ea42. --- entrypoint.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/entrypoint.sh b/entrypoint.sh index 008f7be..9df57b6 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,5 +1,16 @@ #!/bin/sh +echo "Waiting for postgres..." + +POSTGRES_PORT=${POSTGRES_PORT:-5432} +POSTGRES_HOST=${POSTGRES_HOST:-localhost} + +while ! nc -z "$POSTGRES_HOST" "$POSTGRES_PORT"; do + sleep 0.1 +done + +echo "PostgreSQL started" + # Only migrate, collectstatic and compilemessages if we are NOT in development if [ -z "$DEBUG" ]; then python src/manage.py migrate;