wealth/docs/decisions/0067-no-per-app-nginx.md

1.3 KiB

0067 No nginx per app

Status: Accepted · Area: architecture · Date: 2026-10-16 · Decided by: user

Context

Each app had its own apps/<app>/nginx.conf and <app>-nginx container in front of its release, so tools/deploy.sh could swap releases with no refused request. The user removed it.

Decision

  • No nginx.conf in this repo. Each app's container publishes HTTP_PORT on the host itself (3000 inside the container).
  • tools/deploy.sh <app> checks the new release's /healthz in a container with no published port, then stops the old release and starts the new one on HTTP_PORT. A failed check leaves the old release serving; a failed start brings the old one back.
  • The edge that routes phones to bull and desktops to bear (0001) points at each app's HTTP_PORT.

Alternatives

  • One nginx per app, reloaded onto the new release: no refused requests during a swap, but one more container and config per app. Removed by the user.

Consequences

  • Each deploy refuses connections for the old release's shutdown (in-flight requests finish, 30 s at most) plus the new one's start, about half a second when idle.
  • /healthz answers on HTTP_PORT; the edge should hide it from visitors.
  • The edge must set Vary: User-Agent (0001) and must not buffer streamed pages (the apps send X-Accel-Buffering: no).