replace for loop with while loop for postgres wait
This commit is contained in:
13
install.sh
13
install.sh
@@ -250,19 +250,20 @@ fi
|
||||
|
||||
info "Waiting for PostgreSQL (up to 60s)..."
|
||||
DB_READY=false
|
||||
for ((i=1; i<=30; i++)); do
|
||||
if $SUDO docker compose exec -T postgres pg_isready -U "${POSTGRES_USER}" -d "${POSTGRES_DB}" &>/dev/null; then
|
||||
I=1
|
||||
while [ "$I" -le 30 ]; do
|
||||
if $SUDO docker compose exec -T postgres pg_isready -U "${POSTGRES_USER}" -d "${POSTGRES_DB}" >/dev/null 2>&1; then
|
||||
DB_READY=true
|
||||
info "PostgreSQL is ready"
|
||||
break
|
||||
fi
|
||||
if [ "$i" -eq 30 ]; then
|
||||
warn "PostgreSQL logs (last 20 lines):"
|
||||
$SUDO docker compose logs --tail=20 postgres 2>/dev/null || true
|
||||
error "PostgreSQL did not start. Check ${INSTALL_DIR}/.env for DB credentials and port 5432 availability."
|
||||
if [ "$I" -eq 30 ]; then
|
||||
echo "=== PG LOOP TIMEOUT ==="
|
||||
fi
|
||||
I=$((I + 1))
|
||||
sleep 2
|
||||
done
|
||||
echo "=== AFTER PG LOOP ==="
|
||||
|
||||
echo "=== CHECKPOINT: after postgres loop ==="
|
||||
|
||||
|
||||
Reference in New Issue
Block a user