fix: postgres waiting script

This commit is contained in:
Vasily Zubarev
2025-04-03 15:51:58 +02:00
parent d8711b7142
commit e2dd602e3d

View File

@@ -1,9 +1,9 @@
#!/bin/sh
set -e
# Wait for database to be ready
echo "Waiting for PostgreSQL to be ready..."
until pg_isready -h postgres -p 5432 -U postgres; do
# Wait for database to be ready using psql and DATABASE_URL
echo "Waiting for PostgreSQL to be ready at $DATABASE_URL..."
until PGPASSWORD="${PGPASSWORD:-}" psql "$DATABASE_URL" -c '\q' >/dev/null 2>&1; do
echo "PostgreSQL is unavailable - sleeping"
sleep 1
done