diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index 8ea47318..b79af952 100755 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -163,20 +163,9 @@ if [[ "$DISPATCHARR_ENV" != "modular" ]]; then pids+=("$postgres_pid") else echo "🔗 Modular mode: Using external PostgreSQL at ${POSTGRES_HOST}:${POSTGRES_PORT}" - # Wait for external PostgreSQL to be ready using Python (no pg_isready needed) + # Wait for external PostgreSQL to be ready using pg_isready (checks actual protocol readiness) echo_with_timestamp "Waiting for external PostgreSQL to be ready..." - until python3 -c " -import socket -import sys -try: - s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - s.settimeout(2) - s.connect(('${POSTGRES_HOST}', ${POSTGRES_PORT})) - s.close() - sys.exit(0) -except Exception: - sys.exit(1) -" 2>/dev/null; do + until $PG_BINDIR/pg_isready -h "${POSTGRES_HOST}" -p "${POSTGRES_PORT}" -q >/dev/null 2>&1; do echo_with_timestamp "Waiting for PostgreSQL at ${POSTGRES_HOST}:${POSTGRES_PORT}..." sleep 1 done @@ -191,12 +180,9 @@ if [[ "$DISPATCHARR_ENV" == "modular" ]]; then echo "🔗 Modular mode: Using external Redis at ${REDIS_HOST}:${REDIS_PORT}" echo_with_timestamp "Waiting for external Redis to be ready..." until python3 -c " -import socket -import sys +import socket, sys try: - s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - s.settimeout(2) - s.connect(('${REDIS_HOST}', ${REDIS_PORT})) + s = socket.create_connection(('${REDIS_HOST}', ${REDIS_PORT}), timeout=2) s.close() sys.exit(0) except Exception: