ci / shared (pull_request) Failing after 4s
Mirror of the Collectives specs (canonical) after the 2026-09-11 revision: - PLATFORM_ARCHITECTURE: two clusters (core + breakpilot-platform), stage and prod on separate Hetzner VMs, fixed hosts with path-based tenants, Keycloak realms breakpilot-stage/prod on core, tenant-registry as entitlement authority, always-on ERPNext link, CLI licence model, first-line products Prüfwerk (+Werkbank), Werkpilot, Firmwerk - INFRASTRUCTURE: Hetzner topology, per-node ingress (HTTP-01), stage isolation rules, backups, SLAs, failure scenarios, risks - IMPLEMENTATION_PLAN: M-MIG-0 … M-MIG-9 migration milestones replace M0–M19 - PRODUCT_INTEGRATION_SPEC: contract 2.0 (standalone | headless | cli, registry entitlement check, usage event push, ladder statuses, licence contract, gap analysis for the four products) - COST_PLAN: Hetzner, no commitments - README: deployment table for app[-stage].breakpilot.com; links repointed Removed: SysEleven, three-cluster split, PowerDNS/DNS-01, Stalwart, Orca-Proxy container, web-component/widget contract, cdn.breakpilot.com, custom domains, Stripe/Polar. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
486 lines
35 KiB
Markdown
486 lines
35 KiB
Markdown
# Infrastructure Specification
|
||
**Status:** Revised topology (2026-09-11)
|
||
**Authors:** Sharang, Benjamin
|
||
**Date:** 2026-05-11 (topology lock: 2026-05-18; cluster split: 2026-06-30; **revised 2026-09-11**)
|
||
**Companion docs:** PLATFORM_ARCHITECTURE.md, IMPLEMENTATION_PLAN.md, COST_PLAN.md, `BreakPilot Infra/Infrastructure Architecture` (as-built core cluster)
|
||
**Cloud provider:** Hetzner Cloud (fsn1 / nbg1, EU) + Hetzner Object Storage (nbg1). DNS at Strato.
|
||
|
||
---
|
||
|
||
> **2026-09-11 revision.** Replaces the SysEleven 4-VM / 3-cluster design. The company already runs a single Hetzner Orca cluster (`breakpilot`, see `BreakPilot Infra`). That cluster becomes **core-only**. A second Orca cluster, `breakpilot-platform`, hosts the customer-facing platform with **staging and production on separate VMs**. PowerDNS, Stalwart, Orca-Proxy-as-a-container, wildcard TLS and SysEleven pricing are gone. The legal entity (BreakPilot GmbH, HRB 736403) exists, so the "gated on legal entity" clauses are discharged.
|
||
|
||
## 1. Cluster and VM Inventory
|
||
|
||
```
|
||
┌──────────────────────┬────────────────────┬───────┬────────────────────────────┬───────────┬──────────────────────────┐
|
||
│ Node │ Cluster │ Env │ Flavor (Hetzner) │ Public IP │ Role / planes │
|
||
├──────────────────────┼────────────────────┼───────┼────────────────────────────┼───────────┼──────────────────────────┤
|
||
│ breakpilot-infra-vm1 │ breakpilot (core) │ core │ existing, 46.225.100.82 │ YES │ master · Identity+Infra │
|
||
│ ubuntu-16gb-fsn1-1 │ breakpilot (core) │ core │ existing 16 GB, 178.105.159.224 │ YES │ agent · ERP, Nextcloud… │
|
||
│ bp-platform-stage │ breakpilot-platform│ stage │ CX43/CPX41 class 8v/16 GB │ YES │ MASTER · Control+App (stage) │
|
||
│ bp-platform-prod │ breakpilot-platform│ prod │ sized at prod planning (≥16 GB, dedicated cores preferred) │ YES │ agent · Control+App (prod) │
|
||
│ (dev) │ — │ dev │ laptop docker-compose │ n/a │ all (in-memory) │
|
||
└──────────────────────┴────────────────────┴───────┴────────────────────────────┴───────────┴──────────────────────────┘
|
||
```
|
||
|
||
**Why this topology**
|
||
|
||
- **Core stays where it is.** Keycloak, Gitea, Harbor, ERPNext, LiteLLM, Infisical, SigNoz, Nextcloud, chat and the landing page are company infrastructure and keep running on the cluster they run on today. Nothing customer-facing shares a node with them after M-MIG-2.
|
||
- **One platform cluster, one node per environment.** Orca can pin services to a node (`placement.node`) but has no environments, namespaces or label scheduling. Separate VMs give staging and production physical isolation; separate Orca projects, service names, realms, databases and secret scopes give them logical isolation.
|
||
- **The staging VM is the cluster master.** It exists first; production joins later as an agent over the Hetzner private network. Unpinned services land on the master, so `validate.sh` rejects any unpinned service.
|
||
- **Per-node ingress.** Every node binds 80/443 and issues its own certificates (HTTP-01). A hostname's A record points at the node running the service. No wildcard, no DNS-01, no shared proxy.
|
||
|
||
---
|
||
|
||
## 2. Service-to-Node Mapping
|
||
|
||
### Core cluster (`sharang/orca-infra`) — after M-MIG-2
|
||
|
||
```
|
||
breakpilot-infra-vm1 (master, 46.225.100.82)
|
||
keycloak + db auth.breakpilot.com realms: master, breakpilot, breakpilot-stage, breakpilot-prod
|
||
gitea + db git.breakpilot.com (+ SSH :22222)
|
||
harbor (9 svcs) repo.breakpilot.com projects: breakpilot, pruefwerk, firmwerk, platform, observability
|
||
litellm + db/redis llm.breakpilot.com
|
||
infisical + db/redis secrets.breakpilot.com
|
||
gatus status.breakpilot.com
|
||
matrix/synapse/proxy chat.breakpilot.com
|
||
landing + kontakt-relay breakpilot.com, www.
|
||
coturn
|
||
otel-agent-master
|
||
[until M-MIG-9] breakpilot-dsms (12 svcs) · tenant-registry-dev · compliance-mcp · certifai-mongo
|
||
|
||
ubuntu-16gb-fsn1-1 (agent, 178.105.159.224)
|
||
erpnext stack (9 svcs) erp.breakpilot.com + Frappe CRM + Helpdesk
|
||
nextcloud + collabora cloud.breakpilot.com, collabora.
|
||
signoz + clickhouse signoz.breakpilot.com, otel.breakpilot.com
|
||
element, jitsi element.breakpilot.com, meet.breakpilot.com
|
||
kellnr crates.breakpilot.com
|
||
penpot design.breakpilot.com
|
||
otel-agent-workhorse
|
||
```
|
||
|
||
Stopped and archived at M-MIG-2: `breakpilot-portal` + 4 per-tenant portals, `compliance-agent`, `compliance-dashboard`, `compliance-docs`, `browserless`, `soft-plc`, `plc-sim`, `mailserver`.
|
||
|
||
### Platform cluster (`platform/orca-platform`) — stage node
|
||
|
||
```
|
||
bp-platform-stage (master, public IP, 8 vCPU / 16 GB)
|
||
project platform-stage
|
||
portal-stage app-stage.breakpilot.com 1 GB
|
||
tenant-registry-stage registry-stage.breakpilot.com 512 MB (migrate init)
|
||
pg-stage internal, volume 1.5 GB pre_hook pg_dumpall
|
||
erpnext-mock-stage internal 256 MB (stage only)
|
||
project pruefwerk-stage
|
||
pruefwerk-dashboard-stage pruefwerk-stage.breakpilot.com 1 GB
|
||
pruefwerk-agent-stage internal :3001 2 GB
|
||
pruefwerk-mcp-stage route pruefwerk-stage…/mcp/* 512 MB
|
||
pruefwerk-docs-stage route pruefwerk-stage…/docs/* 128 MB
|
||
pruefwerk-mongo-stage internal, volume 1.5 GB pre_hook mongodump
|
||
browserless-stage internal 1.5 GB
|
||
soft-plc-stage, plc-sim-stage internal (scan targets) 512 MB each
|
||
werkbank-runner-stage internal 1 GB
|
||
project firmwerk-stage
|
||
firmwerk-cloud-stage firmwerk-stage.breakpilot.com 512 MB
|
||
firmwerk-mongo-stage internal, volume 1 GB pre_hook mongodump
|
||
otel-agent (observability) internal 256 MB
|
||
≈ 13 GB committed of 16 GB
|
||
```
|
||
|
||
### Platform cluster — prod node (later, same shape)
|
||
|
||
`bp-platform-prod` (agent): projects `platform-prod`, `pruefwerk-prod`, `firmwerk-prod` with the same services minus `erpnext-mock`; talks to the live `erp.breakpilot.com`. After M-MIG-9 the `dsms` project (12 services) is added, initially on the stage node until the prod node exists.
|
||
|
||
### Calls from the platform cluster into core (all HTTPS, all public hostnames)
|
||
|
||
```
|
||
→ auth.breakpilot.com OIDC, JWKS, admin API (tenant-registry-svc-{env})
|
||
→ erp.breakpilot.com ERPNext REST + inbound webhooks (prod only; stage uses the mock)
|
||
→ repo.breakpilot.com image pulls (docker login per node)
|
||
→ llm.breakpilot.com LiteLLM (Prüfwerk triage, Werkpilot)
|
||
→ otel.breakpilot.com traces/logs/metrics
|
||
→ secrets.breakpilot.com licence signing key, CI credentials (bootstrap only)
|
||
→ git.breakpilot.com webhooks INTO the platform master come from Gitea Actions runners
|
||
```
|
||
|
||
### Stage isolation rules (enforced at the platform, not in product code)
|
||
|
||
| Risk | Enforcement mechanism | Owner |
|
||
|---|---|---|
|
||
| Stage writes to prod database | Separate VM, separate Orca projects, **project-scoped secrets** (`*-stage` never sees `*-prod` keys; prod values are never set globally). | Infra plane |
|
||
| Stage emails real customers | Realm `breakpilot-stage` SMTP = Strato `noreply+stage@`; tenant-registry-stage `EMAIL_ALLOWLIST_DOMAINS=breakpilot.com`; only `@breakpilot.com` test users exist in the realm. | Control plane |
|
||
| Stage creates real ERP records | Stage has no ERPNext credentials at all; `ERP_BASE_URL` points at `erpnext-mock-stage`. | Control plane |
|
||
| Stage JWT used in prod | Different realm → different issuer; every prod service pins `iss` and `aud`. | Identity plane |
|
||
| Stage load hurts prod | Different VM. Shared core services (Keycloak, LiteLLM) rate-limit per client. | Identity plane |
|
||
| Stage CI token deploys prod | Orca tokens are cluster-wide (no per-project RBAC) → prod deploys use a separate `prod` branch webhook + HMAC secret; the stage deployer token is never stored in a repo that can reach prod projects. **Residual risk, see RISK-2.** | Infra plane |
|
||
|
||
---
|
||
|
||
## 3. Network Topology
|
||
|
||
```
|
||
INTERNET
|
||
│
|
||
(breakpilot.com zone at Strato — manual A records, no wildcard)
|
||
│
|
||
┌──────────────────────────────┼───────────────────────────────┐
|
||
│ │ │
|
||
┌────▼────────────────┐ ┌─────────▼───────────┐ ┌──────────────▼────────┐
|
||
│ CORE master │ │ CORE workhorse │ │ bp-platform-stage │
|
||
│ 46.225.100.82 │ │ 178.105.159.224 │ │ <stage IP> │
|
||
│ auth git repo llm │ │ erp cloud signoz │ │ app-stage registry- │
|
||
│ secrets status chat │ │ meet design crates │ │ stage pruefwerk-stage │
|
||
│ breakpilot.com │ │ │ │ firmwerk-stage │
|
||
└─────────────────────┘ └──────────────────────┘ └──────────┬────────────┘
|
||
│ Hetzner private
|
||
│ network 10.10.0.0/16
|
||
┌──────────▼────────────┐
|
||
│ bp-platform-prod │
|
||
│ <prod IP> (later) │
|
||
│ app registry licence │
|
||
│ pruefwerk firmwerk │
|
||
└───────────────────────┘
|
||
|
||
Firewall (Hetzner Cloud Firewall, per platform VM):
|
||
22/tcp admin IPs only
|
||
80,443/tcp any
|
||
6880/tcp (orca API + agent websocket) private network only, plus the Gitea runner egress IP for webhooks
|
||
6881/tcp (orca agent) private network only
|
||
everything else drop
|
||
|
||
Ingress (per node, Orca built-in proxy, HTTP-01 ACME):
|
||
bp-platform-stage
|
||
app-stage.breakpilot.com → portal-stage:3000
|
||
registry-stage.breakpilot.com → tenant-registry-stage:8090
|
||
pruefwerk-stage.breakpilot.com → pruefwerk-dashboard-stage:8080
|
||
/mcp/* → pruefwerk-mcp-stage:8090 (strip_prefix)
|
||
/docs/* → pruefwerk-docs-stage:80 (VitePress base /docs/)
|
||
firmwerk-stage.breakpilot.com → firmwerk-cloud-stage:8080
|
||
bp-platform-prod
|
||
app. registry. licence. pruefwerk. firmwerk.breakpilot.com (same targets, -prod)
|
||
|
||
Cross-node traffic: Docker bridge networks are node-local. Anything that must cross VMs uses public HTTPS
|
||
(there is nothing stage↔prod by design). Master↔agent Orca traffic uses the private network.
|
||
```
|
||
|
||
DNS records to add at Strato (stage): `app-stage`, `registry-stage`, `pruefwerk-stage`, `firmwerk-stage` → stage IP. Prod adds `app`, `registry`, `licence`, `pruefwerk`, `firmwerk` → prod IP. Lower TTLs before any cutover; a certificate is only issued after the A record points at the node.
|
||
|
||
---
|
||
|
||
## 4. Storage
|
||
|
||
```
|
||
┌────────────────────┬──────────────────────────────────────────────────┬─────────────────────────┐
|
||
│ Node │ Data stores │ Disk │
|
||
├────────────────────┼──────────────────────────────────────────────────┼─────────────────────────┤
|
||
│ bp-platform-stage │ pg-stage, pruefwerk-mongo-stage, firmwerk-mongo- │ local NVMe (flavor); │
|
||
│ │ stage, Docker volumes (orca-*) │ add a Hetzner Volume │
|
||
│ │ │ (€0.05/GB) when > 60 % │
|
||
│ bp-platform-prod │ pg-prod, mongo-prod ×2, later dsms (pg17, IPFS, │ local NVMe + Hetzner │
|
||
│ │ qdrant, dataroom, ollama) │ Volume for dsms │
|
||
└────────────────────┴──────────────────────────────────────────────────┴─────────────────────────┘
|
||
|
||
Object storage (Hetzner Object Storage, nbg1, S3-compatible):
|
||
s3://bp-platform-backups Orca nightly backups of the platform cluster (separate from core's bp-orca-backups)
|
||
s3://bp-seed-data demo tenant fixtures (platform/seed-data)
|
||
s3://bp-exports GDPR / offboarding ZIPs (signed URLs, 7-day TTL)
|
||
s3://bp-rag existing dsms RAG bucket (moves with dsms)
|
||
s3://bp-sccache, bp-gitea-packages, bp-kellnr-* core (unchanged)
|
||
```
|
||
|
||
---
|
||
|
||
## 5. Backup Requirements
|
||
|
||
Orca-native backups per cluster (`[backup]` in each `cluster.toml`): nightly `0 0 3 * * *`, local copy + S3, per-datastore logical dumps via `pre_hook` (`pg_dumpall`, `mongodump`, `mariadb-dump`). Retention 14 days core (existing), 30 days platform.
|
||
|
||
```
|
||
┌──────────────────────────────┬──────────────────────┬────────────┬───────────┬────────────────────┐
|
||
│ Data store │ Method │ Frequency │ Retention │ Owner │
|
||
├──────────────────────────────┼──────────────────────┼────────────┼───────────┼────────────────────┤
|
||
│ keycloak-db (core) │ pg_dumpall pre_hook │ nightly │ 14 d │ Identity plane │
|
||
│ keycloak realm export │ kc export → S3 │ on change │ 14 d │ Identity plane │
|
||
│ gitea-db + repos (core) │ pre_hook + volume │ nightly │ 14 d │ Infra plane │
|
||
│ harbor (core) │ db pre_hook; images │ nightly │ 14 d │ Infra plane │
|
||
│ │ rebuildable from CI │ │ │ │
|
||
│ erpnext mariadb (core) │ mariadb-dump pre_hook│ nightly │ 14 d │ Control plane │
|
||
│ pg-prod (tenant-registry) │ pg_dumpall pre_hook │ nightly + │ 30 d │ Control plane │
|
||
│ │ + 6-hourly cron dump │ 6 h │ │ (RPO ≤ 6 h) │
|
||
│ pruefwerk-mongo-prod │ mongodump pre_hook │ nightly │ 30 d │ App plane │
|
||
│ firmwerk-mongo-prod │ mongodump pre_hook │ nightly │ 30 d │ App plane │
|
||
│ dsms (pg17, IPFS, qdrant…) │ pre_hooks + volumes │ nightly │ 30 d │ App plane │
|
||
│ stage * │ nightly (convenience)│ nightly │ 7 d │ — (no SLA) │
|
||
│ Orca config (IaC) │ Gitea │ on commit │ forever │ Infra plane │
|
||
└──────────────────────────────┴──────────────────────┴────────────┴───────────┴────────────────────┘
|
||
```
|
||
|
||
**Known gaps (carried from the as-built runbook):** Orca backups are unencrypted (orca #117) and include `secrets.json`; restores are untested → a restore drill is part of M-MIG-8; both copies live at Hetzner (no 3-2-1) → add a second S3 provider before production.
|
||
|
||
### RPO by data criticality
|
||
|
||
```
|
||
CRITICAL (RPO ≤ 6h) keycloak-db · pg-prod (tenants, subscriptions, licences, audit) · erpnext mariadb
|
||
IMPORTANT (RPO ≤ 24h) pruefwerk-mongo-prod · firmwerk-mongo-prod · dsms postgres + IPFS
|
||
RECOVERABLE harbor images (CI) · qdrant (rebuildable) · gitea (mirrored on laptops)
|
||
NOT BACKED UP stage data beyond 7 days · redis caches · browserless
|
||
```
|
||
|
||
---
|
||
|
||
## 6. Constraint Framework
|
||
|
||
Constraint types (AVAILABILITY, RTO, RPO, IaC, SECRET_HYGIENE, NETWORK, DATA_RESIDENCY, AUDIT_TRAIL, IMMUTABILITY, STAGE_ISOLATION) are unchanged. Planes remain the **SLA + ownership abstraction**; clusters and nodes are the **operational unit**.
|
||
|
||
```
|
||
╔════════════════════════════════════════════════════════════════════════════════════════╗
|
||
║ IDENTITY PLANE (core cluster, breakpilot-infra-vm1) ║
|
||
║ AVAILABILITY ≥ 99.5% (root dependency of both environments) · RTO ≤ 15 min ║
|
||
║ AUDIT_TRAIL realm events · DATA_RESIDENCY EU · STAGE_ISOLATION separate realms ║
|
||
║ Note: one Keycloak instance serves company SSO + both platform realms (RISK-3). ║
|
||
╠════════════════════════════════════════════════════════════════════════════════════════╣
|
||
║ CONTROL PLANE (platform cluster, per env node) ║
|
||
║ RPO (tenant registry) ≤ 6h · RPO (ERPNext, core) ≤ 24h · AUDIT_TRAIL portal actions ║
|
||
║ AVAILABILITY portal ≥ 99.5%, registry ≥ 99.5%, ERPNext ≥ 99% (internal) ║
|
||
║ RTO portal ≤ 10 min · registry ≤ 5 min · ERPNext ≤ 60 min ║
|
||
║ ERP LINK: outbox depth < 100 and reconcile age < 30 min are SLOs (alerted) ║
|
||
╠════════════════════════════════════════════════════════════════════════════════════════╣
|
||
║ APP PLANE (platform cluster, per env node) ║
|
||
║ DATA_RESIDENCY EU · DATA_ISOLATION per-tenant DB or tenant_id on every query ║
|
||
║ AVAILABILITY Prüfwerk ≥ 99.5%, Firmwerk cloud ≥ 99.5%, licence endpoint ≥ 99.9% ║
|
||
║ (CLIs tolerate 30 days of licence-endpoint outage by design) ║
|
||
║ Co-tenant note: the prod node is the scale driver; bump flavor at 80% RAM. ║
|
||
╠════════════════════════════════════════════════════════════════════════════════════════╣
|
||
║ INFRA PLANE (both clusters) ║
|
||
║ BACKUP per cluster bucket · IaC all services in Gitea · IMMUTABILITY git → orca deploy║
|
||
║ SECRET_HYGIENE project-scoped Orca secrets, Infisical for signing keys ║
|
||
║ NETWORK per-node ingress, Hetzner firewall, private network for master↔agent ║
|
||
║ DATA_RESIDENCY Hetzner DE · COLD_START ordering (§10 F) · STAGE_ISOLATION (§2) ║
|
||
╚════════════════════════════════════════════════════════════════════════════════════════╝
|
||
```
|
||
|
||
---
|
||
|
||
## 7. SLA Table
|
||
|
||
```
|
||
┌────────────────────────────┬──────────────┬─────────┬─────────┬──────────────────────────────┐
|
||
│ Service │ Availability │ RTO │ RPO │ Node │
|
||
├────────────────────────────┼──────────────┼─────────┼─────────┼──────────────────────────────┤
|
||
│ Keycloak │ 99.5% │ 15 min │ 6h │ core master (root auth dep) │
|
||
│ Harbor │ 99% │ 30 min │ 24h │ core master (deploys only) │
|
||
│ Gitea │ 99% │ 2h │ 24h │ core master │
|
||
│ LiteLLM │ 99% │ 5 min │ N/A │ core master (soft dep) │
|
||
│ ERPNext + Helpdesk │ 99% │ 60 min │ 24h │ core workhorse (internal) │
|
||
│ Customer Portal │ 99.5% │ 10 min │ N/A │ platform prod │
|
||
│ Tenant Registry + licences │ 99.9% │ 5 min │ 6h │ platform prod │
|
||
│ pg-prod │ 99.9% │ 20 min │ 6h │ platform prod (RISK-4) │
|
||
│ Prüfwerk (dashboard/agent) │ 99.5% │ 10 min │ 24h │ platform prod │
|
||
│ Prüfwerk MCP │ 99.5% │ 10 min │ N/A │ platform prod │
|
||
│ Firmwerk cloud-server │ 99.5% │ 10 min │ 24h │ platform prod │
|
||
│ Werkbank runner │ 99% │ 30 min │ N/A │ platform prod (stateless) │
|
||
│ stage (any service) │ 95% │ best ef.│ 7d │ platform stage (no SLA) │
|
||
└────────────────────────────┴──────────────┴─────────┴─────────┴──────────────────────────────┘
|
||
```
|
||
|
||
Measured via `status.breakpilot.com` (Gatus, 3-fail, 30-day rolling) per `Breakpilot SKU + SLA`.
|
||
|
||
---
|
||
|
||
## 8. IaC Constraint (Orca)
|
||
|
||
Every platform service is declared in `platform/orca-platform`, every core service in `sharang/orca-infra`. No exceptions.
|
||
|
||
```
|
||
1. ALL containers run via Orca service files committed to Gitea
|
||
→ platform: services/<project>/service.toml (Orca-native TOML; one [[service]] per container)
|
||
→ Changes go through: Gitea PR → CI (validate.sh, gitleaks, trivy) → merge → `git pull && orca deploy` on the master
|
||
→ Image changes go through: product CI → Harbor → signed webhook → orca redeploy
|
||
|
||
2. EVERY platform service is pinned: [service.placement] node = "bp-platform-stage" | "bp-platform-prod"
|
||
→ validate.sh fails the PR otherwise (unpinned = lands on the master)
|
||
|
||
3. Service names are unique cluster-wide and suffixed by environment (-stage / -prod)
|
||
→ stage and prod are separate projects with separate Docker networks
|
||
|
||
4. Secrets are project-scoped: `orca secrets set --project <p> KEY value`
|
||
→ production values are NEVER set globally (project secrets fall back to global)
|
||
→ Orca env references `${secrets.KEY}` only; no values in service files
|
||
|
||
5. Resource limits MANDATORY: resources.memory on every service (validate.sh)
|
||
|
||
6. Restart policy: always; health check per service (HTTP or TCP)
|
||
|
||
7. Images: product images are pushed with :sha-<short> and :latest; `orca redeploy` re-pulls.
|
||
Pin by digest for cutovers. Prod promotion = retag :sha-… as :prod-<version> (prod plan).
|
||
|
||
8. NO manual docker run / compose on any node. SSH for debugging only. Every node has
|
||
`docker login repo.breakpilot.com` done once at provisioning.
|
||
|
||
9. Orca control plane state is recoverable: service files in Gitea = desired state;
|
||
losing the master = re-install Orca on the same VM, restore ~/.orca from backup, `orca deploy`.
|
||
```
|
||
|
||
---
|
||
|
||
## 9. Dependency Graph
|
||
|
||
```
|
||
EXTERNAL AI APIs
|
||
│ (soft)
|
||
▼
|
||
┌───────────────────── CORE cluster ─────────────────────────────────────────┐
|
||
│ keycloak-db ─► keycloak harbor litellm infisical erpnext │
|
||
│ │ │ │ │ │ │
|
||
└─────────────────────┼───────────┼────────────┼───────────┼───────────┼──────┘
|
||
JWKS/OIDC ────┘ images ──┘ LLM ─────┘ signing ─┘ REST+webhooks (prod)
|
||
▼ ▼
|
||
┌───────────────────── PLATFORM cluster · one node per env ──────────────────┐
|
||
│ pg-{env} ──► tenant-registry-{env} ◄──── erpnext-mock (stage) / erp (prod)│
|
||
│ │ entitlements/check, api-keys/verify, usage, licences│
|
||
│ ├──► portal-{env} │
|
||
│ ├──► pruefwerk-agent ◄── pruefwerk-mongo, browserless, │
|
||
│ │ │ soft-plc, plc-sim │
|
||
│ │ ├──► pruefwerk-dashboard, pruefwerk-mcp, docs │
|
||
│ │ └──► werkbank-runner (leases jobs) │
|
||
│ └──► firmwerk-cloud ◄── firmwerk-mongo │
|
||
│ CLIs (customer machines) ──► licence endpoint on tenant-registry │
|
||
└────────────────────────────────────────────────────────────────────────────┘
|
||
```
|
||
|
||
Critical path (customer login → product use): Strato DNS → node ingress → portal → Keycloak (core) → tenant-registry → product host → Keycloak (SSO) → product → tenant-registry (`entitlements/check`, cached).
|
||
|
||
---
|
||
|
||
## 10. Failure Scenarios
|
||
|
||
### A — Core master (Keycloak, Harbor, Gitea, LiteLLM) fails — HIGHEST SEVERITY
|
||
```
|
||
Impact: No new logins on either environment (JWTs expire within the access-token TTL); no deploys;
|
||
no LLM features. Running product sessions continue until token expiry. CLIs keep working
|
||
on their licence tokens (30-day ladder). ERPNext (workhorse) unaffected.
|
||
Recovery: Restore VM / Orca on the core master from Hetzner snapshot + nightly backup. RTO target 15 min.
|
||
Mitigation: Hetzner snapshot schedule for the core master; runbook; RISK-1.
|
||
```
|
||
### B — bp-platform-stage (cluster master) fails
|
||
```
|
||
Impact: Staging down. Production containers keep running but cannot be deployed/redeployed;
|
||
webhooks 503 until the master is back. No customer impact.
|
||
Recovery: Rebuild VM, reinstall Orca, restore ~/.orca, `orca deploy`; prod agent re-joins. RTO 30 min.
|
||
Mitigation: RISK-2; consider a small dedicated control VM at Tier B.
|
||
```
|
||
### C — bp-platform-prod fails
|
||
```
|
||
Impact: All products, portal, registry and licence endpoint down for production.
|
||
CLIs degrade along the ladder only after 7 days without heartbeat.
|
||
Recovery: Rebuild from snapshot + nightly backup; re-join; redeploy. RTO 30 min, RPO ≤ 6h for pg-prod.
|
||
Mitigation: Hetzner snapshots; tested restore drill (M-MIG-8); RISK-4.
|
||
```
|
||
### D — LiteLLM fails: Prüfwerk LLM triage and Werkpilot degrade; scans and CRUD unaffected. Soft.
|
||
### E — Stage compromised or buggy: nothing reaches prod (separate VM, realm, secrets, mock ERP). Roll back image. RISK-5.
|
||
### F — Cold start (platform node): databases → tenant-registry (needs Keycloak up on core) → portal, products. Orca `depends_on` + health checks; 3–5 min. Core cold start unchanged from the as-built runbook.
|
||
### G — Tenant Registry fails
|
||
```
|
||
Impact: Portal tenant lookup fails (cached 60 s); products' entitlement cache expires after 60 s
|
||
→ they fail CLOSED (deny) per contract §9.1; licence heartbeats fail (ladder tolerates 7 days);
|
||
usage events buffered client-side and retried.
|
||
Recovery: Restart; pg-{env} must be healthy. RTO ≤ 5 min.
|
||
```
|
||
### H — ERPNext down or unreachable from the platform
|
||
```
|
||
Impact: NO customer impact. Outbox accumulates (customer upserts, leads, usage records); webhooks
|
||
are not received; the ladder does not change. Backstage /system/erp-link alerts at
|
||
outbox depth > 100 or reconcile age > 30 min.
|
||
Recovery: ERPNext restore per core runbook; outbox drains; reconcile repairs any missed webhook.
|
||
```
|
||
|
||
---
|
||
|
||
## 11. Cross-Dependency Summary
|
||
|
||
```
|
||
Needs → │ KC │ pg-env │ mongo │ registry │ ERP │ LiteLLM │ Harbor │ Infisical │
|
||
─────────────────────┼────┼────────┼───────┼──────────┼─────┼─────────┼────────┼───────────┤
|
||
tenant-registry │ ● │ ● │ │ │ ◐ │ │ │ ◐ (licence key bootstrap) │
|
||
portal │ ● │ │ │ ● │ │ │ │ │
|
||
pruefwerk-agent │ ● │ │ ● │ ● │ │ ◐ │ │ │
|
||
pruefwerk-dashboard │ ● │ │ │ │ │ │ │ │
|
||
werkbank-runner │ │ │ │ ◐ │ │ │ │ │
|
||
firmwerk-cloud │ ● │ │ ● │ ● │ │ │ │ │
|
||
werkpilot (CLI) │ ◐ │ │ │ ◐ │ │ ● │ │ │
|
||
all (deploy time) │ │ │ │ │ │ │ ● │ │
|
||
● hard ◐ soft (degrades / cached / buffered)
|
||
```
|
||
|
||
---
|
||
|
||
## 12. Open Infrastructure Risks (Priority Order)
|
||
|
||
```
|
||
RISK-1 Core master is a single VM owning auth, git, image registry and LLM.
|
||
→ Hetzner snapshot schedule + tested restore; long-term: move Keycloak to its own node.
|
||
Priority: HIGH
|
||
|
||
RISK-2 The staging VM is the platform cluster's only control plane and Orca tokens are cluster-wide
|
||
(a stage deployer token can deploy prod).
|
||
→ Never store the deployer token where stage-only CI can read it; prod webhooks use their own
|
||
HMAC secret; revisit a dedicated control VM at Tier B.
|
||
Priority: HIGH (until prod exists: MEDIUM)
|
||
|
||
RISK-3 One Keycloak instance serves company SSO and both platform realms.
|
||
→ Realm-level rate limits per client; realm exports in git; RTO 15 min runbook.
|
||
Priority: MEDIUM
|
||
|
||
RISK-4 pg-prod is a single instance for tenants, subscriptions, licences and audit.
|
||
→ 6-hourly dumps in addition to nightly; split audit into its own DB when > 100 tenants.
|
||
Priority: MEDIUM
|
||
|
||
RISK-5 Stage isolation rests on the six controls in §2.
|
||
→ Quarterly red-team: try to read a prod secret from a stage project; try a stage JWT on prod.
|
||
Priority: MEDIUM
|
||
|
||
RISK-6 ERPNext → registry webhooks have no guaranteed delivery (Frappe retries are best-effort).
|
||
→ Outbox for the up direction, idempotent webhook receiver + 15-min reconcile for the down
|
||
direction, alerting on reconcile age. Tested in M-MIG-8 (kill worker, replay).
|
||
Priority: HIGH until the M-MIG-8 tests pass, then LOW
|
||
|
||
RISK-7 Orca project secrets fall back to global secrets; a missing stage key silently resolves to a
|
||
global value.
|
||
→ No global secrets in the platform cluster at all; validate.sh greps service files for
|
||
`${secrets.` keys and checks they exist in the project scope (deploy-time check).
|
||
Priority: MEDIUM
|
||
|
||
RISK-8 Backups unencrypted (orca #117) and single-provider.
|
||
→ age-encrypt the S3 copy via `[secrets] age_recipients`; second provider before prod.
|
||
Priority: MEDIUM
|
||
|
||
RISK-9 HTTP-01 cutovers leave a short TLS gap when a hostname moves between nodes.
|
||
→ Lower TTLs 24h before; cut over in a night window; verify with `curl -I` immediately.
|
||
Priority: LOW
|
||
|
||
RISK-10 LiteLLM calls external AI APIs. → fallback routing; products degrade gracefully. LOW
|
||
```
|
||
|
||
---
|
||
|
||
## 13. Growth Trajectory
|
||
|
||
```
|
||
Tier A (launch, ≤ 50 cust): stage CX43 + prod ≥16 GB dedicated ≈ €60–90/mo platform compute
|
||
Tier B (50–200): bump prod flavor; small control VM as Orca master (RISK-2);
|
||
Hetzner Volume for prod data; second S3 provider for backups
|
||
Tier C (200–500): split prod: app node + db node (pg, mongo); Keycloak to its own core node
|
||
Tier D (500+): second prod app node (Orca pins per product), Hetzner LB in front
|
||
```
|
||
|
||
Each step is justified by a measurable signal (> 80% RAM, > 70% CPU, sustained queue depth, or a specific outage). Never split preemptively.
|
||
|
||
---
|
||
|
||
## 14. Cost summary
|
||
|
||
See `COST_PLAN.md` (Hetzner). Platform stage ≈ €30/mo; prod sized at prod planning; core cluster unchanged.
|
||
|
||
---
|
||
|
||
*End of document. Review after production go-live or any significant infrastructure change. Topology revised 2026-09-11.*
|