3.4 KiB
type, updated, tags
| type | updated | tags | |||||
|---|---|---|---|---|---|---|---|
| entity | 2026-07-12 |
|
Deployment — Docker / Gitea CI / Komodo / Traefik
How the backend (+ built frontend) ships to production. Added 2026-07-12; ⚠️ pipeline authored but the first run through the Gitea runner is still pending (no Docker on the dev machine — the runner is the first place the image actually builds).
Shape
One image, one container, one stack:
Dockerfile(repo root) — two stages:node:24-alpinerunsnpm ci && npm run buildinfrontend/, thenpython:3.13-sliminstallsbackend/requirements.txt, copiesbackend/+ the builtdist/to wherebackend/main.pyexpects it (/app/frontend/dist). Runs as UID 1000 under tini,CMD python -m backend.main.- State on a volume:
BACKEND_DB=/data/backend.dbandBACKEND_EVENTS=/data/events.jsonlenv overrides (the latter added 2026-07-12 tojournal.py, mirroring the existingstore.pyoverride) put all mutable state on theartiot-datavolume — the container is disposable. compose.yaml— the Komodo-managed stack. Env-tunable:ARTIOT_TAG(defaultmain; set a commit SHA to pin/rollback),ARTIOT_HOST,TRAEFIK_NETWORK(defaulttraefik),ARTIOT_ENTRYPOINT(websecure),ARTIOT_CERTRESOLVER(letsencrypt).GET /api/health— unauthenticated liveness probe (added 2026-07-12) used by the Docker healthcheck; also handy for Traefik/Komodo.
Two front doors, same port
| Door | Path | Why |
|---|---|---|
| Charger | ws://<docker-host>:9000/<ChargerID> — published port, no proxy |
The URL is hardcoded in the charger touchscreen (change = power-cycle, troubleshooting #4) and the [[jc-6620 |
| Humans | https://$ARTIOT_HOST via Traefik labels |
Panel with TLS; same container port 9000. |
CI (.gitea/workflows/build.yml)
Mirrors the polymarket-bot repo's pattern. On push to main (paths-filtered): plain docker build → smoke test gate (backend/smoke_test.py, 65 checks — REST auth/scopes, per-gun cards, pending-card workflow, OCPP WS round-trips via a fake charge point, session store, SPA serving; in-process against a temp db, promoted into the repo 2026-07-12) → push git.infra.msai.al/art/charging_station:{main,<sha>} → HMAC-signed Komodo stack redeploy webhook. A failed smoke test means the image is never pushed.
Repo secrets required: REGISTRY_USERNAME, REGISTRY_PASSWORD, KOMODO_STACK_WEBHOOK_URL, KOMODO_WEBHOOK_SECRET.
Migration & constraints
- Moving the existing install: copy the current
backend/backend.dbinto the volume (docker compose cp backend/backend.db artiot:/data/backend.db, restart) — users, cards, sessions, and the session-signing secret all ride along, so nobody re-logs-in. Fresh install instead:docker compose exec artiot python -m backend.users add <name> --scopes admin. - Charger reachability: today the charger dials
10.0.10.203:9000— either the Docker host takes over that address or the touchscreen URL changes (power-cycle). ❓ ties into the always-on-host decision in overview. - Relay reachability: wifi-relays is plain TCP to the relay IPs — the Docker host's network must reach that subnet (bridge networking is fine; device discovery by broadcast is not needed once IPs are registered).