From 6e5c1de9515761abbb9d8cd246264b1fa1947197 Mon Sep 17 00:00:00 2001 From: Romain de Laage <romain.delaage@rdelaage.ovh> Date: Wed, 19 May 2021 08:25:04 +0200 Subject: [PATCH] Use pg_isready instead of a simple sleep 1 to be sure that the db is ready --- pica-mattermost/entrypoint.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pica-mattermost/entrypoint.sh b/pica-mattermost/entrypoint.sh index c504225..bbaba57 100644 --- a/pica-mattermost/entrypoint.sh +++ b/pica-mattermost/entrypoint.sh @@ -68,7 +68,11 @@ if [ "$1" = 'mattermost' ]; then # Wait another second for the database to be properly started. # Necessary to avoid "panic: Failed to open sql connection pq: the database system is starting up" - sleep 1 + until pg_isready -h $DB_HOST -p $DB_PORT_NUMBER + do + echo "Database is not ready yet. Waiting 5 seconds." + sleep 5 + done echo "Starting mattermost" fi -- GitLab