Docker deployment for the Python relay

Run the FastAPI probe relay and Redis in Docker for reproducible upgrades on a home server or small VPS without dependency drift.

Stack of network switches with ethernet cables plugged into front ports
Pull feeds, MQTT bridges, and LAN relays often land on a switch before they leave the site. Photo: ShakataGaNai. CC BY-SA 3.0

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.

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.