From 1b5c8fc4a9b6a22e29b4e4ec708e7cb4f22d9c49 Mon Sep 17 00:00:00 2001 From: Adam French Date: Wed, 14 Oct 2026 21:27:02 +0100 Subject: [PATCH] Document the activity tracker's admin-gated pages The tracker now gates its dashboard and new setup page on the site's admin session, as jobs does. Pass it AUTH_VALIDATE_URL built from BACKEND_HOST/PORT so it follows the backend if that is renamed. Co-Authored-By: Claude Opus 5.5 --- DEPLOYMENT.md | 2 +- docker-compose.yml | 12 +++++++++--- nginx/nginx_routes.conf.template | 5 ++++- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/DEPLOYMENT.md b/DEPLOYMENT.md index fb758fb..ca3c10c 100644 --- a/DEPLOYMENT.md +++ b/DEPLOYMENT.md @@ -57,7 +57,7 @@ backend icecast2 gitea sb sb-pub python | | | silverbullet-git | n/a | n/a | none (timer loop) | no | | python (FastAPI) | `${PYTHON_HOST}` | `${PYTHON_PORT}` | `/py/`, docs at `/py/docs` | no | | jobs (job tracker, published image) | `jobs` | 8080 | `/jobs/` (admin-gated by the app itself) | no | -| activity-tracker (published image, adamf/ccp) | `activity-tracker` | 8080 | `/tracker/`, prefix stripped (per-device bearer keys) | no | +| activity-tracker (published image, adamf/ccp) | `activity-tracker` | 8080 | `/tracker/`, prefix stripped (collectors: per-device bearer keys; pages: admin-gated by the app itself) | no | | icecast2 + liquidsoap | `${ICECAST_HOST}` | `${ICECAST_PORT}` | `/radio/` | **harbor port only** | | gitea | `${GITEA_HOST}` | 3000, 2222 | `/gitea/` | **3000, 2222** | | vue | `vue` | 5173 (dev only) | `/` (dev only) | no | diff --git a/docker-compose.yml b/docker-compose.yml index 6e40a31..e1233cf 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -481,9 +481,14 @@ services: # # Same shape as jobs: an explicit `environment:` list and a database role of # its own, created by hand once (the ccp README has the command). It applies - # its own migrations on start. Collectors authenticate with per-device - # bearer keys made by `docker exec activity-tracker tracker apikey create`; - # nothing here touches the site's login. No state outside Postgres. + # its own migrations on start. No state outside Postgres. + # + # Two kinds of auth. Collectors send per-device bearer keys, made on the + # tracker's /tracker/setup page or with `docker exec activity-tracker + # tracker apikey create`. The dashboard and setup pages have no login of + # their own: like jobs, the tracker asks AUTH_VALIDATE_URL (the backend's + # validate-admin) with the visitor's cookies and sends anyone else to + # /admin/login. activity-tracker: image: adam-french.co.uk/adamf/activity-tracker:${ACTIVITY_TRACKER_IMAGE_TAG:-latest} container_name: activity-tracker @@ -496,6 +501,7 @@ services: environment: - DATABASE_URL=postgres://${POSTGRES_TRACKER_USER:-tracker}:${POSTGRES_TRACKER_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_TRACKER_DB:-tracker}?sslmode=disable - TRACKER_TZ=${TRACKER_TZ:-} + - AUTH_VALIDATE_URL=http://${BACKEND_HOST}:${BACKEND_PORT}/auth/validate-admin # Self-hosted git, served at /gitea/ and on port 3000 directly. Also the CI # server: .gitea/workflows/deploy.yaml redeploys this whole stack on push to diff --git a/nginx/nginx_routes.conf.template b/nginx/nginx_routes.conf.template index 44dd8e7..c568d43 100644 --- a/nginx/nginx_routes.conf.template +++ b/nginx/nginx_routes.conf.template @@ -368,7 +368,10 @@ # ---- Activity tracker (/tracker/) ---- # Its own container (the adamf/ccp repo): an ingest API for device # collectors, which send batches of events with a per-device bearer - # key. The app does its own auth, so no auth_request. Unlike /jobs/ + # key, plus a dashboard and setup page. The app does its own auth, so + # no auth_request: the pages check the site session by asking the + # backend's validate-admin with the visitor's cookies, as /jobs/ + # does, and /tracker.user.js is public. Unlike /jobs/ # the prefix IS stripped: the server serves /api/v1/... and /readyz # from /. Collectors must use the www host: the apex 301 would turn # their POSTs into GETs. Health Auto Export bodies can be several MB;