fixing boot script
This commit is contained in:
parent
5e67e735db
commit
0f3d82a5e6
17
boot.sh
17
boot.sh
@ -28,21 +28,24 @@ fi
|
|||||||
|
|
||||||
echo "Waiting for database to be ready..."
|
echo "Waiting for database to be ready..."
|
||||||
|
|
||||||
attempt=0
|
if [ "${DB_ENGINE}" != 'django.db.backends.sqlite3' ]; then
|
||||||
max_attempts=20
|
attempt=0
|
||||||
while pg_isready --host=${POSTGRES_HOST} -q; status=$?; attempt=$((attempt+1)); [ $status -ne 0 ] && [ $attempt -le $max_attempts ]; do
|
max_attempts=20
|
||||||
|
while pg_isready --host=${POSTGRES_HOST} -q; status=$?; attempt=$((attempt+1)); [ $status -ne 0 ] && [ $attempt -le $max_attempts ]; do
|
||||||
sleep 5
|
sleep 5
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ $attempt -gt $max_attempts ]; then
|
if [ $attempt -gt $max_attempts ]; then
|
||||||
echo -e "\nDatabase not reachable. Maximum attempts exceeded."
|
echo -e "\nDatabase not reachable. Maximum attempts exceeded."
|
||||||
echo "Please check logs above - misconfiguration is very likely."
|
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."
|
echo "Shutting down container."
|
||||||
exit 1 # exit with error to make the container stop
|
exit 1 # exit with error to make the container stop
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Database is ready"
|
echo "Database is ready"
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
echo "Migrating database"
|
echo "Migrating database"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user