From 5ccae90578a9f3150beecfccd759a1da345d5288 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaspar=20L=C3=B6chte?= Date: Wed, 1 Dec 2021 11:20:26 +0100 Subject: [PATCH] Check for pgres startup completed, by checking a file in a shared volume --- .docker/start-gvmd.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.docker/start-gvmd.sh b/.docker/start-gvmd.sh index cf0d13651..e5dd81f87 100644 --- a/.docker/start-gvmd.sh +++ b/.docker/start-gvmd.sh @@ -4,8 +4,14 @@ [ -z "$PASSWORD" ] && PASSWORD="admin" [ -z "$GVMD_ARGS" ] && GVMD_ARGS="--listen-mode=666" [ -z "$GVMD_USER" ] && GVMD_USER="gvmd" +[ -z "$PGRES_DATA"] && PGRES_DATA="/var/lib/postgresql" # check for psql connection +FILE=$PGRES_DATA/started +until test -f "$FILE"; do + echo "waiting 1 second for ready postgres container" + sleep 1 +done until psql -U "$GVMD_USER" -d gvmd -c "SELECT 'connected' as connection"; do echo "waiting 1 second to retry psql connection" sleep 1