diff --git a/ops/restore-drill.sh b/ops/restore-drill.sh index 6424ef43..e272361d 100755 --- a/ops/restore-drill.sh +++ b/ops/restore-drill.sh @@ -113,7 +113,15 @@ log "Container up, mapped to 127.0.0.1:${host_port} (only reachable while this d log "Waiting for postgres to accept connections (timeout ${READY_TIMEOUT}s)..." ready=0 for _ in $(seq 1 "$READY_TIMEOUT"); do - if docker exec "$CONTAINER" pg_isready -U postgres >/dev/null 2>&1; then + # -h 127.0.0.1 is load-bearing, NOT cosmetic. The postgres image runs a + # TEMPORARY server during initialisation, and that server already answers + # "accepting connections" on the unix socket. Probing the socket therefore + # goes green mid-init; the restore starts against the temporary server and + # dies with "FATAL: terminating connection due to administrator command" + # the moment the entrypoint shuts it down to start the real one. The + # temporary server does NOT listen on TCP, so a TCP probe only goes green + # on the real server. Same reasoning, same fix as ci-tradein.yml:137-141. + if docker exec "$CONTAINER" pg_isready -h 127.0.0.1 -U postgres >/dev/null 2>&1; then ready=1 break fi