homek8s/apps/base/osint
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Lance Walters f0a82f85de apps(osint): set PGDATABASE=osint_data on osint-db
deploy/osint-db logged 'FATAL: database "osint" does not exist' straight
after it became ready (2026-11-21 22:15:15): any bare `psql -U osint` /
`pg_dump -U osint` inside the pod defaults the database to the user name.
PGDATABASE makes osint_data the default so ops commands cannot aim at a
database that does not exist. Probes already pass -d osint_data.
2026-11-21 17:58:33 -05:00
..
pg-image apps(osint): pg image r3 for timescaledb 2.32.1 on PG 16.16 2026-11-21 17:13:54 -05:00
app-deployment.yaml apps(osint): pin app to amd64-54897b49bc57 + ADS-B idle watch env 2026-11-21 17:42:10 -05:00
app-service.yaml apps(osint): deploy OSINT dashboard stack to k8s at osint.siriusdevops.com 2026-11-13 20:14:42 -05:00
backup-exec-rbac.yaml apps(backup): cover the remaining stateful gaps off-host 2026-11-19 17:14:36 -05:00
camera-deployment.yaml apps(osint): pin amd64-915f6cbe25be (critical-news renderer fix + Blue Marble default + slower ticker) 2026-11-19 23:48:48 -05:00
camera-pvc.yaml apps(osint): deploy OSINT dashboard stack to k8s at osint.siriusdevops.com 2026-11-13 20:14:42 -05:00
configmap.yaml apps(osint): pin app to amd64-54897b49bc57 + ADS-B idle watch env 2026-11-21 17:42:10 -05:00
httproute.yaml apps(osint): deploy OSINT dashboard stack to k8s at osint.siriusdevops.com 2026-11-13 20:14:42 -05:00
ingester-deployment.yaml apps(osint): place stateless CPU workers on the amd64 linode node 2026-11-21 16:24:16 -05:00
kustomization.yaml apps(osint): move osint-db onto a linode-local PVC 2026-11-21 16:47:03 -05:00
namespace.yaml apps(osint): deploy OSINT dashboard stack to k8s at osint.siriusdevops.com 2026-11-13 20:14:42 -05:00
nats-deployment.yaml apps(osint): place stateless CPU workers on the amd64 linode node 2026-11-21 16:24:16 -05:00
nats-service.yaml apps(osint): deploy OSINT dashboard stack to k8s at osint.siriusdevops.com 2026-11-13 20:14:42 -05:00
news-scraper-deployment.yaml apps(osint): place stateless CPU workers on the amd64 linode node 2026-11-21 16:24:16 -05:00
news-summarizer-deployment.yaml apps(osint): place stateless CPU workers on the amd64 linode node 2026-11-21 16:24:16 -05:00
postgres-deployment.yaml apps(osint): set PGDATABASE=osint_data on osint-db 2026-11-21 17:58:33 -05:00
postgres-pvc-linode.yaml apps(osint): move osint-db onto a linode-local PVC 2026-11-21 16:47:03 -05:00
postgres-pvc.yaml apps(osint): deploy OSINT dashboard stack to k8s at osint.siriusdevops.com 2026-11-13 20:14:42 -05:00
postgres-service.yaml apps(osint): deploy OSINT dashboard stack to k8s at osint.siriusdevops.com 2026-11-13 20:14:42 -05:00
README.md apps(osint): pg image r3 for timescaledb 2.32.1 on PG 16.16 2026-11-21 17:13:54 -05:00
titiler-deployment.yaml apps(osint): deploy OSINT dashboard stack to k8s at osint.siriusdevops.com 2026-11-13 20:14:42 -05:00
titiler-service.yaml apps(osint): deploy OSINT dashboard stack to k8s at osint.siriusdevops.com 2026-11-13 20:14:42 -05:00

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-r3 TimescaleDB 2.32.1 + PostGIS 3 on Postgres 16.16, local-path-linode PVC osint-pgdata-linode 15 Gi
osint-nats forgejo…/sirius/nats:2.10 JetStream event bus (-js -m 8222)
osint-app forgejo…/sirius/osint-dashboard:amd64-915f6cbe25be 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-fe2b5df369d0 "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

CI builds the cluster images. Since PR #63 in sirius/osint-dashboard, .forgejo/workflows/build.yml runs on the amd64 runner (runs-on: amd64), tags amd64-<sha12>, and pushes straight into the in-cluster registry (forgejo.forgejo.svc.cluster.local:3000, plain HTTP, whitelisted by --insecure-registry on the runner's dind). Deploying is then just a pin change here in apps/base/osint/ — check the run's ## Pin in homek8s summary for the exact tags. Builds are path-filtered, so one image can be several commits older than another: the app tag is normally master tip, the summarizer tag is whichever commit last touched news/summerizer/.

Do not build these by hand and push over a :amd64-<sha> tag: that replaces CI's manifest, and Forgejo's registry garbage-collects the displaced digest, so the CI artifact cannot be pulled back. If you need a tag rebuilt, dispatch CI instead: POST /api/v1/repos/sirius/osint-dashboard/actions/workflows/build.yml/dispatches with {"ref":"master","inputs":{"rebuild_all":"true"}}.

Manual builds exist only as a historical fallback (pre-#63 images, or a CI outage) — and then 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-<sha> image that carried the right tag and none of the commit's code.

# fallback only — the normal path is: let CI build, then pin the tag here
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.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.

It also pins the TimescaleDB packages to 2.32.1~debian12-1616 (the -1616 suffix = built against PG 16.16) and the base image to the 16.16 minor. PG 16.16 added the PortalDrop() "cannot drop portal while it is being set up" check that TimescaleDB <=2.32.0 trips in its background-worker path, so every policy job failed with SQLSTATE 24000 while CALL run_job() worked (timescale/timescaledb#11038, fixed in 2.31.2/2.32.1). Never unpin either half: a pg minor bump without a matching TimescaleDB build reintroduces the failure. -r3 is that build. After a pod recreate the extension itself still has to be moved: ALTER EXTENSION timescaledb UPDATE TO '2.32.1'.

Secrets (never in git)

kubectl -n osint create secret generic osint-db --from-literal=password='<strong>'

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)

# password -> pbkdf2 hash (from a checkout of sirius/osint-dashboard)
python app/auth.py hash '<password>'
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.

Analyst grading (PR #53 + #54)

The map call scores every article 0-100 against a rubric in the same request (no extra round-trip): 90+ breaking geopolitical/military/disaster, 70-89 significant national/international, 40-69 notable regional, 10-39 routine/crime, 0-9 noise (sport, celebrity, market tape, event-calendar listings). Only blocks scoring >= SUMMARY_MIN_SCORE (60) reach the reduce prompt, capped at SUMMARY_TOP_N (12). If nothing clears the bar the fallback may only pick blocks >= SUMMARY_FALLBACK_MIN_SCORE (40), and if none clear that the brief is the honest No significant developments in this window. — SUMMARY_FALLBACK_TOP=0 disables the fallback entirely.

get_recent_news() uses a closed window (now - window, now]: future-dated rows must never be re-graded every 15 minutes (they are dropped at ingest and hidden in /api/news — see above).

Every graded article is persisted to article_scores (score, category, selected, model, summary_id) for threshold tuning, e.g.

select width_bucket(score, 0, 100, 10) * 10 as bucket, count(*), avg(selected::int)
from article_scores group by 1 order by 1;

Before the threshold/cap, dedupe_blocks() collapses syndicated wire copies (six Hearst stations carrying one AP story) onto the best-scoring representative, comparing normalised titles — lowercase, source suffix ( - KCCI, | CNN) stripped when the tail is short and digit-free — with word-set Jaccard / sequence similarity >= SUMMARY_DEDUPE_SIMILARITY (0.85). Duplicates are still graded and persisted, with selected=false and duplicate_of pointing at the survivor. SUMMARY_DEDUPE=0 disables the collapse.

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).