The host port 5437 on the optical-dev server was already allocated by
something (probably an old stopped-but-not-removed Postgres container
or another tracking app). V2 doesn't need a host port for db-v2 in
production — app-v2 reaches it over the docker network at db-v2:5432.
Per CLAUDE.md "always check for ports that are already used":
- docker-compose.v2.yml: remove the unconditional db-v2 host port
binding. Compose's list-merge semantics meant `ports: []` in the prod
override didn't actually clear the base list.
- docker-compose.v2.dev.yml (new): local-dev overlay that re-adds the
host port for psql convenience. Use with `-f base -f dev`. Bound to
127.0.0.1 so the db is never reachable from outside the dev machine.
- cutover-in-place.sh: pre-flight check on APP_V2_PORT (3457) — if
it's held by something other than our own V2 container, abort with
a clear message rather than failing mid-deploy.
Verified locally: `compose -f base -f prod up -d` brings up a stack
with db-v2 having no host port (just internal 5432/tcp), app-v2 on
127.0.0.1:3457, /api/health returns {ok:true}.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
20 lines
762 B
YAML
20 lines
762 B
YAML
# Production overrides for V2.
|
|
# Use: docker compose -f docker-compose.v2.yml -f docker-compose.v2.prod.yml up -d
|
|
#
|
|
# Per CLAUDE.md "always check for ports that are already used" — in production we
|
|
# only expose what we have to. db-v2 is reachable from app-v2 over the docker
|
|
# network at hostname `db-v2:5432`; the host-side port mapping only matters for
|
|
# debug psql from the host, which isn't needed in prod. Same goes for app-v2 —
|
|
# Apache reaches it on 127.0.0.1:3457 (kept), but the db has no host binding here.
|
|
name: social-reporting-v2
|
|
|
|
services:
|
|
db-v2:
|
|
restart: unless-stopped
|
|
|
|
app-v2:
|
|
restart: unless-stopped
|
|
environment:
|
|
- NODE_ENV=production
|
|
- SESSION_SECRET=${SESSION_SECRET}
|
|
- ALLOWED_ORIGIN=${ALLOWED_ORIGIN}
|