# OSINT Dashboard stack (namespace `osint`) Ported from the Pi docker-compose stack in `sirius/osint-dashboard` so the dashboard is served from the cluster at **https://osint.siriusdevops.com** instead of a host Docker container on the Pi. ## Workloads | Deployment | Image | Purpose | |---|---|---| | `osint-db` | `forgejo…/sirius/osint-dashboard-pg:amd64-c48788d4b614-r2` | TimescaleDB 2 + PostGIS 3 on Postgres 16, `local-path` PVC `osint-pgdata` 15 Gi | | `osint-nats` | `forgejo…/sirius/nats:2.10` | JetStream event bus (`-js -m 8222`) | | `osint-app` | `forgejo…/sirius/osint-dashboard:amd64-58f71f5b4520` | FastAPI + static HUD; runs `alembic upgrade heads` on start; single-admin auth (`app/auth.py`) — public read-only site, admin-only keys/settings/mutations | | `osint-ingester` | same app image | RSS/GDELT/USGS/FIRMS/vessel ingest → NATS → Postgres | | `osint-camera-service` | same app image | public-camera discovery + snapshots (PVC `osint-camera-snapshots` 3 Gi, shared with the app) | | `osint-titiler` | `forgejo…/sirius/titiler:0.26.0` | SAR COG tile proxy, exposed same-origin at `/titiler` | | `osint-news-scraper` | `forgejo…/sirius/osint-news-scraper:amd64-58f71f5b4520` | Scrapy news scraper loop | | `osint-news-summarizer` | `forgejo…/sirius/osint-news-summarizer:amd64-c48788d4b614` | "analyst" — Nous Portal briefs every 15 min + 23:00 recap | Every workload is pinned to `kubernetes.io/hostname: siriussec` (Gateway/Envoy co-location + local-path PVs). ## Images The upstream CI (`.forgejo/workflows/build.yml` in `sirius/osint-dashboard`) builds **arm64** for the Pi via `runs-on: docker`. The cluster is amd64, so the cluster images were built on an amd64 host and pushed to the Forgejo registry over a `kubectl -n forgejo port-forward svc/forgejo 3000:3000` (Cloudflare rejects layer uploads ≳100 MB on the public hostname). **Build from a detached worktree at the merge sha, never from the main checkout** — Legion's `~/osint-dashboard` sits on a feature branch, and a `docker build` there once produced a `:amd64-` image that carried the right tag and none of the commit's code (that tag was deleted from the registry; `-r1` is the real build). ```bash # from the manifests repo root; build the merge sha, not whatever the checkout has git -C ~/osint-dashboard fetch origin git -C ~/osint-dashboard worktree add --detach /tmp/osint-build origin/master cd /tmp/osint-build && SHA=$(git rev-parse --short=12 HEAD) && TAG="amd64-$SHA" docker build -f Dockerfile -t 127.0.0.1:3000/sirius/osint-dashboard:$TAG . docker build -f news/scraper/Dockerfile -t 127.0.0.1:3000/sirius/osint-news-scraper:$TAG news/scraper docker build -f news/summerizer/Dockerfile -t 127.0.0.1:3000/sirius/osint-news-summarizer:$TAG news/summerizer docker build -f pg-image/Dockerfile -t 127.0.0.1:3000/sirius/osint-dashboard-pg:$TAG-r2 . ``` `pg-image/Dockerfile` is the cluster copy of `Dockerfile.pg`. **It pins `postgres:16-bookworm`**: the upstream file's bare `postgres:16` now resolves to Debian trixie, whose `postgresql-16-postgis-3` (3.7.0+pgdg13) fails to load against PG 16.15 with `undefined symbol: heap_datum_check` — `CREATE EXTENSION postgis` crashes the server. On bookworm (`+pgdg12`) PostGIS 3.7 loads and `create_hypertable()` works. Port the one-line base-image pin upstream when the Pi stack is next rebuilt. ## Secrets (never in git) ```bash kubectl -n osint create secret generic osint-db --from-literal=password='' ``` `osint-db/password` is used for `POSTGRES_PASSWORD` and every workload's `DB_PASSWORD`. Regenerating it requires the Postgres role password to be changed too (`ALTER ROLE osint PASSWORD …`), not just the Secret. API keys (Nous Portal `NOUS_API_KEY`, FIRMS, AISStream, VesselAPI) are **not** Kubernetes Secrets: they live in the dashboard's `api_keys` table and are set from the Keys page in the UI (`GET/PUT /api/keys`). The summarizer reads `NOUS_API_KEY` from the env first, then from that table. Since the auth change the Keys page is **admin-only**, so set them while signed in (`/login`). ### Admin login (`osint-admin`) ```bash # password -> pbkdf2 hash (from a checkout of sirius/osint-dashboard) python app/auth.py hash '' python -c 'import secrets; print(secrets.token_urlsafe(48))' # session secret kubectl -n osint create secret generic osint-admin \ --from-literal=ADMIN_USER=lance \ --from-literal=ADMIN_PASSWORD_HASH='pbkdf2_sha256$…' \ --from-literal=ADMIN_SESSION_SECRET='…' kubectl -n osint rollout restart deploy/osint-app # env is fixed at container start ``` `ADMIN_USER=lance`; the current password lives in `~/.hermes/secrets/osint_admin_password` (0600, Legion) — never in git. The three refs in `app-deployment.yaml` are `optional: true` on purpose: a missing Secret must not block startup, and the app then **fails closed** (admin routes `403 {"detail":"admin auth not configured"}`) while the public HUD keeps serving. The session cookie is `HttpOnly` + `SameSite=Lax` + `Secure`. `Secure` comes from `ADMIN_COOKIE_SECURE=1` (ConfigMap), **not** from header inference: the tunnel origins at plain HTTP and Cilium Envoy rewrites `X-Forwarded-Proto` to `http`, so `app/auth.py::_is_https()` never sees https (an explicit request header is discarded too — verified). Leave the flag unset only if you ever serve this over plain http locally; browsers will not send a `Secure` cookie there. ## News list hygiene `/api/news` orders by `articles.timestamp DESC`, so anything dated in the future pins the top of the feed indefinitely. Two guards (PR #52): - the Scrapy pipeline drops items dated more than **2 h** ahead (`FUTURE_TOLERANCE` in `newsScraper/pipelines.py`), counting them under the `future_dated_dropped` stat and logging one INFO line per crawl; - `GET /api/news` additionally excludes `timestamp > now()` (keeping `timestamp IS NULL` rows), so rows already in the table can never resurface early. Items with an unparseable date are still kept — the guard only fires on a date it can actually parse. ## Analyst model `SUMMARY_MODEL=meituan/longcat-2.5:free` (free tier on the Nous Portal, 1M context, verified to honour `response_format: json_object`). It is set in `configmap.yaml`; changing it in the UI (`PUT /api/settings`) only takes effect when the env var is empty, because `resolve_model()` prefers the env. ## Ingress Cloudflare tunnel `sirius home` already carries `osint.siriusdevops.com` → `http://10.10.0.2:8080`. DNS is a proxied CNAME to `6d0702eb-99cc-4062-b57d-e70e2f1a7895.cfargotunnel.com`. HTTPRoute rule order: `/titiler` (prefix stripped) → `osint-titiler:8000`, then `/` → `osint-app:8000` (WebSocket `/ws/live` included).