Skip to content

armgit / AiSOC

Public Imported from GitHub
0

Open-source AI Security Operations Center: alert fusion, LLM-agent triage, MITRE ATT&CK investigation, and a replayable decision ledger for every agent step. Self-hostable, runs with no API keys, MIT licensed. Ships an MCP server for Claude, Cursor and Continue.

chore(infra): WS-A2 follow-up — wire demo seed into deploy targets

Beenu Arora830eac3599f4
diff --git a/docker-compose.demo.yml b/docker-compose.demo.yml
index 8b7ad1fce..442070dbe 100644
--- a/docker-compose.demo.yml
+++ b/docker-compose.demo.yml
@@ -211,6 +211,37 @@ services:
- aisoc-demo
restart: unless-stopped
+ # ─── One-shot demo seeder ───────────────────────────────────────────────────
+ # Runs `python -m app.scripts.seed_demo` once when the api is healthy, then
+ # exits cleanly. The seeder is idempotent (it checks for existing INC-RT-*
+ # case_numbers before inserting), so repeated `docker compose up -d` runs
+ # don't double-seed. `restart: "no"` makes compose treat the clean exit as
+ # success and stop trying to bring it back. The orchestrator script
+ # (scripts/aisoc-demo.ts) waits for this container to terminate before
+ # reading /v1/cases — that's how we get a deterministic INC-RT-001 in the
+ # API on first browser load.
+ seed:
+ image: ghcr.io/beenuar/aisoc-core-api:${AISOC_TAG:-latest}
+ build:
+ context: ./services/api
+ container_name: aisoc-demo-seed
+ pull_policy: missing
+ depends_on:
+ api:
+ condition: service_healthy
+ environment:
+ DATABASE_URL: postgresql+asyncpg://aisoc:aisoc_dev_secret@postgres:5432/aisoc
+ REDIS_URL: redis://:redis_dev_secret@redis:6379/0
+ SECRET_KEY: dev_secret_key_change_in_production
+ ENV: development
+ ENVIRONMENT: development
+ LOG_LEVEL: info
+ AISOC_DISABLE_KAFKA: "true"
+ networks:
+ - aisoc-demo
+ restart: "no"
+ command: ["python", "-m", "app.scripts.seed_demo"]
+
web:
image: ghcr.io/beenuar/aisoc-web:${AISOC_TAG:-latest}
# Build context for `pnpm aisoc:demo --rebuild`. The Dockerfile bakes the
diff --git a/infra/fly/api/fly.toml b/infra/fly/api/fly.toml
index 63946e6c7..8ab16c90d 100644
--- a/infra/fly/api/fly.toml
+++ b/infra/fly/api/fly.toml
@@ -22,6 +22,22 @@ kill_timeout = "5s"
# deploy script cd's into services/api/ before invoking `flyctl deploy`, so
# the right Dockerfile gets picked up automatically.
+# Run alembic migrations and re-seed the demo dataset on every deploy.
+# The release_command runs in a temporary VM with all production env vars
+# (Postgres URL, Redis URL, secrets) before any app machine accepts traffic,
+# which is exactly what we want for demo-tenant data lifecycle:
+# 1. `alembic upgrade head` keeps the schema in step with the image.
+# 2. `python -m app.scripts.seed_demo` is idempotent — it short-circuits
+# when the canonical INC-RT-* case_numbers already exist, so it's safe
+# to run on every deploy. First-run boot creates all 15 incidents
+# including the in-flight LockBit 3.0 ransomware investigation
+# (INC-RT-001) that the web app's "Try the demo" CTA deeplinks to.
+# Without this, hitting / on a freshly cloned Render or Fly deploy lands
+# users on an empty dashboard and breaks the < 5 min clone-to-investigation
+# acceptance criterion in the v1.0 plan.
+[deploy]
+ release_command = "/bin/sh -c 'alembic upgrade head && python -m app.scripts.seed_demo'"
+
[env]
ENVIRONMENT = "demo"
LOG_LEVEL = "info"
@@ -36,10 +52,12 @@ kill_timeout = "5s"
AISOC_DISABLE_OPENSEARCH = "true"
AISOC_DISABLE_NEO4J = "true"
AISOC_DISABLE_QDRANT = "true"
- # The demo_seed entrypoint runs inside this container (post-deploy via
- # `flyctl ssh console -C "python -m app.scripts.demo_seed …"` and via a
- # daily cron machine). It needs to reach the API locally and the agents
- # app over Fly's internal 6PN DNS.
+ # Seeding runs automatically on deploy via [deploy].release_command above.
+ # A daily cron machine (provisioned separately) re-runs the same seeder
+ # to refresh demo-tenant data at 00:00 UTC. CORE_API_URL points at
+ # localhost so investigation kickoffs from the seeder hit the in-process
+ # API, and AGENTS_API_URL crosses to the agents app over Fly's internal
+ # 6PN DNS (.internal:port).
CORE_API_URL = "http://localhost:8000"
AGENTS_API_URL = "http://aisoc-demo-agents.internal:8084"
# Cross-origin allowlist for the browser. The Next.js app at tryaisoc.com
diff --git a/infra/fly/web/fly.toml b/infra/fly/web/fly.toml
index 64e1a3fe9..8047a74c2 100644
--- a/infra/fly/web/fly.toml
+++ b/infra/fly/web/fly.toml
@@ -43,6 +43,17 @@ kill_timeout = "5s"
[build.args]
NEXT_PUBLIC_API_URL = "https://api.tryaisoc.com"
NEXT_PUBLIC_WS_URL = "wss://ws.tryaisoc.com"
+ # Demo flags must be baked into the client bundle at build time, not just
+ # set via [env]. Next.js inlines NEXT_PUBLIC_* values during `next build`,
+ # so the runtime [env] overrides never reach the browser unless they were
+ # also present at build time. Without these args, the StartHero CTA on the
+ # onboarding page would render with the empty-string default and the demo
+ # deeplink would fall through to the local docker-compose URL.
+ NEXT_PUBLIC_DEMO_MODE = "true"
+ NEXT_PUBLIC_DEMO_DEEPLINK = "/cases/INC-RT-001?tab=ledger"
+ NEXT_PUBLIC_DEMO_BANNER = "Demo data resets daily at 00:00 UTC. All write actions are disabled."
+ NEXT_PUBLIC_DEMO_AUTOLOGIN_EMAIL = "[email protected]"
+ NEXT_PUBLIC_DEMO_AUTOLOGIN_PASSWORD = "aisoc-demo"
# Server-side proxy targets MUST be passed at build time, not just runtime.
# next.config.js evaluates `process.env.API_URL` when the config module
# loads, and the resulting rewrite destinations are written into
@@ -66,8 +77,20 @@ kill_timeout = "5s"
NEXT_PUBLIC_WS_URL = "wss://ws.tryaisoc.com"
NEXT_PUBLIC_DEMO_RESET = "daily-utc-0000"
NEXT_PUBLIC_DEMO_BANNER = "Demo data resets daily at 00:00 UTC. All write actions are disabled."
- # Default landing in demo mode: pre-seeded incident with running investigation
- NEXT_PUBLIC_DEMO_DEEPLINK = "/cases/INC-001?tab=ledger"
+ # Default landing in demo mode: the in-flight LockBit 3.0 ransomware
+ # investigation seeded by services/api/app/scripts/seed_demo.py. INC-RT-001
+ # is the showcase scenario — encryption is in progress and the agent is
+ # streaming live decisions to the ledger when the visitor lands. Updated
+ # from the legacy /cases/INC-001 placeholder when the v1.0 seed canon
+ # introduced the INC-RT-* prefix for ransomware.
+ NEXT_PUBLIC_DEMO_DEEPLINK = "/cases/INC-RT-001?tab=ledger"
+ # Auto-login shortcut on the new onboarding hero (apps/web/src/components/
+ # onboarding/StartHero.tsx). Drops visitors straight into the demo-tenant
+ # session as the read-only analyst the seeder provisions. Email + password
+ # MUST stay in sync with services/api/app/scripts/seed_demo.py and
+ # services/api/app/api/v1/dev_auth.py:DEMO_USER_EMAIL.
+ NEXT_PUBLIC_DEMO_AUTOLOGIN_EMAIL = "[email protected]"
+ NEXT_PUBLIC_DEMO_AUTOLOGIN_PASSWORD = "aisoc-demo"
# Server-side rewrite targets for next.config.js. Only some paths flow
# through the Next proxy:
# /api/v1/contextual/* → agents (apps/web/src/lib/api.ts uses an empty
diff --git a/infra/render/render.yaml b/infra/render/render.yaml
index 6bd95db79..59e98e5ff 100644
--- a/infra/render/render.yaml
+++ b/infra/render/render.yaml
@@ -49,6 +49,16 @@ services:
plan: starter
healthCheckPath: /health
autoDeploy: true
+ # Render runs preDeployCommand once after a successful image build but
+ # before the new instance accepts traffic. We use it to (a) apply
+ # alembic migrations on every deploy and (b) idempotently re-seed the
+ # 15-incident demo dataset including the in-flight INC-RT-001 ransomware
+ # investigation that the web app's "Try the demo" CTA links to. The
+ # seeder is safe to run on every deploy — it short-circuits if the
+ # canonical case_numbers already exist. Without this hook the demo
+ # would land on an empty dashboard and break the < 5 min clone-to-
+ # investigation acceptance criterion.
+ preDeployCommand: alembic upgrade head && python -m app.scripts.seed_demo
envVars:
- key: ENVIRONMENT
value: demo
@@ -203,13 +213,29 @@ services:
name: aisoc-realtime
property: host
# Demo banner — same flags the Fly demo uses, surfaced via
- # apps/web/src/lib/demoMode.ts.
- - key: NEXT_PUBLIC_AISOC_DEMO_MODE
+ # apps/web/src/lib/demoMode.ts. The variable names here MUST match
+ # the ones that module reads (NEXT_PUBLIC_DEMO_*, no AISOC infix);
+ # the previous NEXT_PUBLIC_AISOC_DEMO_* form was a typo that left
+ # demo mode silently disabled on Render.
+ - key: NEXT_PUBLIC_DEMO_MODE
value: "true"
- - key: NEXT_PUBLIC_AISOC_DEMO_DEEPLINK
- value: /cases/INC-001?tab=ledger
- - key: NEXT_PUBLIC_AISOC_DEMO_BANNER
- value: "Demo data resets daily. All write actions are disabled."
+ # Land "Try the demo" visitors on the in-flight LockBit 3.0 ransomware
+ # investigation seeded by services/api/app/scripts/seed_demo.py.
+ # INC-RT-001 is the showcase scenario — encryption is already in
+ # progress and the agent is streaming live decisions to the ledger.
+ - key: NEXT_PUBLIC_DEMO_DEEPLINK
+ value: /cases/INC-RT-001?tab=ledger
+ - key: NEXT_PUBLIC_DEMO_BANNER
+ value: "Demo data resets daily at 00:00 UTC. All write actions are disabled."
+ # One-click auto-login for the read-only demo analyst account. The
+ # seeder creates this user as part of the demo tenant; values must
+ # stay in sync with services/api/app/scripts/seed_demo.py (which
+ # sources DEMO_USER_EMAIL from app/api/v1/dev_auth.py and sets the
+ # password to "aisoc-demo" via get_password_hash).
+ - key: NEXT_PUBLIC_DEMO_AUTOLOGIN_EMAIL
+ - key: NEXT_PUBLIC_DEMO_AUTOLOGIN_PASSWORD
+ value: aisoc-demo
# ─── redis ────────────────────────────────────────────────────────────
# Render's managed Redis. Used as cache + pub/sub spine when Kafka is