Docker deployment for the Python relay

Run FastAPI relay and Redis in containers for reproducible upgrades on a home server or small VPS.

Bare-metal systemd works, but Docker Compose bundles the FastAPI relay, Redis cache, and reverse-proxy sidecars with one docker compose up. Images rebuild from locked requirements; volumes preserve Redis data across restarts—useful when the garage router reboots and upstream Arduino needs a minute to return.

Docker Compose stack with relay, Redis, and reverse proxy containers
Compose services for FastAPI, Redis, and TLS proxy deploy as one reproducible stack.

Typical compose services

  • relay — uvicorn app polling LAN JSON.
  • redis — cache with persistent volume optional.
  • caddy/nginx — TLS termination per relay security.

Configuration

Mount env files read-only—details in environment variables. Set upstream Arduino URL after IP planning. Expose health endpoints for uptime monitors.

Operations

  1. Pin image tags; avoid `:latest` on production home servers.
  2. Log rotation on the host disk—JSON polls are chatty at DEBUG.
  3. After schema changes, verify JSON schema before redeploy.