Merge pull request 'Improve the way app waits for db to be ready' (#1) from db-entrypoint-wait into gnous-5.34

Reviewed-on: #1
This commit is contained in:
thopic 2021-05-23 17:31:20 +02:00
commit fe4aecd04f
Signed by:
GPG Key ID: C87EE34FD0BED5F5
2 changed files with 6 additions and 1 deletions

View File

@ -25,6 +25,7 @@ RUN apk add --no-cache \
netcat-openbsd \ netcat-openbsd \
xmlsec-dev \ xmlsec-dev \
tzdata \ tzdata \
postgresql-client \
&& rm -rf /tmp/* && rm -rf /tmp/*
# Get Mattermost # Get Mattermost

View File

@ -74,7 +74,11 @@ if [ "$1" = 'mattermost' ]; then
# Wait another second for the database to be properly started. # 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" # 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" echo "Starting mattermost"
fi fi