Operations — Reference Stack Runbook
Operating deploy/compose/ — the LWL-52 Phase-0/B reference stack: edge
(Vector + ES), cloud (Postgres 16 with RLS, OPA, LangGraph orchestrator,
control-plane API, dev portal, docs site). Everything binds
127.0.0.1 only; the sole sanctioned exposure is tailscale serve
(§sovereignty: no inbound ports — this holds by convention in the
reference, see the honesty note at the end).
All commands run from deploy/compose/.
1. Up and down
./up.sh # .env on first run (fresh strong SOC_PG_PASSWORD),
# docker compose up -d --build, shows loopback surfaces
./down.sh # tears down + resets the tailnet serve routes
./down.sh -v # ALSO drops the named volumes — ES indices, PG data,
# audit chains, spools. Data loss. Deliberate only.
Tailnet exposure (only if you are on the tailnet):
./tailscale-serve.sh # portal -> :4443, docs -> :4444 (refuses to
# hijack a port already in serve status)
./tailscale-serve-docs.sh # docs route only; idempotent alongside the above
2. Services and ports
Every host port in docker-compose.yml binds 127.0.0.1; the ports come
from .env (values below are the .env defaults).
| Service | Container | Host port | What it is |
|---|---|---|---|
elasticsearch |
lwl52-elasticsearch |
9200 |
Shared reference ES 9.1.4. Security disabled by design (the production box keeps raw logs on the customer appliance; this is the metadata/alert tier stand-in). Holds soc-box-ecs-{tenant}-YYYY.MM.DD |
vector |
lwl52-vector |
8120 (edr_webhook), 9590 (Prometheus) |
Edge pipeline: ECS normalize → PII redaction → alert tap (manifest: edge/vector.toml, spec §2.1) |
postgres |
lwl52-postgres |
54330 |
PG 16; the RLS wall (db/rls/01-schema.sql, multi-tenancy.md) |
opa |
lwl52-opa |
8118 |
OPA 1.4.2 serving the hitl_guardrails.rego bundle. No container healthcheck (scratch image lacks opa eval) — reachability is checked by the orchestrator's /healthz |
agent-orchestrator |
aiso-orchestrator |
8130 |
FastAPI + LangGraph triage graph, OPA gate, per-tenant audit chains (audit-data volume). Rego bundle mounted read-only |
control-plane-api |
aiso-control-plane-api |
8117 |
The REST/WS control plane. Entrypoint (cloud/tools/entrypoint.sh): wait for PG → apply db/rls/01-schema.sql (idempotent, every boot) → pin soc_api + soc_app passwords to SOC_PG_PASSWORD + strip BYPASSRLS → seed_demo.py --layer sql → (if SOC_SEED_DEMO=1, the default) background --layer demo after 8 s → uvicorn |
portal |
lwl52-portal |
8119 |
Dev portal: login, case queue, case + HITL form, /seed, /audit |
docs-site |
aiso-docs-site |
8121 |
Static python http.server over docs-site/dist (bind-mounted read-only). Unhealthy until dist/ exists — build it (docs-site/build.py) before first boot |
seed |
aiso-seed |
— | Profile-gated one-shot seeder (never started by up) |
3. Health and diagnostics
# thin liveness (the compose healthcheck contract)
curl -s 127.0.0.1:8117/healthz
# control plane full: {status, pg, orchestrator}
curl -s 127.0.0.1:8117/health
# orchestrator rich: llm_backend, opa bundle sha/version, pg,
# and per-tenant audit-chain verification ({ok, count, head_hash})
curl -s 127.0.0.1:8130/healthz
# ES cluster / vector self-metrics / OPA data
curl -s 127.0.0.1:9200/_cluster/health
curl -s 127.0.0.1:9590/metrics | head
curl -s '127.0.0.1:8118/v1/data/hitl_guardrails'
Logs: docker logs -f <container> (json-file driver; Vector's own logs
stay on stdout by the manifest's named TODO(no-real-sink) decision).
State that outlives containers lives in the named volumes (§5).
4. Seeding
| What | How | When |
|---|---|---|
Registry (tenants tnt_acme_01/tnt_globex_02, users incl. analyst:m.reyes, edges, connectors) |
seed_demo.py --layer sql |
Every boot, by the control-plane entrypoint |
| Demo lifecycle (alerts → triage → cases → audit) | seed_demo.py --layer demo |
Every boot after 8 s unless SOC_SEED_DEMO=0 — and on demand via docker compose --profile seed run --rm seed (`SEED_LAYER=demo |
Seeder-interference caveat (observed). The one-shot demo layer also
walks pending HITL approvals and decides them (approve 2 / deny 1 of a
fresh seed). It runs once per control-plane-api boot — so restarting
control-plane-api while pending approvals exist will auto-decide them,
which will destroy an in-progress HITL exercise. For hands-on HITL work:
boot with SOC_SEED_DEMO=0 (or ./up.sh after exporting it), then seed
deliberately from the portal /seed page or the seed profile.
MemorySaver caveat (observed). The orchestrator checkpoints graph runs
in memory (MemorySaver); a restart loses in-flight HITL interrupts
while the durable PG projections (case state, approvals, timeline, audit
chain) survive — the portal case page will show the case with "no live
orchestrator run" and the approve button will not resume the graph. The
spec's production checkpoint is PostgresSaver (§3.2.4).
Resetting demo data: docker compose down -v && ./up.sh (drops all
volumes), or surgically: docker compose exec postgres psql -U soc_api -d soc_control -c 'TRUNCATE cases, alerts, timeline_events, hitl_approvals, containment_actions, esql_runs CASCADE' (owner role; the RLS app role
cannot).
5. State and backups
| Volume | Contents |
|---|---|
pg-data |
All tenant tables (cases, alerts, approvals, timeline, audit mirror, fleet, metrics) |
audit-data |
Per-tenant sqlite hash chains chain-{tenant_id}.db (§3.4 — the authoritative trail; the PG audit_events table is the queryable mirror) |
es-data |
The raw ECS event indices (soc-box-ecs-{tenant}-*) |
vector-spool |
Alert ndjson spool (alerts.YYYY-MM-DD-HH.ndjson) — the spec's Edge Agent inbox; write-only in the reference |
vector-data |
Vector disk buffer (256 MiB; outage tolerance) |
The stack has no in-band backup path — back up by imaging the named
volumes (the three that matter: pg-data, audit-data, es-data):
V=aisocinabox-pg-data # the compose project prefix in the volume name
docker run --rm -v $V:/src alpine tar czf /tmp/pg-data.tgz -C /src .
# audit-data and es-data the same way; restore = down, untar into a fresh
# volume of the same name, up
The audit chain is append-only by construction (no UPDATE/DELETE grants on
the PG mirror; the sqlite writer is append+select with DB triggers —
multi-tenancy.md §4), so a restored volume keeps verifying:
GET /v1/audit/{tenant}/chain returns verification: {ok, count, head_hash}.
6. Upgrades and rebuilds
- Changed code:
docker compose up -d --build <service>(build context is the repo root for the Python services). Schema needs no migration step:db/rls/01-schema.sqlis idempotent and re-applied by the entrypoint on every boot (Phase-0 → Phase B convergence is in that file). - Changed
.envports/images:./up.sh(it isup -d --build). - Secrets:
SOC_PG_PASSWORDin.envis the login for bothsoc_api(owner) andsoc_app(RLS request role); the entrypoint re-pins both from it on every boot. Change it in.envand restartcontrol-plane-apionce. - Air-gap update bundles — spec design, not reference behavior.
Spec §2.4: everything the box ships (images, Vector manifests,
detection rules, redaction profiles, OPA bundles) is a signed OCI
artifact (cosign,
sigstore-kms/soc-release), digests in a release manifest; the box verifies signature + digest chain before applying anything; config hot-reloads echopolicy_digestin heartbeats. That delivery path is Phase 5; the reference stack pulls from the registry directly.
7. Known traps (observed in this rig)
The observed-in-this-rig trap table has moved to the
troubleshooting page — symptom → cause → fix, including
the entrypoint ordering (AUTH_STORE_UNAVAILABLE), the SEED_* env, the
portal session rotation, and the ingest window_params rows. The seeder and
checkpointer caveats are covered in §4 above.
8. Sovereignty — what is actually enforced
The loopback-only binding in deploy/compose is a convention enforced
by the file, not by a gate: deliverables/audit-2026-11-23.md rates
"sovereignty is physical" as Partially — convention, not gate (D2) —
there is no outbound-only WireGuard agent and no 1.A3 ss -ltn/nmap
acceptance test in the reference. If you expose anything beyond
tailscale serve, you are outside the documented posture; the spec's
hard version is G1 1.A1–1.A14 (multi-tenancy.md §6 for the status).