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 LAN router reboots and upstream Arduino needs a minute to return.
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
- Pin image tags; avoid `:latest` on production home servers.
- Log rotation on the host disk. JSON polls are chatty at DEBUG.
- After schema changes, verify JSON schema before redeploy.