Run the test PostgreSQL behind an init and let pg_isready give up before Docker (refs #98)
The server log of a failing job shows every restart as 'untracked child process exited with exit code 2'. A health check that outlives its 3-second timeout leaves pg_isready to PostgreSQL, which is PID 1 in its container; when pg_isready exits the postmaster takes it for a crashed backend and restarts every connection. --init reaps such orphans, and pg_isready -t 5 under a 15-second timeout is never cut off. Same change in docker-compose.yml. ADR 0015. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
72f4cbe0a5
commit
6ea303e1dc
4 files changed
+58
-5
No files matched your search
+5
-2
@@ -31,6 +31,9 @@ services:
|
||||
|
||||
postgres:
|
||||
image: postgres:18
|
||||
# An init as PID 1 and a pg_isready that gives up before Docker does (ADR 0015): otherwise a slow health check
|
||||
# leaves pg_isready to PostgreSQL, and its exit makes the server restart every connection.
|
||||
init: true
|
||||
environment:
|
||||
POSTGRES_DB: anubis
|
||||
POSTGRES_USER: anubis
|
||||
@@ -38,9 +41,9 @@ services:
|
||||
ports:
|
||||
- "127.0.0.1:55432:5432"
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U anubis -d anubis"]
|
||||
test: ["CMD-SHELL", "pg_isready -U anubis -d anubis -t 5"]
|
||||
interval: 3s
|
||||
timeout: 3s
|
||||
timeout: 15s
|
||||
retries: 20
|
||||
volumes:
|
||||
- postgres-data:/var/lib/postgresql
|
||||
|
||||
Reference in new issue
Block a user