Improve the way app waits for db to be ready
credits : https://gitlab.utc.fr/picasoft/projets/dockerfiles/-/merge_requests/64
This commit is contained in:
parent
a20d22168f
commit
4794c59f59
@ -25,6 +25,7 @@ RUN apk add --no-cache \
|
||||
netcat-openbsd \
|
||||
xmlsec-dev \
|
||||
tzdata \
|
||||
postgresql-client \
|
||||
&& rm -rf /tmp/*
|
||||
|
||||
# Get Mattermost
|
||||
|
@ -74,7 +74,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
|
||||
|
Reference in New Issue
Block a user