feat: OSINT Dashboard app + Helm templates
Add FastAPI backend for real-time geospatial OSINT dashboard: - Full-text search via PostgreSQL tsvector (parameterized queries) - Entity tracking, alert management, sentiment analytics - Data ingestion: RSS feeds, GDELT, USGS earthquakes, social signals - NATS JetStream consumer for event ingestion - MinIO document storage integration - Redis caching layer - Alembic migrations with PostGIS + TimescaleDB extensions - Single-page dashboard UI with live polling - OpenTelemetry distributed tracing Helm chart with infrastructure: - CNPG PostgreSQL cluster (PostGIS + TimescaleDB) - NATS JetStream with persistent streams - MinIO distributed object storage (3 buckets) - Redis Sentinel (1 primary + 2 replicas) - NGINX Ingress with TLS and WebSocket support - Prometheus + Grafana + Alertmanager monitoring stack - Network policies with default deny - ConfigMap, CronJob, Deployment, Service templates Fixes applied during review: - SQL injection in search endpoint (parameterized :q binding) - Dockerfile PYTHONPATH mismatch (/app/app -> /app) - Hardcoded DB credentials in alembic.ini - RSS timestamp parsing (feedparser published_parsed -> parsedate_to_datetime) - Removed dead PGVECTOR import
This commit is contained in:
parent
8255467313
commit
93754dcdf6
20 changed files with 2304 additions and 3 deletions
23
apps/base/osint-dashboard/templates/api/configmap.yaml
Normal file
23
apps/base/osint-dashboard/templates/api/configmap.yaml
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
{{- if .Values.api.enabled }}
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ include "osint-dashboard.fullname" . }}-api-config
|
||||
namespace: {{ .Values.namespace }}
|
||||
labels:
|
||||
{{- include "osint-dashboard.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: api
|
||||
data:
|
||||
DB_HOST: "{{ .Values.postgresql.clusterName }}-rw.{{ .Values.namespace }}.svc.cluster.local"
|
||||
DB_PORT: "{{ .Values.postgresql.port | default \"5432\" }}"
|
||||
DB_NAME: "{{ .Values.postgresql.database | default \"osint_data\" }}"
|
||||
NATS_URLS: "nats://{{ include \"osint-dashboard.fullname\" . }}-nats.{{ .Values.namespace }}.svc.cluster.local:{{ .Values.nats.ports.client }}"
|
||||
REDIS_URL: "redis://{{ include \"osint-dashboard.fullname\" . }}-redis.{{ .Values.namespace }}.svc.cluster.local:{{ .Values.redis.ports.redis }}/0"
|
||||
MINIO_ENDPOINT: "{{ include \"osint-dashboard.fullname\" . }}-minio.{{ .Values.namespace }}.svc.cluster.local:{{ .Values.minio.ports.api }}"
|
||||
MINIO_BUCKET_VIDEO: "{{ .Values.minio.buckets._0.name | default \"osint-video-clips\" }}"
|
||||
MINIO_BUCKET_SATELLITE: "{{ .Values.minio.buckets._1.name | default \"osint-satellite-tiles\" }}"
|
||||
MINIO_BUCKET_DATA: "{{ .Values.minio.buckets._2.name | default \"osint-data-dumps\" }}"
|
||||
PYTHONPATH: "/app/app"
|
||||
PYTHONUNBUFFERED: "1"
|
||||
PYTHONDONTWRITEBYTECODE: "1"
|
||||
{{- end }}
|
||||
207
apps/base/osint-dashboard/templates/api/cronjobs.yaml
Normal file
207
apps/base/osint-dashboard/templates/api/cronjobs.yaml
Normal file
|
|
@ -0,0 +1,207 @@
|
|||
{{- if .Values.api.enabled }}
|
||||
apiVersion: batch/v1
|
||||
kind: CronJob
|
||||
metadata:
|
||||
name: {{ include "osint-dashboard.fullname" . }}-rss-ingestor
|
||||
namespace: {{ .Values.namespace }}
|
||||
labels:
|
||||
{{- include "osint-dashboard.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: ingestor
|
||||
spec:
|
||||
schedule: "*/5 * * * *"
|
||||
concurrencyPolicy: Forbid
|
||||
successfulJobsHistoryLimit: 3
|
||||
failedJobsHistoryLimit: 3
|
||||
jobTemplate:
|
||||
spec:
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
{{- include "osint-dashboard.selectorLabels" . | nindent 12 }}
|
||||
app.kubernetes.io/component: ingestor
|
||||
spec:
|
||||
restartPolicy: OnFailure
|
||||
securityContext:
|
||||
{{- toYaml .Values.securityContext | nindent 12 }}
|
||||
containers:
|
||||
- name: rss-ingestor
|
||||
image: "{{ .Values.api.image.repository }}:{{ .Values.api.image.tag }}"
|
||||
imagePullPolicy: {{ .Values.api.image.pullPolicy | default "Always" }}
|
||||
command:
|
||||
- python
|
||||
- /app/app/ingest_cron.py
|
||||
envFrom:
|
||||
- configMapRef:
|
||||
name: {{ include "osint-dashboard.fullname" . }}-api-config
|
||||
env:
|
||||
- name: DB_USER
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ .Values.postgresql.credentialsSecret }}
|
||||
key: username
|
||||
- name: DB_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ .Values.postgresql.credentialsSecret }}
|
||||
key: password
|
||||
- name: INGESTOR_TYPE
|
||||
value: "rss"
|
||||
resources:
|
||||
{{- toYaml .Values.api.resources | nindent 16 }}
|
||||
{{- end }}
|
||||
---
|
||||
{{- if .Values.api.enabled }}
|
||||
apiVersion: batch/v1
|
||||
kind: CronJob
|
||||
metadata:
|
||||
name: {{ include "osint-dashboard.fullname" . }}-gdelt-ingestor
|
||||
namespace: {{ .Values.namespace }}
|
||||
labels:
|
||||
{{- include "osint-dashboard.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: ingestor
|
||||
spec:
|
||||
schedule: "*/15 * * * *"
|
||||
concurrencyPolicy: Forbid
|
||||
successfulJobsHistoryLimit: 3
|
||||
failedJobsHistoryLimit: 3
|
||||
jobTemplate:
|
||||
spec:
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
{{- include "osint-dashboard.selectorLabels" . | nindent 12 }}
|
||||
app.kubernetes.io/component: ingestor
|
||||
spec:
|
||||
restartPolicy: OnFailure
|
||||
securityContext:
|
||||
{{- toYaml .Values.securityContext | nindent 12 }}
|
||||
containers:
|
||||
- name: gdelt-ingestor
|
||||
image: "{{ .Values.api.image.repository }}:{{ .Values.api.image.tag }}"
|
||||
imagePullPolicy: {{ .Values.api.image.pullPolicy | default "Always" }}
|
||||
command:
|
||||
- python
|
||||
- /app/app/ingest_cron.py
|
||||
envFrom:
|
||||
- configMapRef:
|
||||
name: {{ include "osint-dashboard.fullname" . }}-api-config
|
||||
env:
|
||||
- name: DB_USER
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ .Values.postgresql.credentialsSecret }}
|
||||
key: username
|
||||
- name: DB_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ .Values.postgresql.credentialsSecret }}
|
||||
key: password
|
||||
- name: INGESTOR_TYPE
|
||||
value: "gdelt"
|
||||
resources:
|
||||
{{- toYaml .Values.api.resources | nindent 16 }}
|
||||
{{- end }}
|
||||
---
|
||||
{{- if .Values.api.enabled }}
|
||||
apiVersion: batch/v1
|
||||
kind: CronJob
|
||||
metadata:
|
||||
name: {{ include "osint-dashboard.fullname" . }}-earthquake-ingestor
|
||||
namespace: {{ .Values.namespace }}
|
||||
labels:
|
||||
{{- include "osint-dashboard.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: ingestor
|
||||
spec:
|
||||
schedule: "0 * * * *"
|
||||
concurrencyPolicy: Forbid
|
||||
successfulJobsHistoryLimit: 3
|
||||
failedJobsHistoryLimit: 3
|
||||
jobTemplate:
|
||||
spec:
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
{{- include "osint-dashboard.selectorLabels" . | nindent 12 }}
|
||||
app.kubernetes.io/component: ingestor
|
||||
spec:
|
||||
restartPolicy: OnFailure
|
||||
securityContext:
|
||||
{{- toYaml .Values.securityContext | nindent 12 }}
|
||||
containers:
|
||||
- name: earthquake-ingestor
|
||||
image: "{{ .Values.api.image.repository }}:{{ .Values.api.image.tag }}"
|
||||
imagePullPolicy: {{ .Values.api.image.pullPolicy | default "Always" }}
|
||||
command:
|
||||
- python
|
||||
- /app/app/ingest_cron.py
|
||||
envFrom:
|
||||
- configMapRef:
|
||||
name: {{ include "osint-dashboard.fullname" . }}-api-config
|
||||
env:
|
||||
- name: DB_USER
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ .Values.postgresql.credentialsSecret }}
|
||||
key: username
|
||||
- name: DB_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ .Values.postgresql.credentialsSecret }}
|
||||
key: password
|
||||
- name: INGESTOR_TYPE
|
||||
value: "earthquake"
|
||||
resources:
|
||||
{{- toYaml .Values.api.resources | nindent 16 }}
|
||||
{{- end }}
|
||||
---
|
||||
{{- if .Values.api.enabled }}
|
||||
apiVersion: batch/v1
|
||||
kind: CronJob
|
||||
metadata:
|
||||
name: {{ include "osint-dashboard.fullname" . }}-nats-processor
|
||||
namespace: {{ .Values.namespace }}
|
||||
labels:
|
||||
{{- include "osint-dashboard.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: ingestor
|
||||
spec:
|
||||
schedule: "*/2 * * * *"
|
||||
concurrencyPolicy: Forbid
|
||||
successfulJobsHistoryLimit: 3
|
||||
failedJobsHistoryLimit: 3
|
||||
jobTemplate:
|
||||
spec:
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
{{- include "osint-dashboard.selectorLabels" . | nindent 12 }}
|
||||
app.kubernetes.io/component: ingestor
|
||||
spec:
|
||||
restartPolicy: OnFailure
|
||||
securityContext:
|
||||
{{- toYaml .Values.securityContext | nindent 12 }}
|
||||
containers:
|
||||
- name: nats-processor
|
||||
image: "{{ .Values.api.image.repository }}:{{ .Values.api.image.tag }}"
|
||||
imagePullPolicy: {{ .Values.api.image.pullPolicy | default "Always" }}
|
||||
command:
|
||||
- python
|
||||
- /app/app/ingest_cron.py
|
||||
envFrom:
|
||||
- configMapRef:
|
||||
name: {{ include "osint-dashboard.fullname" . }}-api-config
|
||||
env:
|
||||
- name: DB_USER
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ .Values.postgresql.credentialsSecret }}
|
||||
key: username
|
||||
- name: DB_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ .Values.postgresql.credentialsSecret }}
|
||||
key: password
|
||||
- name: INGESTOR_TYPE
|
||||
value: "nats"
|
||||
resources:
|
||||
{{- toYaml .Values.api.resources | nindent 16 }}
|
||||
{{- end }}
|
||||
83
apps/base/osint-dashboard/templates/api/deployment.yaml
Normal file
83
apps/base/osint-dashboard/templates/api/deployment.yaml
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
{{- if .Values.api.enabled }}
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ include "osint-dashboard.fullname" . }}-api
|
||||
namespace: {{ .Values.namespace }}
|
||||
labels:
|
||||
{{- include "osint-dashboard.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: api
|
||||
spec:
|
||||
replicas: {{ .Values.api.replicaCount }}
|
||||
strategy:
|
||||
type: RollingUpdate
|
||||
rollingUpdate:
|
||||
maxSurge: 1
|
||||
maxUnavailable: 0
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "osint-dashboard.selectorLabels" . | nindent 6 }}
|
||||
app.kubernetes.io/component: api
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
{{- include "osint-dashboard.selectorLabels" . | nindent 8 }}
|
||||
app.kubernetes.io/component: api
|
||||
annotations:
|
||||
checksum/config: {{ include "osint-dashboard.fullname" . }}-api-config
|
||||
spec:
|
||||
terminationGracePeriodSeconds: 30
|
||||
securityContext:
|
||||
{{- toYaml .Values.securityContext | nindent 8 }}
|
||||
containers:
|
||||
- name: api
|
||||
image: "{{ .Values.api.image.repository }}:{{ .Values.api.image.tag }}"
|
||||
imagePullPolicy: {{ .Values.api.image.pullPolicy | default "Always" }}
|
||||
ports:
|
||||
- containerPort: 8000
|
||||
name: http
|
||||
protocol: TCP
|
||||
resources:
|
||||
{{- toYaml .Values.api.resources | nindent 12 }}
|
||||
envFrom:
|
||||
- configMapRef:
|
||||
name: {{ include "osint-dashboard.fullname" . }}-api-config
|
||||
env:
|
||||
- name: DB_USER
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ .Values.postgresql.credentialsSecret }}
|
||||
key: username
|
||||
- name: DB_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ .Values.postgresql.credentialsSecret }}
|
||||
key: password
|
||||
startupProbe:
|
||||
httpGet:
|
||||
path: /api/health
|
||||
port: 8000
|
||||
initialDelaySeconds: 15
|
||||
periodSeconds: 5
|
||||
failureThreshold: 12
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /api/health
|
||||
port: 8000
|
||||
initialDelaySeconds: 30
|
||||
periodSeconds: 30
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /api/health
|
||||
port: 8000
|
||||
initialDelaySeconds: 15
|
||||
periodSeconds: 10
|
||||
{{- with .Values.api.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.api.tolerations }}
|
||||
tolerations:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
20
apps/base/osint-dashboard/templates/api/service.yaml
Normal file
20
apps/base/osint-dashboard/templates/api/service.yaml
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
{{- if .Values.api.enabled }}
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ include "osint-dashboard.fullname" . }}-api
|
||||
namespace: {{ .Values.namespace }}
|
||||
labels:
|
||||
{{- include "osint-dashboard.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: api
|
||||
spec:
|
||||
type: ClusterIP
|
||||
ports:
|
||||
- port: 8000
|
||||
targetPort: 8000
|
||||
protocol: TCP
|
||||
name: http
|
||||
selector:
|
||||
{{- include "osint-dashboard.selectorLabels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: api
|
||||
{{- end }}
|
||||
|
|
@ -343,14 +343,15 @@ frontend:
|
|||
memory: 512Mi
|
||||
|
||||
# ============================================================
|
||||
# API (placeholder — T2 will fill this in)
|
||||
# API — FastAPI backend (T2: OSINT Dashboard application)
|
||||
# ============================================================
|
||||
api:
|
||||
enabled: false
|
||||
enabled: true
|
||||
replicaCount: 3
|
||||
image:
|
||||
repository: gcr.io/devops-lab-cluster/osint-dashboard-api
|
||||
tag: latest
|
||||
tag: "0.1.0"
|
||||
pullPolicy: Always
|
||||
resources:
|
||||
requests:
|
||||
cpu: "200m"
|
||||
|
|
|
|||
Loading…
Reference in a new issue