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>
14 lines
491 B
YAML
14 lines
491 B
YAML
# Local-dev overlay. Adds host-side port bindings that production deliberately omits.
|
|
#
|
|
# Use:
|
|
# docker compose -f docker-compose.v2.yml -f docker-compose.v2.dev.yml up -d
|
|
#
|
|
# This is convenience-only. Connect from the host via:
|
|
# psql -h 127.0.0.1 -p ${DB_V2_PORT:-5437} -U srv2_user social_reporting_v2
|
|
name: social-reporting-v2
|
|
|
|
services:
|
|
db-v2:
|
|
ports:
|
|
# Bind to 127.0.0.1 to keep the db unreachable from outside this machine.
|
|
- "127.0.0.1:${DB_V2_PORT:-5437}:5432"
|