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.

7.4 KB
Raw Blame
# ──────────────────────────────────────────────────────────────────────────────
# AiSOC Demo - Web (Next.js)
#
# NOT DEPLOYED. The app was reclaimed for non-payment and
# aisoc-demo-web.fly.dev was NXDOMAIN when last measured (2026-09-28). The
# apex below still answers 200 — it is served from somewhere else, not from
# this app. infra/fly/README.md records the status and what must be true
# first.
#
# App URL when it exists:  https://aisoc-demo-web.fly.dev
# Public domain:  https://tryaisoc.com  (CNAME → aisoc-demo-web.fly.dev)
#
# Three public hostnames front this stack:
#   tryaisoc.com      → aisoc-demo-web      (this app, Next.js UI)
#   api.tryaisoc.com  → aisoc-demo-api      (FastAPI, /health, /docs, /api/v1/*)
#   ws.tryaisoc.com   → aisoc-demo-realtime (WebSocket fanout, wss://)
#
# Why three subdomains instead of routing everything through the web app's
# Next.js rewrites: the realtime service speaks raw WebSocket, which Next's
# rewrites can't proxy in production. Splitting api/ws onto their own Fly
# certs is the standard pattern and keeps the browser's CORS/CSP boundary
# explicit.
# ──────────────────────────────────────────────────────────────────────────────

app = "aisoc-demo-web"
primary_region = "iad"
kill_signal    = "SIGINT"
kill_timeout   = "5s"

# Web Dockerfile expects the *monorepo root* as build context (it COPYs
# pnpm-workspace.yaml + packages/* to resolve workspace deps). The deploy
# script runs `flyctl deploy` from the repo root, so the build context is
# correct, but flyctl resolves the `dockerfile` field relative to *this
# fly.toml's directory* (infra/fly/web/), not relative to CWD. So we have
# to walk back up to the repo root with `../../../` and then down to the
# real Dockerfile path. Without the `../../../` prefix, flyctl looks for
# `infra/fly/web/apps/web/Dockerfile` and dies with "dockerfile not found".
#
# build.args: Next.js inlines NEXT_PUBLIC_* values into the *client* bundle
# at build time (next build reads process.env then). Setting them only in
# [env] would make them runtime-only — fine for SSR, but the browser-side
# fetch()/WebSocket calls in apps/web/src/lib/api.ts would silently fall
# back to same-origin and break. So we pass them through `docker build
# --build-arg` here, the Dockerfile re-exports them as ENV before the
# build step, and Next bakes the literal URL into the JS chunks.
[build]
  dockerfile = "../../../apps/web/Dockerfile"

  [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
    # .next/routes-manifest.json by `next build`. If these aren't set during
    # the build the Dockerfile defaults (http://api:8000 etc., for the local
    # docker-compose stack) bleed through and `next start` proxies to a host
    # that doesn't exist in Fly's 6PN DNS — the browser sees `Internal Server
    # Error` from the same-origin /api/v1/* routes even though api.tryaisoc.com
    # is healthy.
    API_URL      = "http://aisoc-demo-api.internal:8000"
    AGENTS_URL   = "http://aisoc-demo-agents.internal:8084"
    REALTIME_URL = "http://aisoc-demo-realtime.internal:4000"

[env]
  NODE_ENV               = "production"
  PORT                   = "3000"
  NEXT_PUBLIC_DEMO_MODE  = "true"
  # Public URLs the browser uses to reach api / realtime. Kept in sync with
  # [build.args] above so SSR and client agree on the same backend hostnames.
  NEXT_PUBLIC_API_URL    = "https://api.tryaisoc.com"
  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: 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
  #                          AGENTS_BASE, so contextual calls land same-origin
  #                          on tryaisoc.com and Next rewrites them to agents
  #                          internal — public api.tryaisoc.com would 404)
  #   /ws/*, /sse           → realtime (rarely hit; the browser opens
  #                          wss://ws.tryaisoc.com directly when NEXT_PUBLIC_WS_URL
  #                          is set, but the rewrite is a safety net)
  #   /api/v1/* catch-all   → api (mostly unused; browser goes to api.tryaisoc.com
  #                          via NEXT_PUBLIC_API_URL)
  # Without these set, the Dockerfile defaults (`http://agents:8084` etc.) leak
  # through and the Next process tries to resolve them in Fly's DNS, which
  # has no `agents` record. Use the full *.internal:port form for 6PN.
  AGENTS_URL    = "http://aisoc-demo-agents.internal:8084"
  API_URL       = "http://aisoc-demo-api.internal:8000"
  REALTIME_URL  = "http://aisoc-demo-realtime.internal:4000"

[http_service]
  internal_port       = 3000
  force_https         = true
  auto_stop_machines  = "stop"
  auto_start_machines = true
  min_machines_running = 1       # keep warm to hit sub-60s time-to-first-investigation
  processes           = ["app"]

  [[http_service.checks]]
    grace_period = "20s"
    interval     = "15s"
    method       = "GET"
    timeout      = "5s"
    path         = "/api/health"

[[vm]]
  size      = "shared-cpu-1x"
  memory_mb = 1024