apps(osint): fix Postgres image base (bookworm) + nats monitoring port

The cluster PG image built FROM postgres:16 resolved to Debian trixie, whose
postgresql-16-postgis-3 (3.7.0+pgdg13) cannot load against PG 16.15:
'undefined symbol: heap_datum_check'. CREATE EXTENSION postgis crashed the
server and crashlooped osint-app/osint-camera-service. Rebuild pinned to
postgres:16-bookworm (+pgdg12), verified CREATE EXTENSION postgis +
timescaledb + create_hypertable() by hand before re-tagging.

nats: pass -m 8222 so the monitoring/healthz endpoint the readiness probe hits
actually listens.

Also documents the stack + build/push/secret steps in apps/base/osint/README.md.
This commit is contained in:
Lance Walters 2026-11-13 20:20:09 -05:00
commit cb86b6972f
4 changed files with 99 additions and 2 deletions

75
apps/base/osint/README.md Normal file
View file

@ -0,0 +1,75 @@
# 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-c48788d4b614` | FastAPI + static HUD; runs `alembic upgrade heads` on start |
| `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-c48788d4b614` | 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
images above 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).
```bash
cd ~/osint-dashboard
SHA=$(git rev-parse --short=12 HEAD)
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='<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.
## 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).

View file

@ -25,7 +25,7 @@ spec:
- name: nats
image: forgejo.siriusdevops.com/sirius/nats:2.10
imagePullPolicy: IfNotPresent
args: ["-js", "-sd", "/data"]
args: ["-js", "-m", "8222", "-sd", "/data"]
ports:
- containerPort: 4222
name: client

View file

@ -0,0 +1,22 @@
# Cluster build of the OSINT Postgres image (amd64).
#
# Identical to `Dockerfile.pg` in sirius/osint-dashboard EXCEPT the base image
# is pinned to bookworm. The upstream `FROM postgres:16` now resolves to Debian
# trixie, where postgresql-16-postgis-3 (3.7.0+pgdg13) fails to load against
# PostgreSQL 16.15:
# could not load library "/usr/lib/postgresql/16/lib/postgis-3.so":
# undefined symbol: heap_datum_check
# On bookworm (+pgdg12) both extensions load and create_hypertable() works.
FROM postgres:16-bookworm
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates curl gnupg lsb-release && \
curl -fsSL https://packagecloud.io/install/repositories/timescale/timescaledb/script.deb.sh | bash && \
apt-get update && apt-get install -y --no-install-recommends \
postgresql-16-postgis-3 timescaledb-2-postgresql-16 && \
mkdir -p /etc/postgresql/16/main/conf.d && \
echo "shared_preload_libraries = 'timescaledb'" > /etc/postgresql/16/main/conf.d/timescaledb.conf && \
rm -rf /var/lib/apt/lists/*
# The official postgres entrypoint remains the CMD and handles
# POSTGRES_USER / POSTGRES_DB / POSTGRES_PASSWORD and pg_hba setup.

View file

@ -31,7 +31,7 @@ spec:
kubernetes.io/hostname: siriussec
containers:
- name: postgres
image: forgejo.siriusdevops.com/sirius/osint-dashboard-pg:amd64-c48788d4b614
image: forgejo.siriusdevops.com/sirius/osint-dashboard-pg:amd64-c48788d4b614-r2
imagePullPolicy: IfNotPresent
args:
- -c