From f290b3c457fc868c219ae13e6ae5ab13a1cc211f Mon Sep 17 00:00:00 2001 From: Lance Walters Date: Fri, 13 Nov 2026 20:14:37 -0500 Subject: [PATCH] apps(osint): deploy OSINT dashboard stack to k8s at osint.siriusdevops.com New namespace `osint` with the full dashboard stack ported from the Pi docker compose file: TimescaleDB+PostGIS Postgres, NATS JetStream, FastAPI app, ingester, camera-discovery service, TiTiler tile proxy, and the vendored news pipeline (Scrapy scraper + Nous Portal summarizer). - Images built amd64 (the Pi CI only builds arm64) and pushed to the Forgejo registry as :amd64-c48788d4b614; nats/titiler mirrored there too so every pod pulls from one host. - All workloads pinned to siriussec (Gateway/Envoy co-location, local-path PVs). - Postgres is a Deployment+PVC, not CNPG: the alembic chain needs postgis + timescaledb extensions and create_hypertable(). - HTTPRoute osint.siriusdevops.com: /titiler prefix-stripped to TiTiler, everything else to the app (incl. /ws/live). - DB password is Secret osint-db, created out of band (not in git). - Analyst model = meituan/longcat-2.5:free on Nous Portal (free tier). --- apps/base/osint/app-deployment.yaml | 85 +++++++++++++++++++ apps/base/osint/app-service.yaml | 12 +++ apps/base/osint/camera-deployment.yaml | 51 +++++++++++ apps/base/osint/camera-pvc.yaml | 12 +++ apps/base/osint/configmap.yaml | 62 ++++++++++++++ apps/base/osint/httproute.yaml | 34 ++++++++ apps/base/osint/ingester-deployment.yaml | 43 ++++++++++ apps/base/osint/kustomization.yaml | 20 +++++ apps/base/osint/namespace.yaml | 4 + apps/base/osint/nats-deployment.yaml | 53 ++++++++++++ apps/base/osint/nats-service.yaml | 15 ++++ apps/base/osint/news-scraper-deployment.yaml | 44 ++++++++++ .../osint/news-summarizer-deployment.yaml | 44 ++++++++++ apps/base/osint/postgres-deployment.yaml | 82 ++++++++++++++++++ apps/base/osint/postgres-pvc.yaml | 12 +++ apps/base/osint/postgres-service.yaml | 12 +++ apps/base/osint/titiler-deployment.yaml | 51 +++++++++++ apps/base/osint/titiler-service.yaml | 12 +++ apps/home/kustomization.yaml | 1 + 19 files changed, 649 insertions(+) create mode 100644 apps/base/osint/app-deployment.yaml create mode 100644 apps/base/osint/app-service.yaml create mode 100644 apps/base/osint/camera-deployment.yaml create mode 100644 apps/base/osint/camera-pvc.yaml create mode 100644 apps/base/osint/configmap.yaml create mode 100644 apps/base/osint/httproute.yaml create mode 100644 apps/base/osint/ingester-deployment.yaml create mode 100644 apps/base/osint/kustomization.yaml create mode 100644 apps/base/osint/namespace.yaml create mode 100644 apps/base/osint/nats-deployment.yaml create mode 100644 apps/base/osint/nats-service.yaml create mode 100644 apps/base/osint/news-scraper-deployment.yaml create mode 100644 apps/base/osint/news-summarizer-deployment.yaml create mode 100644 apps/base/osint/postgres-deployment.yaml create mode 100644 apps/base/osint/postgres-pvc.yaml create mode 100644 apps/base/osint/postgres-service.yaml create mode 100644 apps/base/osint/titiler-deployment.yaml create mode 100644 apps/base/osint/titiler-service.yaml diff --git a/apps/base/osint/app-deployment.yaml b/apps/base/osint/app-deployment.yaml new file mode 100644 index 0000000..5378408 --- /dev/null +++ b/apps/base/osint/app-deployment.yaml @@ -0,0 +1,85 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: osint-app + namespace: osint + labels: + app: osint-app +spec: + replicas: 1 + selector: + matchLabels: + app: osint-app + template: + metadata: + labels: + app: osint-app + spec: + tolerations: + - key: dedicated + operator: Exists + effect: PreferNoSchedule + nodeSelector: + kubernetes.io/hostname: siriussec + initContainers: + # Wait for Postgres before alembic runs (the entrypoint migrates). + - name: wait-for-db + image: forgejo.siriusdevops.com/sirius/osint-dashboard:amd64-c48788d4b614 + imagePullPolicy: IfNotPresent + command: + - python + - -c + - | + import os, socket, sys, time + host, port = os.environ.get("DB_HOST", "osint-db"), int(os.environ.get("DB_PORT", "5432")) + deadline = time.time() + 300 + while time.time() < deadline: + try: + with socket.create_connection((host, port), timeout=3): + print("postgres is reachable"); sys.exit(0) + except OSError: + time.sleep(3) + sys.exit("postgres did not become reachable in 300s") + containers: + - name: app + image: forgejo.siriusdevops.com/sirius/osint-dashboard:amd64-c48788d4b614 + imagePullPolicy: IfNotPresent + ports: + - containerPort: 8000 + name: http + envFrom: + - configMapRef: + name: osint-env + env: + - name: DB_PASSWORD + valueFrom: + secretKeyRef: + name: osint-db + key: password + readinessProbe: + httpGet: + path: /api/health + port: 8000 + initialDelaySeconds: 10 + periodSeconds: 15 + failureThreshold: 6 + livenessProbe: + httpGet: + path: /api/health + port: 8000 + initialDelaySeconds: 90 + periodSeconds: 30 + failureThreshold: 5 + volumeMounts: + - name: snapshots + mountPath: /data/snapshots + resources: + requests: + cpu: 100m + memory: 256Mi + limits: + memory: 1Gi + volumes: + - name: snapshots + persistentVolumeClaim: + claimName: osint-camera-snapshots diff --git a/apps/base/osint/app-service.yaml b/apps/base/osint/app-service.yaml new file mode 100644 index 0000000..a0f9f4d --- /dev/null +++ b/apps/base/osint/app-service.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: Service +metadata: + name: osint-app + namespace: osint +spec: + selector: + app: osint-app + ports: + - name: http + port: 8000 + targetPort: 8000 diff --git a/apps/base/osint/camera-deployment.yaml b/apps/base/osint/camera-deployment.yaml new file mode 100644 index 0000000..a5dc6ad --- /dev/null +++ b/apps/base/osint/camera-deployment.yaml @@ -0,0 +1,51 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: osint-camera-service + namespace: osint + labels: + app: osint-camera-service +spec: + replicas: 1 + selector: + matchLabels: + app: osint-camera-service + template: + metadata: + labels: + app: osint-camera-service + spec: + tolerations: + - key: dedicated + operator: Exists + effect: PreferNoSchedule + nodeSelector: + kubernetes.io/hostname: siriussec + containers: + - name: camera-service + image: forgejo.siriusdevops.com/sirius/osint-dashboard:amd64-c48788d4b614 + imagePullPolicy: IfNotPresent + command: ["python", "app/run_camera_service.py"] + envFrom: + - configMapRef: + name: osint-env + env: + - name: DB_PASSWORD + valueFrom: + secretKeyRef: + name: osint-db + key: password + volumeMounts: + - name: snapshots + mountPath: /data/snapshots + resources: + requests: + cpu: 50m + memory: 128Mi + limits: + memory: 512Mi + volumes: + # Shared with osint-app (same node, RWO): the app serves cached snapshots. + - name: snapshots + persistentVolumeClaim: + claimName: osint-camera-snapshots diff --git a/apps/base/osint/camera-pvc.yaml b/apps/base/osint/camera-pvc.yaml new file mode 100644 index 0000000..55c2e14 --- /dev/null +++ b/apps/base/osint/camera-pvc.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: osint-camera-snapshots + namespace: osint +spec: + accessModes: + - ReadWriteOnce + storageClassName: local-path + resources: + requests: + storage: 3Gi diff --git a/apps/base/osint/configmap.yaml b/apps/base/osint/configmap.yaml new file mode 100644 index 0000000..a30d134 --- /dev/null +++ b/apps/base/osint/configmap.yaml @@ -0,0 +1,62 @@ +# Shared, non-secret runtime configuration for every OSINT workload. +# Secrets (Postgres password, Nous API key, FIRMS/AIS keys) are NOT here: +# * Postgres password -> Secret `osint-db` (created out of band, never in git) +# * API keys -> dashboard Keys page, stored in the `api_keys` table +apiVersion: v1 +kind: ConfigMap +metadata: + name: osint-env + namespace: osint +data: + DB_HOST: osint-db + DB_PORT: "5432" + DB_NAME: osint_data + DB_USER: osint + NATS_URL: nats://osint-nats:4222 + + # SAR tile proxy, exposed same-origin under /titiler by the HTTPRoute. + TITILER_INTERNAL_URL: http://osint-titiler:8000 + TITILER_PUBLIC_BASE: /titiler + + TZ: America/New_York + OSINT_USER_AGENT: "osint-dashboard/1.0 (self-hosted; lancewalters94@gmail.com)" + + # ── ingester ──────────────────────────────────────────────────────────── + INGEST_INTERVAL: "300" + INGEST_EARTHQUAKES: "1" + INGEST_FIRES: "1" + FIRMS_DATASETS: "VIIRS_NOAA20_NRT,VIIRS_NOAA21_NRT" + FIRMS_BBOX: "-180,-60,180,75" + FIRMS_INTERVAL: "900" + VESSELAPI_BBOX: "25.5,55.4,27.3,57.2" + VESSELAPI_INTERVAL: "17280" + VESSELAPI_MAX_CALLS_PER_DAY: "5" + AISSTREAM_IN_APP: "1" + AISSTREAM_IN_INGEST: "0" + VESSELAPI_IN_APP: "0" + VESSELAPI_IN_INGEST: "1" + + # ── camera discovery service ──────────────────────────────────────────── + CAMERA_SOURCE_URLS: "" + CAMERA_SCRAPE_INTERVAL: "3600" + CAMERA_REQUEST_DELAY: "2.0" + CAMERA_MAX_PER_SOURCE: "20000" + NOMINATIM_URL: https://nominatim.openstreetmap.org + NOMINATIM_MIN_INTERVAL: "1.1" + SNAPSHOT_CACHE_DIR: /data/snapshots + SNAPSHOT_TTL_SECONDS: "300" + + # ── news scraper ──────────────────────────────────────────────────────── + LOG_LEVEL: INFO + NEWS_SCRAPE_INTERVAL_S: "10" + NEWS_SCRAPE_RUN_ON_START: "1" + + # ── news summarizer (analyst) — Nous Portal, free tier model ──────────── + NOUS_BASE_URL: https://inference-api.nousresearch.com/v1 + SUMMARY_MODEL: meituan/longcat-2.5:free + BATCH_SIZE: "50" + NEWS_SUMMARIZE_INTERVAL_S: "900" + NEWS_SUMMARIZE_RUN_ON_START: "1" + NEWS_RECAP_HOUR: "23" + NEWS_RECAP_MINUTE: "0" + INCLUDE_FUTURES: "0" diff --git a/apps/base/osint/httproute.yaml b/apps/base/osint/httproute.yaml new file mode 100644 index 0000000..dc1534b --- /dev/null +++ b/apps/base/osint/httproute.yaml @@ -0,0 +1,34 @@ +apiVersion: gateway.networking.k8s.io/v1 +kind: HTTPRoute +metadata: + name: osint + namespace: osint +spec: + parentRefs: + - name: public + namespace: gateway-system + hostnames: + - osint.siriusdevops.com + rules: + # Same-origin SAR tile proxy: /titiler/... -> titiler /... (prefix stripped, + # matching the old nginx vhost's `proxy_pass ...:8001/`). + - matches: + - path: + type: PathPrefix + value: /titiler + filters: + - type: URLRewrite + urlRewrite: + path: + type: ReplacePrefixMatch + replacePrefixMatch: / + backendRefs: + - name: osint-titiler + port: 8000 + - matches: + - path: + type: PathPrefix + value: / + backendRefs: + - name: osint-app + port: 8000 diff --git a/apps/base/osint/ingester-deployment.yaml b/apps/base/osint/ingester-deployment.yaml new file mode 100644 index 0000000..0af6aab --- /dev/null +++ b/apps/base/osint/ingester-deployment.yaml @@ -0,0 +1,43 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: osint-ingester + namespace: osint + labels: + app: osint-ingester +spec: + replicas: 1 + selector: + matchLabels: + app: osint-ingester + template: + metadata: + labels: + app: osint-ingester + spec: + tolerations: + - key: dedicated + operator: Exists + effect: PreferNoSchedule + nodeSelector: + kubernetes.io/hostname: siriussec + containers: + - name: ingester + image: forgejo.siriusdevops.com/sirius/osint-dashboard:amd64-c48788d4b614 + imagePullPolicy: IfNotPresent + command: ["python", "app/run_ingester.py"] + envFrom: + - configMapRef: + name: osint-env + env: + - name: DB_PASSWORD + valueFrom: + secretKeyRef: + name: osint-db + key: password + resources: + requests: + cpu: 100m + memory: 256Mi + limits: + memory: 512Mi diff --git a/apps/base/osint/kustomization.yaml b/apps/base/osint/kustomization.yaml new file mode 100644 index 0000000..af3ccdf --- /dev/null +++ b/apps/base/osint/kustomization.yaml @@ -0,0 +1,20 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: + - namespace.yaml + - configmap.yaml + - postgres-pvc.yaml + - postgres-deployment.yaml + - postgres-service.yaml + - nats-deployment.yaml + - nats-service.yaml + - app-deployment.yaml + - app-service.yaml + - ingester-deployment.yaml + - camera-pvc.yaml + - camera-deployment.yaml + - titiler-deployment.yaml + - titiler-service.yaml + - news-scraper-deployment.yaml + - news-summarizer-deployment.yaml + - httproute.yaml diff --git a/apps/base/osint/namespace.yaml b/apps/base/osint/namespace.yaml new file mode 100644 index 0000000..06e4f8f --- /dev/null +++ b/apps/base/osint/namespace.yaml @@ -0,0 +1,4 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: osint diff --git a/apps/base/osint/nats-deployment.yaml b/apps/base/osint/nats-deployment.yaml new file mode 100644 index 0000000..a17761b --- /dev/null +++ b/apps/base/osint/nats-deployment.yaml @@ -0,0 +1,53 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: osint-nats + namespace: osint + labels: + app: osint-nats +spec: + replicas: 1 + selector: + matchLabels: + app: osint-nats + template: + metadata: + labels: + app: osint-nats + spec: + tolerations: + - key: dedicated + operator: Exists + effect: PreferNoSchedule + nodeSelector: + kubernetes.io/hostname: siriussec + containers: + - name: nats + image: forgejo.siriusdevops.com/sirius/nats:2.10 + imagePullPolicy: IfNotPresent + args: ["-js", "-sd", "/data"] + ports: + - containerPort: 4222 + name: client + - containerPort: 8222 + name: monitor + volumeMounts: + - name: data + mountPath: /data + readinessProbe: + httpGet: + path: /healthz + port: 8222 + initialDelaySeconds: 5 + periodSeconds: 10 + resources: + requests: + cpu: 50m + memory: 64Mi + limits: + memory: 256Mi + volumes: + # JetStream is a transient bus here (compose had no volume either): + # events are written to Postgres by the consumer loop. + - name: data + emptyDir: {} diff --git a/apps/base/osint/nats-service.yaml b/apps/base/osint/nats-service.yaml new file mode 100644 index 0000000..028f62a --- /dev/null +++ b/apps/base/osint/nats-service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: osint-nats + namespace: osint +spec: + selector: + app: osint-nats + ports: + - name: client + port: 4222 + targetPort: 4222 + - name: monitor + port: 8222 + targetPort: 8222 diff --git a/apps/base/osint/news-scraper-deployment.yaml b/apps/base/osint/news-scraper-deployment.yaml new file mode 100644 index 0000000..f2a5a77 --- /dev/null +++ b/apps/base/osint/news-scraper-deployment.yaml @@ -0,0 +1,44 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: osint-news-scraper + namespace: osint + labels: + app: osint-news-scraper +spec: + replicas: 1 + selector: + matchLabels: + app: osint-news-scraper + template: + metadata: + labels: + app: osint-news-scraper + spec: + tolerations: + - key: dedicated + operator: Exists + effect: PreferNoSchedule + nodeSelector: + kubernetes.io/hostname: siriussec + containers: + - name: news-scraper + image: forgejo.siriusdevops.com/sirius/osint-news-scraper:amd64-c48788d4b614 + imagePullPolicy: IfNotPresent + # Image ENTRYPOINT is `scrapy`; the loop crawls, sleeps, crawls again. + command: ["python", "run_news_scraper.py"] + envFrom: + - configMapRef: + name: osint-env + env: + - name: DB_PASSWORD + valueFrom: + secretKeyRef: + name: osint-db + key: password + resources: + requests: + cpu: 100m + memory: 256Mi + limits: + memory: 768Mi diff --git a/apps/base/osint/news-summarizer-deployment.yaml b/apps/base/osint/news-summarizer-deployment.yaml new file mode 100644 index 0000000..cab7b5e --- /dev/null +++ b/apps/base/osint/news-summarizer-deployment.yaml @@ -0,0 +1,44 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: osint-news-summarizer + namespace: osint + labels: + app: osint-news-summarizer +spec: + replicas: 1 + selector: + matchLabels: + app: osint-news-summarizer + template: + metadata: + labels: + app: osint-news-summarizer + spec: + tolerations: + - key: dedicated + operator: Exists + effect: PreferNoSchedule + nodeSelector: + kubernetes.io/hostname: siriussec + containers: + - name: news-summarizer + image: forgejo.siriusdevops.com/sirius/osint-news-summarizer:amd64-c48788d4b614 + imagePullPolicy: IfNotPresent + # Loop: batch the last window, call Nous Portal, write summaries. + command: ["python", "run_news_summarizer.py"] + envFrom: + - configMapRef: + name: osint-env + env: + - name: DB_PASSWORD + valueFrom: + secretKeyRef: + name: osint-db + key: password + resources: + requests: + cpu: 50m + memory: 128Mi + limits: + memory: 512Mi diff --git a/apps/base/osint/postgres-deployment.yaml b/apps/base/osint/postgres-deployment.yaml new file mode 100644 index 0000000..6ebd382 --- /dev/null +++ b/apps/base/osint/postgres-deployment.yaml @@ -0,0 +1,82 @@ +# TimescaleDB + PostGIS, single instance on local-path. +# NOT CloudNativePG: the app's alembic chain requires CREATE EXTENSION +# postgis AND timescaledb plus create_hypertable()/continuous aggregates, and +# this image (Dockerfile.pg, built amd64) is the exact Postgres the Pi stack +# ran. A CNPG cluster would need a custom CNPG-conformant Timescale image. +apiVersion: apps/v1 +kind: Deployment +metadata: + name: osint-db + namespace: osint + labels: + app: osint-db +spec: + replicas: 1 + # ReadWriteOnce PVC: old and new pod cannot both mount it. + strategy: + type: Recreate + selector: + matchLabels: + app: osint-db + template: + metadata: + labels: + app: osint-db + spec: + tolerations: + - key: dedicated + operator: Exists + effect: PreferNoSchedule + nodeSelector: + kubernetes.io/hostname: siriussec + containers: + - name: postgres + image: forgejo.siriusdevops.com/sirius/osint-dashboard-pg:amd64-c48788d4b614 + imagePullPolicy: IfNotPresent + args: + - -c + - shared_preload_libraries=timescaledb + - -c + - shared_buffers=1GB + - -c + - max_connections=100 + ports: + - containerPort: 5432 + name: postgres + env: + - name: POSTGRES_USER + value: osint + - name: POSTGRES_DB + value: osint_data + - name: PGDATA + value: /var/lib/postgresql/data/pgdata + - name: POSTGRES_PASSWORD + valueFrom: + secretKeyRef: + name: osint-db + key: password + readinessProbe: + exec: + command: ["pg_isready", "-U", "osint", "-d", "osint_data", "-h", "127.0.0.1"] + initialDelaySeconds: 10 + periodSeconds: 10 + failureThreshold: 6 + livenessProbe: + exec: + command: ["pg_isready", "-U", "osint", "-d", "osint_data", "-h", "127.0.0.1"] + initialDelaySeconds: 60 + periodSeconds: 30 + failureThreshold: 6 + volumeMounts: + - name: pgdata + mountPath: /var/lib/postgresql/data + resources: + requests: + cpu: 200m + memory: 512Mi + limits: + memory: 2Gi + volumes: + - name: pgdata + persistentVolumeClaim: + claimName: osint-pgdata diff --git a/apps/base/osint/postgres-pvc.yaml b/apps/base/osint/postgres-pvc.yaml new file mode 100644 index 0000000..5ebbd76 --- /dev/null +++ b/apps/base/osint/postgres-pvc.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: osint-pgdata + namespace: osint +spec: + accessModes: + - ReadWriteOnce + storageClassName: local-path + resources: + requests: + storage: 15Gi diff --git a/apps/base/osint/postgres-service.yaml b/apps/base/osint/postgres-service.yaml new file mode 100644 index 0000000..d8bbff2 --- /dev/null +++ b/apps/base/osint/postgres-service.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: Service +metadata: + name: osint-db + namespace: osint +spec: + selector: + app: osint-db + ports: + - name: postgres + port: 5432 + targetPort: 5432 diff --git a/apps/base/osint/titiler-deployment.yaml b/apps/base/osint/titiler-deployment.yaml new file mode 100644 index 0000000..a023e07 --- /dev/null +++ b/apps/base/osint/titiler-deployment.yaml @@ -0,0 +1,51 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: osint-titiler + namespace: osint + labels: + app: osint-titiler +spec: + replicas: 1 + selector: + matchLabels: + app: osint-titiler + template: + metadata: + labels: + app: osint-titiler + spec: + tolerations: + - key: dedicated + operator: Exists + effect: PreferNoSchedule + nodeSelector: + kubernetes.io/hostname: siriussec + containers: + - name: titiler + image: forgejo.siriusdevops.com/sirius/titiler:0.26.0 + imagePullPolicy: IfNotPresent + ports: + - containerPort: 8000 + name: http + env: + - name: PORT + value: "8000" + - name: WORKERS_PER_CORE + value: "1" + - name: WEB_CONCURRENCY + value: "1" + - name: GDAL_CACHEMAX + value: "128" + readinessProbe: + httpGet: + path: /healthz + port: 8000 + initialDelaySeconds: 5 + periodSeconds: 15 + resources: + requests: + cpu: 50m + memory: 128Mi + limits: + memory: 512Mi diff --git a/apps/base/osint/titiler-service.yaml b/apps/base/osint/titiler-service.yaml new file mode 100644 index 0000000..f8818d0 --- /dev/null +++ b/apps/base/osint/titiler-service.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: Service +metadata: + name: osint-titiler + namespace: osint +spec: + selector: + app: osint-titiler + ports: + - name: http + port: 8000 + targetPort: 8000 diff --git a/apps/home/kustomization.yaml b/apps/home/kustomization.yaml index 88303d0..1a08fad 100644 --- a/apps/home/kustomization.yaml +++ b/apps/home/kustomization.yaml @@ -5,3 +5,4 @@ resources: - ../base/siriusdevops - ../base/piedmont - ../base/sirius-growth + - ../base/osint