Fix pgbouncer scram-sha-256 auth and document Postgres prod env vars
CI / lint (push) Canceled after 0s
CI / typecheck (push) Canceled after 0s
CI / unit-tests (push) Canceled after 0s
CI / integration-tests (push) Canceled after 0s
CI / container-build (push) Canceled after 0s
CI / dependency-audit (push) Canceled after 0s

Two real bugs hit during tonight's first production deploy (found and
fixed live on the server, folded back into the tracked config so the
next deploy doesn't hit either wall):

1. pgbouncer defaults to md5 auth; postgres:17-alpine defaults password_encryption
   to scram-sha-256. Every connection failed with "wrong password type"
   until AUTH_TYPE=scram-sha-256 was set explicitly on the pgbouncer service.

2. POSTGRES_USER/PASSWORD/DB were never documented anywhere (not in
   .env.example, despite docker-compose.prod.yml requiring them) --
   added, with a note against `openssl rand -base64` for the password
   specifically: its output can contain /+=, which breaks pgbouncer's
   (and any DATABASE_URL parser's) naive URL parsing. Pointed at
   token_urlsafe instead, matching the other generated secrets.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
This commit is contained in:
NixReaper
2026-09-05 21:52:11 -05:00
co-authored by Claude Sonnet 5
parent 905cd202eb
commit 39b2d4bfcd
3 changed files with 18 additions and 2 deletions
+4
View File
@@ -39,6 +39,10 @@ services:
POOL_MODE: transaction
MAX_CLIENT_CONN: "1000"
DEFAULT_POOL_SIZE: "25"
# postgres:17-alpine defaults password_encryption to scram-sha-256;
# pgbouncer defaults auth_type to md5, which then fails every
# connection with "wrong password type" against a scram-only server.
AUTH_TYPE: scram-sha-256
depends_on:
postgres:
condition: service_healthy