Skip to main content

0003. Containers and delivery

  • Status: Accepted
  • Date: 2026-11-18

Context​

The app has to run on a home server on the same LAN as the bulbs, and the code lives on GitHub. We want reproducible artifacts built by a pipeline, one stack to run locally or for tests, and one for production that uses the published artifacts.

The browser must reach the SPA and the API from the same origin, so CORS never comes up. The proxy that does it should be as light as possible.

Decision​

AreaChoiceRejectedWhy
PackagingOne Docker image per app: wiz-control-server and wiz-control-websystemd services on the hostSame artifact in CI, locally, and in production. Nothing to install on the host but Docker.
Reverse proxynginx inside the web image: serves the SPA and proxies /api to the APIA separate Caddy or Traefik container, CORS middleware in FastAPI, FastAPI serving the static filesNo third container: the web image already needs a static server. One origin, so no CORS. FastAPI serving files would tie the frontend artifact to the backend.
Container networkDefault compose bridge network. Only the web port is publishednetwork_mode: hostDiscovery sweeps the subnet with unicast, and the replies pass the bridge NAT. Verified with three real bulbs. Host mode would also expose the API to the LAN.
RegistryGitHub Container Registry (GHCR)Docker HubNext to the code. CI pushes with the built-in GITHUB_TOKEN, no extra secret.
PipelineGitHub Actions with jdx/mise-actionOne setup action per toolCI gets the exact tool versions from mise.toml, the same as local.
Image tagslatest from main, sha-<short> on every push, vX.Y.Z and vX.Y from v* git tagslatest onlyProduction can pin a release with WIZ_VERSION and roll back.
Compose filescompose.yaml builds from the Dockerfiles. compose.prod.yaml pulls from GHCROne file with profiles or overridesTwo short files, each readable alone.

Consequences​

  • Broadcast discovery does not work from the bridge network. WIZ_TARGETS must name the LAN subnet. Both compose files refuse to start without it.
  • Docker builds use the repo root as context, because each app needs workspace files (uv.lock, pnpm-lock.yaml).
  • The web image builds without Python, because the generated OpenAPI types are committed. CI fails if they drift from the server.
  • There is no authentication. Anyone on the LAN who can open the web port can control the bulbs.