Overview
Currently, events and alerts are stored ephemerally (likely SQLite under /app/data). This means all detection history is lost on container restart, making it impossible to run historical queries, trend analysis, or compliance reports.
Problem
- No durable event store → no alert history after restart
- SQLite doesn't scale under concurrent writes from collector + manager
- TimescaleDB would enable time-series queries natively (e.g. "anomalies in last 7 days")
Proposed Solution
Replace the current ephemeral data volume with PostgreSQL (or TimescaleDB as a drop-in extension) as the primary event store.
Changes Required
Schema Suggestion
CREATE TABLE events (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
timestamp TIMESTAMPTZ NOT NULL,
model_id TEXT,
event_type TEXT,
severity TEXT,
payload JSONB,
detected_by TEXT
);
-- If using TimescaleDB:
SELECT create_hypertable('events', 'timestamp');
Acceptance Criteria
Priority
🔴 High — blocking for any real production or demo use case
Overview
Currently, events and alerts are stored ephemerally (likely SQLite under
/app/data). This means all detection history is lost on container restart, making it impossible to run historical queries, trend analysis, or compliance reports.Problem
Proposed Solution
Replace the current ephemeral data volume with PostgreSQL (or TimescaleDB as a drop-in extension) as the primary event store.
Changes Required
tup-postgresservice todocker-compose.ymlwith a named volumetup-postgreshealthcheck beforetup-managerstartstup-managerto connect viaDATABASE_URLenv var/scripts/migrations/).env.examplewithPOSTGRES_USER,POSTGRES_PASSWORD,POSTGRES_DBSchema Suggestion
Acceptance Criteria
docker compose upspins up Postgres alongside other servicesdocker compose restartPriority
🔴 High — blocking for any real production or demo use case