Merge branch 'improvement/ping_db' of https://github.com/MaxJa4/recipes into improvement/ping_db
This commit is contained in:
commit
a1063ce922
6
boot.sh
6
boot.sh
@ -6,13 +6,13 @@ echo "Waiting for database to be ready..."
|
||||
attempt=0
|
||||
max_attempts=20
|
||||
while pg_isready --host=${POSTGRES_HOST} -q; status=$?; attempt=$((attempt+1)); [ $status -ne 0 ] && [ $attempt -le $max_attempts ]; do
|
||||
sleep 5 # no echo needed, response comes from pg_isready already
|
||||
sleep 5
|
||||
done
|
||||
|
||||
if [ $attempt -gt $max_attempts ]; then
|
||||
echo -e "\nDatabase not reachable. Maximum attempts exceeded."
|
||||
echo "Please check logs above - misconfiguration is very likely."
|
||||
echo "Make sure the DB container is up and POSTGRES_HOST is set properly."
|
||||
echo "Make sure the DB container is up and POSTGRES_HOST is set properly."
|
||||
echo "Shutting down container."
|
||||
exit 1 # exit with error to make the container stop
|
||||
fi
|
||||
@ -32,4 +32,4 @@ echo "Done"
|
||||
|
||||
chmod -R 755 /opt/recipes/mediafiles
|
||||
|
||||
exec gunicorn -b :8080 --access-logfile - --error-logfile - --log-level INFO recipes.wsgi
|
||||
exec gunicorn -b :8080 --access-logfile - --error-logfile - --log-level INFO recipes.wsgi
|
||||
|
Loading…
Reference in New Issue
Block a user