Improve application deployment and database connection reliability

Refactors Docker configuration and entrypoint script for robust PostgreSQL connectivity and health checks.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: dec54137-d5a2-4406-8ad4-5f2f9fb110bf
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/0715008c-7244-40f4-befc-26c014852236/5d315300-98fa-429a-abb0-4fdce6a2e3c9.jpg
This commit is contained in:
michaelschal committed 2025-07-13 11:40:17 +00:00
1 parent 766b451768
commit 037e7e2e49
4 files changed
+54 -70

No files matched your search

+24 -3
View File
@@ -6,11 +6,32 @@ echo "Database URL: ${DATABASE_URL:0:30}..."
# Attendre que PostgreSQL soit disponible
echo "⏳ Waiting for PostgreSQL..."
until pg_isready -h $(echo $DATABASE_URL | cut -d'/' -f3 | cut -d':' -f1) -p $(echo $DATABASE_URL | cut -d':' -f4 | cut -d'/' -f1) > /dev/null 2>&1; do
echo "PostgreSQL is unavailable - sleeping"
sleep 2
echo "Database URL: $DATABASE_URL"
# Extraire les paramètres de connexion plus simplement
DB_HOST="regisflow-db"
DB_PORT="5432"
DB_USER="regisflow"
echo "Connecting to: $DB_HOST:$DB_PORT as $DB_USER"
# Attendre avec timeout
RETRIES=30
while [ $RETRIES -gt 0 ]; do
if pg_isready -h "$DB_HOST" -p "$DB_PORT" -U "$DB_USER" > /dev/null 2>&1; then
echo "✅ PostgreSQL is ready!"
break
fi
echo "PostgreSQL is unavailable - sleeping ($((31-RETRIES))/30)"
sleep 3
RETRIES=$((RETRIES-1))
done
if [ $RETRIES -eq 0 ]; then
echo "❌ Timeout: PostgreSQL connection failed"
exit 1
fi
echo "✅ PostgreSQL is ready!"
# Migrer la base de données