docs: 2026-09 revision — single platform cluster, no embedding, ERP link, first-line products #10

Merged
sharang merged 1 commits from docs/2026-09-revision into main 2026-09-11 14:15:56 +00:00
7 changed files with 1340 additions and 3532 deletions

No files matched your search

+13 -6
View File
@@ -6,18 +6,25 @@ Generated section is appended on release tag via `git-cliff` (see `.gitea/workfl
## [Unreleased] ## [Unreleased]
### Added ### Added
- - docs: 2026-09-11 revision — single platform cluster (`breakpilot-platform`) with staging and production on separate Hetzner VMs; core cluster (`breakpilot`) reduced to company infrastructure
- docs: always-on customer ⇄ CRM ⇄ ERP link (outbox, HMAC webhooks, 15-min reconcile, continuous usage records); ERPNext mock for staging
- docs: CLI licence model (registry-issued Ed25519 licence tokens, offline verify, phone-home, 4-state ladder) for Werkpilot and Firmwerk
- docs: `PRODUCT_INTEGRATION_SPEC.md` contract 2.0 — frontend types `standalone | headless | cli`, registry-backed entitlement check, usage event push
- docs: M-MIG-0 … M-MIG-9 migration milestones replace the M0–M19 greenfield plan
### Changed ### Changed
- docs: hosts fixed to `app-stage.breakpilot.com` / `app.breakpilot.com`; tenants addressed by path; one branded host per web product per environment
- docs: first-line products are Prüfwerk (+ Werkbank add-on), Werkpilot, Firmwerk; breakpilot-compliance (dsms) migrates last; CERTifAI parked
- docs: Keycloak stays on core with realms `breakpilot-stage` / `breakpilot-prod`; token claims reduced to `tenant_id, tenant_slug, org_roles, tenant_status`
- docs: tenant status ladder unified with ERP/02 (`active | warning | restricted | halted`)
- docs: `COST_PLAN.md` rewritten for Hetzner (no commitments)
- chore(domain): yourplatform.com → breakpilot.com - chore(domain): yourplatform.com → breakpilot.com
-
### Removed
- docs: SysEleven topology, three-cluster split, PowerDNS + DNS-01 wildcard TLS, Stalwart mail, Orca-Proxy container, web-component/widget frontend contract, `cdn.breakpilot.com` bundles, custom domains (M18.1), Stripe and Polar.sh billing rails
### Fixed ### Fixed
- ci: rework workflow for Gitea Actions (bash commitlint, inline gitleaks binary, per-stack jobs gated on real code) - ci: rework workflow for Gitea Actions (bash commitlint, inline gitleaks binary, per-stack jobs gated on real code)
-
### Removed
-
### Security ### Security
- -
+45 -219
View File
@@ -1,258 +1,84 @@
# Cost Plan — SysEleven Infrastructure # Cost Plan — Hetzner Infrastructure
Companion to `INFRASTRUCTURE.md` and `IMPLEMENTATION_PLAN.md`. Pricing source: `SysEleven-Cloud-Services-Preisinformationen_01_26_v2.pdf` (effective 2026-01-20). All prices net EUR, exclusive of 19% VAT. Region: DUS2 + HAM1. Companion to `INFRASTRUCTURE.md` and `IMPLEMENTATION_PLAN.md`. **Revised 2026-09-11:** replaces the SysEleven plan (DUS2, 4 VMs / 3 clusters). The company runs on Hetzner Cloud already; the platform adds one Hetzner VM now (staging) and one later (production). All prices net EUR, exclusive of 19% VAT. **Hetzner list prices change; every figure marked "≈" must be re-checked in the Hetzner console at booking time.**
--- ---
## 1. TL;DR ## 1. TL;DR
**Locked topology (2026-05-18):** 4 billable VMs — 1 stage + 3 prod — totalling **48 GiB-RAM**. See `INFRASTRUCTURE.md §1`. | Item | Now (staging only) | After prod go-live |
|---|---|---|
| Core cluster (2 existing VMs, already paid) | unchanged | unchanged |
| `bp-platform-stage` — **CPX32** (4 vCPU / 8 GB, booked 2026-09-11), 1 IPv4 | ≈ €12–16 | ≈ €12–16 |
| `bp-platform-prod` — ≥ 16 GB, dedicated cores (CCX23/CCX33 class), 1 IPv4 | — | ≈ €40–65 |
| Hetzner Volume for prod data (100 GB, €0.05/GB) | — | ≈ €5 |
| Object Storage (backups + seed + exports, ~300 GB) | ≈ €3–6 | ≈ €6–12 |
| Snapshots (2 VMs × ~40 GB, €0.012/GB) | ≈ €1 | ≈ €2 |
| Strato domain + mail (existing) | unchanged | unchanged |
| **Platform delta, net / month** | **≈ €17–25** | **≈ €65–110** |
All four pricing modes, side by side, at the locked sizing: No commitments, no upfront payments: Hetzner bills hourly, monthly capped. Compare: the SysEleven plan was €307–549/mo plus €6,912 upfront.
| Mode | Compute €/mo | Storage €/mo | Network €/mo | **Total net €/mo** | + 19% VAT | **Annual gross €** |
|---|---:|---:|---:|---:|---:|---:|
| **On-Demand** | 434.50 | 112 | 2.92 | **549.42** | 653.81 | **7,846** |
| **12-month commit** | 295.20 | 112 | 2.92 | **410.12** | 488.04 | **5,856** |
| **36-month no upfront** | 216.00 | 112 | 2.92 | **330.92** | 393.79 | **4,725** |
| **36-month upfront** | 192.00 | 112 | 2.92 | **306.92** | 365.23 | **4,383** |
**36M upfront one-time payment**: €6,912 net at signing (compute only; storage + network still billed monthly).
**Recommended cash plan for Year 1:**
1. Months 1–3: burn On-Demand (~€549/mo) while flavors get proven against real workload
2. Month 4 onward: sign 36M-upfront commit at proven size (~€307/mo)
3. Year-1 total infra: **€4,410 net / €5,248 gross** + one-time €6,912 upfront in Month 4
Growth tiers extend that same baseline (next 4 sections drill in).
--- ---
## 2. What to use / what to skip ## 2. What to use / what to skip
### Use from day one | Service | Use? | Why |
| Service | Why | Cost |
|---|---|---| |---|---|---|
| **OpenStack IaaS (m2 GP)** | Bread and butter. General-purpose 1:4 vCPU:RAM fits everything. | per VM, see §3 | | Cloud Servers (CX/CPX shared, CCX dedicated) | **Yes** | Shared vCPU is fine for staging; dedicated cores for prod (scan workloads, Chrome, Mongo). |
| **Block Storage (Ceph)** | 3x replicated, persistent. €0.10/GiB/mo. | per GiB | | Primary IPv4 per VM | **Yes** | Per-node ingress needs one public IPv4 per node (≈ €0.50–1/mo each). |
| **Object Storage (S3)** | Backups, audit logs, demo seed bundles, export ZIPs. €0.02/GiB/mo. | per GiB | | Private Network | **Yes (free)** | Master ↔ agent Orca traffic; never expose 6880/6881 publicly. |
| **Floating IP** | Public IPs for vm-edge (1) and stage (1). | €2.92/IP/mo | | Cloud Firewall | **Yes (free)** | Per-VM rules in §3 of INFRASTRUCTURE.md. |
| **VPN as a Service** | Inclusive. Use for ops access from our laptops. | €0 | | Snapshots | **Yes** | Weekly snapshot of each platform VM before prod; nightly for prod. |
| **Self-Service Support** | Free. Adequate while we're shaking out the platform. | €0 | | Volumes | Later | Attach when local NVMe > 60 %; dsms data on prod. |
| Object Storage (nbg1) | **Yes** | Already in use for core (`bp-*` buckets); one more bucket per cluster. |
### Defer until clearly needed | Load Balancer | Later (Tier D) | Only when a second prod app node exists. |
| Service | When to add | Cost | | Hetzner DNS | No | Zone stays at Strato (mail, existing records). Revisit only if Strato record limits bite. |
|---|---|---| | Managed Kubernetes / any managed service | No | Orca orchestrates. |
| **DNS Zones (DNSaaS)** | Never — we self-host PowerDNS on vm-edge per [[self-hosted-oss-first]] | €10/zone — skipped | | GPU servers | No | LiteLLM routes to external providers; add only for a paying dedicated-inference customer. |
| **Load Balancer (Octavia)** | When we add a second vm-edge for HA (Tier D). Until then orca-proxy + Floating IP is enough. | €14.60–57.67/mo |
| **Business Support** | When MRR > €5k. Below that, Self-Service docs cover us. | €185/mo |
| **Priority Support** | Only if we sign an Enterprise contract that requires <1h response. | €545/mo |
| **DDoS Guard PLUS** | After first attack OR before launching anything customer-promoted. | €875/mo |
| **DBaaS PostgreSQL Cluster** | When tenant_registry Postgres becomes the bottleneck (200+ customers, see RISK-1 in INFRASTRUCTURE.md). | €213–426/mo per cluster (m2.small–medium, 36M upfront) |
| **MetaKube Core (managed K8s)** | We use Orca (the user's own product). MetaKube would compete with Orca, not complement it. Skip unless Orca is replaced. | €0 by design |
| **Managed VM (Business/Priority)** | Defeats Orca. We are the ones who manage VMs. | skipped — saves €1k+/mo |
| **Operational Support Platform** | €759–€1,479/mo. Massive overkill until late stage. | skipped |
### GPU instances (separate concern)
LiteLLM today is a passthrough. If we ever self-host an inference model:
- **L40S (24 GB GPU RAM)**: €1,309/mo On-Demand, €1,086 (12M), €877 (24M)
- **H100 NVL (94 GB)**: €5,755/mo On-Demand, €4,637 (12M), €3,743 (24M)
For now: route LLM calls through LiteLLM → external provider. Add GPU only if a customer pays for dedicated inference.
--- ---
## 3. Per-VM sizing — Locked topology (Tier A, 5 customers) ## 3. Sizing
Flavor mapping from `INFRASTRUCTURE.md §1` to SysEleven `m2` General Purpose (1 vCPU : 4 GiB RAM, 50 GiB ephemeral root included). ### Staging — `bp-platform-stage` (CPX32, booked 2026-09-11)
### Compute — all four pricing modes side by side Decision: **CPX32 (4 vCPU / 8 GB)** instead of the 16 GB class. Consequence: staging runs the first-line stack with tight caps (≈ 6.1 GB committed, INFRASTRUCTURE.md §2) and **without** browserless/Chrome, soft-PLC and PLC-sim; the Werkbank runner is started only for runner tests. Scan types that need Chrome or the PLC targets are exercised on the production node later. If staging needs the full scan matrix, resize to CPX42/CX43 (a Hetzner rescale keeps the disk; ~5 min downtime).
| VM | Env | Flavor | vCPU | RAM | On-Demand | 12M | 36M no-upfront | 36M upfront | ### Production — `bp-platform-prod` (sized in the production plan)
|---|---|---|---:|---:|---:|---:|---:|---:|
| stage | stage | m2.small | 2 | 8 GB | 72.42 | 49.20 | 36.00 | 32.00 |
| vm-edge | prod | m2.small | 2 | 8 GB | 72.42 | 49.20 | 36.00 | 32.00 |
| vm-control | prod | m2.medium | 4 | 16 GB | 144.83 | 98.40 | 72.00 | 64.00 |
| vm-data | prod | m2.medium | 4 | 16 GB | 144.83 | 98.40 | 72.00 | 64.00 |
| **TOTAL** | | | **12** | **48 GB** | **434.50** | **295.20** | **216.00** | **192.00** |
**36M upfront one-time cost:** 192 × 36 = **€6,912 net** at signing (compute only; everything else billed monthly). Same stack minus the mock, plus headroom for real scans and, after M-MIG-9, the dsms project (Postgres 17, IPFS, Qdrant, Ollama embed ≈ +6 GB). Start at 16 GB dedicated (CCX23 class) if dsms stays on the stage node for a while; otherwise 32 GB (CCX33 class). Decide at prod planning with 4 weeks of staging metrics from SigNoz.
**Reference per-GiB-RAM rates** (the linear model behind all numbers above): ### Storage
| Mode | €/GiB-RAM/mo |
|---|---:|
| On-Demand | 9.05 |
| 12M commit | 6.15 |
| 36M no-upfront | 4.50 |
| 36M upfront | 4.00 |
Any future sizing change can be sanity-checked as `RAM × rate`. Local NVMe of the flavors (80–160 GB) covers launch. Object storage grows with backups (30-day retention of nightly dumps ≈ 30 × dump size) and exports.
### Storage — Tier A steady state
| Item | GiB | €/GiB/mo | €/mo |
|---|---:|---:|---:|
| stage block (ephemeral PG + Mongo + Qdrant in-VM) | +50 | 0.10 | 5.00 |
| vm-edge block (pg-keycloak + pg-infisical + Gitea repos) | +50 | 0.10 | 5.00 |
| vm-control block (MariaDB + Stalwart spool) | +250 | 0.10 | 25.00 |
| vm-data block (MongoDB + pg-app + Qdrant + MinIO) | +500 | 0.10 | 50.00 |
| Object storage — geo-redundant backups (DUS2↔HAM1) | ~500 | 0.0496 | 25.00 *(€12.50 first 6mo via launch discount)* |
| Object storage — seed bundles + exports + audit archive | ~100 | 0.02 | 2.00 |
| **Storage subtotal (steady state)** | | | **112.00** |
| **Storage subtotal (first 6 months)** | | | **99.50** |
### Network
| Item | €/mo |
|---|---:|
| 1 Floating IP (vm-edge — only public host in prod) | 2.92 |
| 1 Floating IP (stage — public for tester access) | 2.92 |
| PowerDNS (self-hosted on vm-edge) | 0 |
| Octavia Load Balancer (deferred to Tier D HA phase) | 0 |
| **Network subtotal** | **5.84** |
> Storage table above uses 1 Floating IP. Adjust to **€5.84** if running stage with its own public IP (recommended). One-line delta of €2.92/mo.
### Combined Tier A — four-mode summary
| Mode | Compute | Storage | Network | **Total net €/mo** | + 19% VAT | **Annual gross €** |
|---|---:|---:|---:|---:|---:|---:|
| On-Demand | 434.50 | 112 | 5.84 | **552.34** | 657.28 | **7,887** |
| 12M commit | 295.20 | 112 | 5.84 | **413.04** | 491.52 | **5,898** |
| 36M no-upfront | 216.00 | 112 | 5.84 | **333.84** | 397.27 | **4,767** |
| 36M upfront | 192.00 | 112 | 5.84 | **309.84** | 368.71 | **4,425** |
### Recommended cash plan — Year 1 (use this line in the pitch)
| Months | Mode | €/mo (net) | Subtotal € |
|---|---|---:|---:|
| 1–3 (rightsizing window) | On-Demand | 552.34 | 1,657 |
| 4–12 (proven baseline) | 36M upfront | 309.84 | 2,789 |
| **Year-1 infra net** | | | **4,446** |
| + 19% VAT | | | **5,291** |
| + one-time 36M upfront in Month 4 | (compute)| | **6,912** |
| **Year-1 cash out (gross)** | | | **12,203** |
### 3-year cumulative (full 36M commitment term)
| Item | € |
|---|---:|
| Months 1–3 On-Demand (compute+storage+net) | 1,657 |
| Compute 36M upfront (paid Month 4) | 6,912 |
| Storage + network, 36 months × ~118 €/mo | 4,248 |
| **3-year infra net** | **12,817** |
| + 19% VAT | **15,252** |
--- ---
## 4. Growth tiers — what scales when ## 4. Growth tiers
### Tier A — Pilot (5 customers, first 6 months) | Tier | Customers | Topology delta | Platform compute ≈ €/mo |
- **Locked topology**: 4 VMs (stage + vm-edge + vm-control + vm-data). See INFRASTRUCTURE.md §1.
- **Year 1 cash plan**: 3 months On-Demand → 36M upfront. ~€310/mo committed compute+storage+net + one-time €6,912.
- **Add**: Self-Service support (free). Skip LB, DNSaaS, DDoS, DBaaS, MetaKube, Managed Services.
### Tier B — Early growth (50–200 customers, Year 1)
- **Vertical scale only.** Bump vm-data m2.medium → m2.large (+€64/mo for 36M upfront).
- **Add cold-standby vm-edge-spare** (€0 idle, only billed during a swap event).
- **Add Business Support** (€185/mo) once MRR > €5k.
- **Add LB Single Instance** (€14.60/mo) when we want zero-downtime portal deploys.
- **Add DDoS Guard PLUS** (€875/mo) before any marketing push.
- Estimated total: **~€1,100–1,400/mo + VAT**.
### Tier C — Scale (500–1000 customers, Year 1–2)
- **Split vm-data** into vm-data + vm-data-db (move pg-app to its own VM; resolves RISK-1).
- Alternative: move pg-registry to DBaaS m2.small cluster (3 inst, 36M upfront): **€213/mo**
- **Split vm-control** into vm-control + vm-ops (ERPNext + MariaDB + Stalwart go to vm-ops): **+€64/mo**
- **HA edge**: second vm-edge, switch Floating IP → Load Balancer Double Instance (**€58/mo**).
- **Object storage growth:** audit logs, exports, demo backups → estimated 2 TB = **€40/mo**.
- Estimated total: **~€2,000–2,500/mo + VAT**.
### Tier D — Full scale (2000 customers, Year 2–3)
- **3-node clusters** on hot paths: vm-control × 2, vm-data × 2.
- **Split vm-edge** into vm-edge + vm-identity + vm-secrets (back toward original 7-VM design).
- **DBaaS m2.medium cluster** (4V/16GB, 36M upfront): **€426/mo** for tenant_registry.
- **Keycloak HA cluster**: 2 vm-identity (m2.medium) + Postgres replica.
- **Priority Support** (€545/mo) becomes worth it.
- **Object storage:** ~5 TB = **€100/mo**.
- **DDoS Guard PREMIUM** (€2,200/mo) if traffic warrants — likely stays on PLUS.
- Estimated total: **€4,500–6,000/mo + VAT**.
### Compute scaling cheat sheet (vs locked topology)
| Tier | Customers | Topology delta from Tier A | Compute €/mo (36M upfront) |
|---|---:|---|---:| |---|---:|---|---:|
| **A** | 5 | locked baseline: stage + 3 prod VMs (48 GiB) | **192** | | **A** | ≤ 50 | stage CX43 + prod CCX23/33 | 65–95 |
| **B** | 200 | + vm-data bumped m2.med → m2.large (+16 GiB) | **256** | | **B** | 50–200 | prod flavor bump; small control VM (CX23 class) as Orca master; prod Volume | 110–160 |
| **C** | 1000 | + split vm-data (+16 GiB), split vm-control (+16 GiB) | **384** | | **C** | 200–500 | split prod into app node + db node; Keycloak to its own core node | 200–300 |
| **D** | 2000 | + split vm-edge (3 → 3 VMs), HA clusters (~+90 GiB) | **~640** | | **D** | 500+ | second prod app node + Load Balancer; second S3 provider | 350–500 |
The **€4/GiB-RAM/mo rate** (GP, 36M upfront) is the linear model — everything else (storage, network, support, DBaaS, DDoS) scales sub-linearly with customer count. Compute is never the bottleneck on the bill.
--- ---
## 5. Cost per customer ## 5. Cost per customer
| Tier | Customers | Monthly infra net (€) | Per customer/month (€) | At Tier A the platform delta is ≈ €80–125/mo; **one `PLT-CORE-CLD-STD` tenant (€290/mo) covers it**. From Tier B onward infrastructure is < 3 % of revenue at the SKU-sheet prices; LLM passthrough (LiteLLM) and on-call time dominate the cost of goods, not compute.
|---|---:|---:|---:|
| A | 5 | 310 | **62.00** |
| B | 200 | 1,200 | **6.00** |
| C | 1000 | 2,300 | **2.30** |
| D | 2000 | 5,000 | **2.50** |
At Tier A the per-customer cost is irrelevant — fixed costs dominate. From Tier B onward our gross margin on a Professional plan (assume €99/customer/month) is **~94%** infrastructure-only. Add LLM passthrough (LiteLLM) + Polar.sh fees (~5%) + on-call time, and we are still well above the 80% gross margin floor SaaS investors look for.
**Break-even: ~4 paying customers at €99/mo covers Tier A infra (€310/mo net).**
--- ---
## 6. SysEleven services we explicitly skip and why ## 6. Things to validate at booking
| Service | Why skip | - Exact flavor names and prices in the console (CX43 / CPX41 / CCX23 naming changes between generations).
|---|---| - Location: `fsn1` or `nbg1` — keep the platform in the same location as the core master for latency to Keycloak; Object Storage is `nbg1` regardless.
| DNSaaS (€10/zone) | We self-host PowerDNS on vm-gateway. €0 marginal cost since vm-gateway exists anyway. | - IPv4 availability and price per primary IP.
| MetaKube Core | Orca already orchestrates our containers. MetaKube would mean abandoning Orca, which the user owns. | - Whether the company Hetzner project (the one holding the core servers and the `bp-*` buckets, migrated 2026-09-10) is used — it must be, for one invoice and one firewall set.
| MetaKube Accelerator | Same — competes with Orca. |
| MetaKube Operator add-ons (ExternalDNS, Cert-Manager, Tideways, Velero etc. at €78–171/mo each) | We pick and roll our own per [[self-hosted-oss-first]]. |
| Managed VM (Business €128–142/mo per VM, Priority €164–182) | Defeats Orca. We are the operators. Saves €1k+/mo at 7 VMs. |
| Operational Support Platform (€759–1,479/mo) | Massively over-specified for our scale. Buy individual Engineering Support days (€1,264/day) on demand if a real incident requires it. |
| DDoS Guard PREMIUM (€2,200) / ENTERPRISE (€4,800) | PLUS at €875/mo is enough for ≤500-customer scale. Upgrade if we see actual 1+ Tbps attacks. |
| Block Storage for Databases (€0.09 vs €0.10) | The €0.01/GiB difference saves ~€5/mo at our scale. Use it only on DBaaS cluster volumes (where SysEleven enforces it anyway). |
--- ---
## 7. Negotiation levers *End of document. Revised 2026-09-11; re-check prices before each booking.*
SysEleven publishes list prices but is open to commercial negotiation, especially as a German Mittelstand provider courting startups. Things worth asking for:
1. **Startup credits.** Hetzner, OVH, and most EU clouds run startup-credit programs. Ask SysEleven for the equivalent before signing the 36M commit. Even €5–10k of credits = 6–12 months of Tier A infra free.
2. **EXIST / HTGF discount.** If we close the €1.5M raise (`project_breakpilot_fundraising`), SysEleven sometimes offers "Gründerförderung" pricing for HTGF-backed companies.
3. **Single-region discount.** We don't need DUS2 + HAM1 geo-redundancy at Tier A. Ask if single-region (DUS2 only) is cheaper.
4. **Object storage commitment.** 6-month 50%-off on geo-redundant storage applies anyway, but bulk commitments on regular S3 may unlock further pricing.
5. **Bundled support.** If we commit to 36M IaaS + Business Support, ask for support fee waiver in year 1.
6. **Move-in incentive.** Negotiate a setup/migration credit covering first 3 months of On-Demand burn.
---
## 8. Open questions / things to validate
- **Port 25 outbound from vm-ops.** Confirmed with SysEleven that outbound SMTP is allowed by default; if not, fall-back is to relay through Postal/Postmark for transactional only.
- **Region choice.** DUS2 vs HAM1 — DUS2 is the only region for L40S GPUs, HAM1 has A30. If we never self-host inference, region is purely a latency choice (DUS2 closer to most EU customers).
- **Geo-redundant Ceph backups.** Currently planning local block + S3 backup. Could also use SysEleven's geo-redundant S3 (DUS2 ↔ HAM1) for true DR. Cost: €0.05/GiB/mo vs €0.02 single-region. At 500GB backup that's €15/mo extra — buy it.
- **Egress traffic.** Fair Use policy — they reserve the right to bill if we exceed normal patterns. CERTifAI LLM passthrough could be heavy. Ask for clarification on what triggers metered billing.
- **VPN-as-a-Service inclusive.** Confirmed in the pricing doc. Use it for ops access — replaces our need to build IP-allowlists into Orca-Proxy for `erp.` and `git.`.
---
## 9. Recommendation summary
1. **Sign On-Demand for first 90 days.** Burn ~€1,365/mo while you find the right flavor for each VM.
2. **At Day 90, commit 36M upfront on proven baselines.** Cuts monthly to ~€700.
3. **Keep all 7 VMs separate.** The €100/mo difference vs. consolidation is not worth losing failure isolation.
4. **Skip every Managed Service.** We have Orca.
5. **Add Business Support at €5k MRR, DDoS PLUS before any public marketing push.**
6. **Negotiate startup credits before signing.** Could be worth months of free infra.
---
*End of document. Pricing snapshot 2026-01-20; re-check before signing commitments.*
+147 -688
View File
@@ -1,748 +1,207 @@
# Implementation Plan — Breakpilot Platform # Implementation Plan — Breakpilot Platform
Companion to `PLATFORM_ARCHITECTURE.md`, `INFRASTRUCTURE.md`, and `PRODUCT_INTEGRATION_SPEC.md`. Companion to `PLATFORM_ARCHITECTURE.md`, `INFRASTRUCTURE.md`, `PRODUCT_INTEGRATION_SPEC.md` and `ERP/03 Implementation Plan`.
This is the build plan for an AI coding agent (Claude Code, executing PRs against the listed repos). Each milestone is sized to fit in 1–3 PRs, ships independently, and leaves the system in a working state. **Revised 2026-09-11.** The greenfield plan (M0–M19, SysEleven, three clusters) is replaced by a **migration plan**: the platform is reorganised in place and brought live on **staging** first. Milestones are named `M-MIG-{n}` and keep the old format (Goal, Depends on, Repos, Deliverables, Acceptance, Tests, Gate, Effort). Production is a separate plan written after the staging gate (M-MIG-8) passes.
--- ---
## 0. How to read this document ## 0. How to read this document
- Milestones are named `M{phase}.{n}` and grouped by phase. - Each milestone ships independently and leaves the system in a working state; **no milestone starts before the previous one's Acceptance is verified.**
- Each milestone has: **Goal**, **Depends on**, **Repos/files**, **Deliverables**, **Acceptance**, **Tests**, **Gate**, **Effort** (S = ≤1 day, M = 2–4 days, L = ≥1 week). - "Gate": standard = 1 human reviewer + green CI; some milestones add a manual sign-off (anything that touches live systems, DNS, or is irreversible).
- "Gate" is who/what approves the PR for merge. Standard is 1 human reviewer + green CI; some milestones add a manual sign-off. - Effort: S ≤ 1 day, M = 2–4 days, L ≥ 1 week.
- Phases are ordered; milestones within a phase can be parallelised where dependencies allow. - §1 conventions apply to every PR in every repo.
- The dependency graph at §11 is the source of truth — when in doubt, read it.
--- ---
## 1. Cross-cutting conventions (apply to every PR in every repo) ## 1. Cross-cutting conventions
### 1.1 Repo strategy ### 1.1 Repo strategy
Polyrepo under the Gitea org `gitea.meghsakha.com/platform/`. One repo per deployable unit. Existing product repos stay where they are.
**Infrastructure repos.** The IaC is split by Orca cluster — one cluster per plane, one repo per cluster — per the 2026-06-30 cluster-split decision (see [Plane model memory](../../../../home/sharang/.claude/projects/-home-sharang-workspace/memory/project_breakpilot_plane_model.md) and `INFRASTRUCTURE.md §6`). Until the legal entity is established and SysEleven / Hetzner business contracts can be signed, the cluster manifests live as design-only staging directories under `platform/orca-platform/clusters/`. At migration time each `clusters/<name>/` subdir becomes its own repo: Polyrepo under the Gitea org `git.breakpilot.com/platform/`. One repo per deployable unit.
| Repo | Purpose | Created in | | Repo | Purpose | Status |
|---|---|---| |---|---|---|
| `platform/orca-platform` | IaC staging — cluster.toml templates, per-cluster service manifests under `clusters/breakpilot-{edge,control,app}/`, overlays, DNS zones, dev-compose | M1.1 | | `platform/orca-platform` | IaC for the **platform cluster**: `cluster.toml`, `services/<project>/service.toml`, `keycloak/` realm exports, `tests/stage/`, `scripts/validate.sh`, `dev/` compose | exists; restructured in M-MIG-3 |
| `platform/breakpilot-edge` | Identity + Infra cluster (vm-edge): Keycloak, Gitea, Infisical, PowerDNS, Orca-Proxy | M1.2 (split from `orca-platform/clusters/breakpilot-edge/`) | | `sharang/orca-infra` | IaC for the **core cluster** (unchanged owner; company infra) | exists |
| `platform/breakpilot-control` | Control cluster (vm-control): portal, tenant-registry, ERPNext, MariaDB, Stalwart, Frappe HD | M1.2 (split from `orca-platform/clusters/breakpilot-control/`) | | `platform/tenant-registry` | Go: tenants, catalog, entitlements, usage, licences, ERP link, audit, `cmd/erpmock` | exists; extended M-MIG-5/7 |
| `platform/breakpilot-app` | App cluster (vm-app-prod + vm-app-stage): CERTifAI, compliance-*, Mongo, MinIO, Qdrant, LiteLLM, pg-app | M1.2 (split from `orca-platform/clusters/breakpilot-app/`) | | `platform/portal` | Next.js 16 customer area + backstage | exists; path tenancy M-MIG-5 |
| `platform/pruefwerk` | Prüfwerk (moved from `sharang/compliance-scanner-agent`) | M-MIG-4 |
| `platform/werkbank` | Werkbank runner (moved from `sharang/werkbank`) | M-MIG-4 |
| `platform/werkpilot` | Werkpilot CLI (moved from `sharang/werkpilot`) | M-MIG-4 |
| `platform/firmwerk` | Firmwerk CLI + cloud-server (moved from `sharang/firmwerk`) | M-MIG-4 |
| `platform/docs` | Mirror of the Collectives specs (Collectives is canonical) | exists |
| `platform/seed-data` | Demo tenant fixtures per product | exists (scaffold) |
| `platform/design-tokens` | CSS variables / fonts, optional for product UIs | exists; no longer required by the contract |
**Product / business repos:** Stays put: `sharang/certifai` (parked), `sharang/breakpilot-site`, `sharang/breakpilot-notetaker`, `Benjamin_Boenisch/breakpilot-compliance` (dsms; migrates as a deployment in M-MIG-9, repo unchanged).
| Repo | Purpose | Created in | ### 1.2 Per-repo scaffolding, 1.3 branch + commit conventions, 1.4 PR template, 1.5 CI checks, 1.6 approval gates — unchanged from the 2026-05 plan (trunk-based, Conventional Commits, squash-merge, commitlint + gitleaks + trivy, CODEOWNERS).
|---|---|---|
| `platform/tenant-registry` | Go service: tenant glue, audit, API keys | M4.1 |
| `platform/portal` | Next.js 15: customer area + backstage | M5.1 |
| `platform/docs` | Architecture, integration spec, this plan, runbooks | M0.1 |
| `platform/seed-data` | Demo tenant fixtures per product | M13.1 |
| `platform/design-tokens` | CSS variables / fonts (consumed by product web comps) | M5.1 |
**Existing repos that get changes (no new repos):** ### 1.7 Versioning + release strategy (Orca reality)
- `benjamin_boenisch/certifai` — M6.1 / M6.2 / M6.3
- `benjamin_boenisch/breakpilot-compliance` — M7.1 / M7.2
### 1.2 Per-repo scaffolding (must exist before any feature work) - Semver per repo. Images: `:sha-<short>` and `:latest` on every `main` build (Harbor `repo.breakpilot.com/<project>/<image>`), cosign-signed.
Every new repo lands in M0.1 with: - **Stage** auto-deploys on merge to `main`: CI POSTs a signed webhook to the platform master, Orca re-pulls and restarts `<svc>-stage`.
- **Production** (later): tag `vX.Y.Z` → CI retags `:sha-…` as `:prod-<version>` and pushes to a `prod` branch that triggers the `<svc>-prod` webhook. Manual sign-off before the tag.
``` - **Rollback:** `orca rollback <svc>-<env>` on the master (previous image). RTO ≤ 5 min.
/README.md what this repo is, how to run, links to architecture - **Config changes** (service files): PR → merge → `git pull && orca deploy` on the master (documented in `orca-platform/README.md`).
/CONTRIBUTING.md branch model, commit format, how to open a PR - Database migrations forward-only, run by an init container / `migrate` binary before the service starts.
/CODEOWNERS at least one mandatory reviewer (us)
/.gitea/
/pull_request_template.md
/issue_template/
bug.md
feature.md
/.gitea/workflows/
ci.yaml fmt → lint → test → build (per-language details in M0.2)
release.yaml on tag: build image, push to registry
/CHANGELOG.md generated from conventional commits
/LICENSE MIT for portal/docs; Apache-2.0 for libraries
```
### 1.3 Branch + commit conventions
- **Trunk-based.** `main` is always deployable. Feature branches: `feat/<short-slug>`, `fix/<short-slug>`, `chore/<short-slug>`. Max lifetime 5 days.
- **Conventional Commits** (`feat:`, `fix:`, `chore:`, `docs:`, `refactor:`, `test:`, `breaking!:`). Enforced by `commitlint` in CI.
- **Squash-merge** to main. PR title becomes the commit message.
- **Direct push to main is blocked** by Gitea branch protection.
### 1.4 PR template (in every repo)
```markdown
## What
<1-3 bullets>
## Why
<link to architecture section, milestone ID, or issue>
## How
<implementation notes for the reviewer>
## Test plan
- [ ] unit
- [ ] integration (if API surface changed)
- [ ] e2e (if user-facing flow changed)
- [ ] manual smoke on stage
## Risk
<what could break, blast radius, rollback plan>
## Linked milestone
M{phase}.{n}
```
### 1.5 CI checks (required before merge, configured in M0.2)
Per language defaults:
| Stack | Required checks |
|---|---|
| Go | `go fmt -l (no diff)`, `go vet`, `golangci-lint`, `go test ./...`, `go build` |
| Rust | `cargo fmt --check`, `cargo clippy -- -D warnings`, `cargo test -j8` |
| TypeScript | `pnpm lint`, `pnpm typecheck`, `pnpm test`, `pnpm build` |
| Python | `ruff check`, `ruff format --check`, `mypy`, `pytest` |
| All | `commitlint`, image build, container scan (`trivy`), SBOM upload |
### 1.6 Approval gates
- **Standard gate** (most milestones): 1 human reviewer approves + all CI checks green. Enforced by Gitea branch protection on `main`.
- **CODEOWNERS** auto-requests the right reviewer based on path.
- **Production-promotion gate** (release tags only): manual sign-off by `@sharang` on the release issue + stage soak ≥ 24h.
- **Security gate** (M2.x, M4.x, M14.x): security checklist in PR body completed.
### 1.7 Versioning + release strategy
- **Semver** per repo. Container images carry **three tags**: `:sha-<short>`, `:v1.4.2`, `:env-stage` / `:env-prod`.
- **Stage** auto-deploys on every merge to `main` (Gitea Actions → Orca apply against `stage` cluster).
- **Production** deploys only when a release tag `vX.Y.Z` is created. Tag creation requires the production-promotion gate.
- **Rollback**: `orca rollout undo <service>` flips back to previous image tag. RTO target ≤ 5 min for any single service.
- **Database migrations** are forward-only and run as an init container before the service starts. Migrations that delete columns require two releases (1: stop writing, 2: drop).
### 1.8 Environments ### 1.8 Environments
Three Orca clusters, **one per plane** (not one per env). Stage and prod live in the same `breakpilot-app` cluster on different VMs:
| Cluster | VMs | Plane | Envs hosted | | Env | Where | Keycloak realm | tenant-registry | ERPNext | Data | Deploy |
|---|---|---|---| |---|---|---|---|---|---|---|
| `breakpilot-edge` | `vm-edge` (1) | Identity + Infra | shared by stage + prod (single Keycloak realm, `tenant.kind` differentiates) | | dev | laptop, `orca-platform/dev/` compose | `breakpilot-dev` (local KC) | local | mock | fixtures | n/a |
| `breakpilot-control` | `vm-control` (1) | Control | shared by stage + prod (single tenant-registry, `tenant.kind` differentiates) | | stage | `bp-platform-stage` (cluster master) | `breakpilot-stage` on core KC | `tenant-registry-stage` + `pg-stage` | `erpnext-mock-stage` | synthetic + demo | auto on merge |
| `breakpilot-app` | `vm-app-prod`, `vm-app-stage` (2) | App | prod on `vm-app-prod`, stage on `vm-app-stage` | | prod | `bp-platform-prod` (agent) | `breakpilot-prod` on core KC | `tenant-registry-prod` + `pg-prod` | live `erp.breakpilot.com` | real | tag + sign-off |
| Env | Where it runs | Data | Auto-deploy? | Hosts: `app-stage.breakpilot.com` / `app.breakpilot.com` (portal, tenants by path), `registry-stage` / `registry` (+ `licence`), `pruefwerk-stage` / `pruefwerk`, `firmwerk-stage` / `firmwerk`. Dev: `localhost` ports.
|---|---|---|---|
| dev | Developer machine, docker-compose (`platform/orca-platform/dev/`) | fixtures | n/a |
| stage | `vm-app-stage` in `breakpilot-app`; calls prod KC + prod tenant-registry under `tenant.kind = "stage"` | seeded demo + synthetic customers | yes (on merge to main) |
| prod | `vm-app-prod` in `breakpilot-app` + `vm-control` + `vm-edge` | real | tag + gate |
Identity and Control are NOT duplicated for stage. Stage workloads authenticate against the prod Keycloak realm with `tenant.kind = "stage"` and read tenant config from the prod `tenant-registry` (read-only for stage tenants) per `INFRASTRUCTURE.md §5`. ### 1.9 Observability + audit, 1.10 secrets, 1.11 testing policy, 1.12 feature flags — unchanged, except: secrets are Orca project-scoped (`orca secrets set --project`), Infisical only for the licence signing key and CI credentials.
Domain pattern:
- dev: `*.localhost` (mkcert)
- stage: `*.stage.breakpilot.com`
- prod: `*.breakpilot.com`
### 1.9 Observability + audit
- **SigNoz** (already running at `signoz.meghsakha.com`) for traces, logs, metrics. Every service ships OTel SDK from day one.
- **Audit events** in the Retraced-shape schema (PRODUCT_INTEGRATION_SPEC.md §8.4) emitted to Tenant Registry `/audit` from every service. Required for every state-changing endpoint.
- **Structured logs** (JSON) only. No `fmt.Println` / `console.log` in committed code; CI rejects.
### 1.10 Secrets
- Infisical machine identity per service, path `/{env}/{service}/`.
- The only secret allowed in an Orca env file is the Keycloak DB URI (bootstrap exception — see INFRASTRUCTURE.md).
- CI scans for committed secrets via `gitleaks`. Failures block merge.
### 1.11 Testing policy (mandatory; see also `feedback_testing_everything`)
- **Unit**: every non-trivial function.
- **Integration**: every API endpoint, against real Postgres/MongoDB via `testcontainers`. No mock databases.
- **E2E**: every user-facing flow has at least one Playwright spec running against stage post-deploy.
- **Regression**: when a bug is fixed, a failing test is added FIRST, then the fix.
- **No PR ships without tests.** "Manual tested" is not acceptable except for IaC.
### 1.12 A/B testing (designed for, adopted later)
Every place where a future flag would gate behaviour MUST flow through a single `featureFlags.evaluate(tenantId, flagKey)` function. Initial implementation returns hard-coded values from `manifest.yaml`. Swap to Unleash/OpenFeature in M19.1 with zero call-site changes.
--- ---
## 2. Phase 0 — Foundations (M0.x – M3.x) ## 2. What already exists (2026-09-11 baseline)
**Goal:** Repos exist, CI works, infra is provisioned and observable, identity + secrets are usable. No customer-visible features yet. - Core cluster `breakpilot` (orca-infra) with Keycloak (realms `master`, `breakpilot`, `breakpilot-dev`, `certifai`), Gitea 1.27 + Actions, Harbor, LiteLLM, Infisical, SigNoz, ERPNext v15 + CRM + Helpdesk, Nextcloud, chat, status page, landing + `kontakt-relay` (website form → CRM Lead).
- On that cluster, to be moved: portal (`portal-dev` + 4 per-tenant containers), tenant-registry (`tenant-registry-dev`), the Prüfwerk stack (project `certifai`), and the dsms stack (project `breakpilot-dsms`, 12 services on `*.breakpilot.ai`).
- `platform/tenant-registry`: schema (tenants, tenant_projects, tenant_products, tenant_idp_config, api_keys, audit_log), tenant lifecycle + catalog (hard-coded) + API keys + audit + memberships endpoints, Keycloak org provisioning, product provisioning callback. No usage / plans / subscriptions / ERP / licence code.
- `platform/portal`: signup, tenant shell, catalog + trial, products, api-keys, audit (registry-backed); billing/users/settings are fixtures; host-based tenancy.
- Prüfwerk: multi-tenant (Mongo per tenant), Keycloak auth, MCP, docs; JWT validation without iss/aud; no registry integration beyond claims.
- Werkbank: runner, no packaging. Werkpilot: release pipeline, no licensing. Firmwerk: own licensing.
- ERP: nothing implemented (`ERP/03` Phase 0 blocked on Steuerberater; Phase 1 SKUs can start).
### M0.1 — Bootstrap repos and docs ---
- **Depends on:** nothing
- **Repos:** `platform/docs`, `platform/orca-platform`, `platform/portal`, `platform/tenant-registry`, `platform/design-tokens`, `platform/seed-data`
- **Deliverables:** create the Gitea `platform` org; for each repo add the §1.2 scaffolding; `platform/docs` ingests the existing `PLATFORM_ARCHITECTURE.md`, `INFRASTRUCTURE.md`, `PRODUCT_INTEGRATION_SPEC.md`, this plan.
- **Acceptance:** every repo has a working `README.md`, `CONTRIBUTING.md`, `CODEOWNERS`, PR template.
- **Tests:** n/a
- **Gate:** standard
- **Effort:** S
- **Note:** the three cluster repos (`platform/breakpilot-edge`, `platform/breakpilot-control`, `platform/breakpilot-app`) are NOT created at M0.1 — their service manifests live as design-only directories under `platform/orca-platform/clusters/` until M1.2 splits them.
### M0.2 — CI templates + branch protection ## 3. Migration milestones
- **Depends on:** M0.1
- **Repos:** all of the above
- **Deliverables:** `.gitea/workflows/ci.yaml` per repo (matching §1.5 by stack), Gitea branch protection on `main` (require PR, 1 review, status checks green, no direct push), `commitlint`, `gitleaks`, `trivy` configured.
- **Acceptance:** a deliberately-broken PR is rejected by every check; a clean PR is mergeable.
- **Tests:** smoke PR per repo demonstrating green CI.
- **Gate:** standard
- **Effort:** S
### M0.3 — Self-hosted DNS + wildcard TLS ### M-MIG-0 — Preparation (no service changes)
- **Depends on:** M1.2 (vm-edge must exist before PowerDNS lands) - **Goal:** clean repos, recorded live state, cold archives, credentials ready.
- **Repos:** `platform/breakpilot-edge` - **Depends on:** plan approval.
- **Repos:** `sharang/orca-infra`, `platform/orca-platform`, Gitea admin, Harbor.
- **Deliverables:** commit the master's uncommitted `cluster.toml` on orca-infra and pull everywhere; discard the stale local edits in orca-platform and pull `origin/main`; record `orca status`, `orca webhooks list`, `docker ps` (both nodes), realm export of `breakpilot-dev`, Gitea runner host + labels; archives to `s3://bp-orca-backups/archive-2026-09-platform-stop/` (registry `pg_dumpall`, `certifai-mongo` mongodump, tar of every portal/registry/certifai volume) with one test restore; lower Strato TTLs on the hosts that move; Gitea org secrets in `platform` (`REGISTRY_USER/PASS`, `COSIGN_KEY/PASSWORD`, `ORCA_WEBHOOK_SECRET_STAGE`, `BP_S3_*`) and a bot user `platform-ci` with read access to `platform/*`; Harbor projects `pruefwerk`, `firmwerk`, `platform`.
- **Acceptance:** both IaC repos clean on `origin/main`; archive listed in S3 and the registry dump restores into a scratch Postgres; runner known; org secrets present.
- **Gate:** standard + manual (touches the core master). **Effort:** S–M.
### M-MIG-1 — Spec revision (this revision)
- **Goal:** Collectives specs describe the target; `platform/docs` mirrors them.
- **Deliverables:** `PLATFORM_ARCHITECTURE.md`, `INFRASTRUCTURE.md`, `IMPLEMENTATION_PLAN.md`, `PRODUCT_INTEGRATION_SPEC.md` (2.0), `COST_PLAN.md`, `CHANGELOG.md`, `Readme.md` template, `ERP/02`, `ERP/03` revised; `BreakPilot Infra` docs updated after M-MIG-2; one mirror commit in `platform/docs`.
- **Acceptance:** grep of the Collectives tree for `*.stage.breakpilot.com`, `web component`, `widget`, `custom domain`, `SysEleven`, `PowerDNS`, `Stalwart`, `Stripe`, `Polar` hits only changelog/history lines; `platform/docs` diff equals Collectives.
- **Gate:** owner review. **Effort:** M. **Status:** in progress 2026-09-11.
### M-MIG-2 — Stop and archive on the core cluster
- **Goal:** the core cluster runs company infrastructure plus (temporarily) dsms and its two dependencies.
- **Depends on:** M-MIG-0.
- **Repos:** `sharang/orca-infra`.
- **Deliverables:** `orca stop` in order: `breakpilot-portal-{acme,hello,globex,sandbox}`, `breakpilot-portal`, `compliance-dashboard`, `compliance-docs`, `compliance-agent`, `browserless`, `soft-plc`, `plc-sim`, `mailserver`. **Keep** `breakpilot-tenant-registry(+db)`, `compliance-mcp`, `certifai-mongo` (dsms depends on them) → moved into `services/dsms-deps/service.toml`. Remove the stopped blocks, `git pull && orca deploy` on the master, verify prune or `docker rm -f` on both nodes. Clean-up: Gatus portal checks (`services/core/status/config.yaml`), Keycloak admin password rotation (the agent held it), scanner mailserver certbot + ports 25/587/993, orca webhook registrations for portal/registry/scanner. Volumes kept until M-MIG-6 verification. Update `BreakPilot Infra` Readme + Service Catalog.
- **Acceptance:** `orca status` = core + dsms + dsms-deps; `docker ps` on both nodes matches; Gatus green; `https://api-dev.breakpilot.ai/health` and a membership-checked dsms call succeed; next nightly backup succeeds.
- **Gate:** standard + manual sign-off. **Effort:** S–M.
### M-MIG-3 — Staging VM and the platform cluster
- **Goal:** `breakpilot-platform` cluster exists with one node serving `https://app-stage.breakpilot.com`.
- **Depends on:** M-MIG-0.
- **Repos:** `platform/orca-platform`.
- **Deliverables:** Hetzner VM `bp-platform-stage` (**CPX32**, 4 vCPU / 8 GB — booked 2026-09-11; Ubuntu 24.04, company project, private network `breakpilot-platform`, Cloud Firewall per `INFRASTRUCTURE.md §3`; browserless / soft-plc / plc-sim are not deployed on staging, see `INFRASTRUCTURE.md §2`); docker + `docker login repo.breakpilot.com`; Orca at the core master's version or newer (both ≥ 0.2.13 with ACME fast-retry), installed as master with `orca install-service`; repo restructure: `cluster.toml` (name `breakpilot-platform`, ACME email, S3 backup `bp-platform-backups`, LiteLLM, admin + deployer tokens), `services/<project>/service.toml` layout (`platform-stage`, `pruefwerk-stage`, `firmwerk-stage`), every service pinned + memory-limited, `[security_headers] frame_options="DENY"`; delete `clusters/`, `overlays/`, `dns/`, `manifests/`, `scripts/{apply,plan}.sh`, `release.yaml`, the restore-drill stub; adapt `validate.sh` (pins ∈ {`bp-platform-stage`,`bp-platform-prod`}, memory required, secret refs project-scoped); README + `WEBHOOKS.md` describe the deploy flow; Strato A records `app-stage`, `registry-stage`, `pruefwerk-stage`, `firmwerk-stage`; a hello service on `app-stage`.
- **Acceptance:** `orca status` healthy; `curl -I https://app-stage.breakpilot.com` = valid Let's Encrypt cert; backup lands in S3; a signed test webhook redeploys the hello service.
- **Gate:** standard + manual (spend + DNS). **Effort:** M.
### M-MIG-4 — Move and rename the product repos
- **Goal:** the four product repos live under `platform/` with their final names and build green.
- **Depends on:** M-MIG-0 (bot user, org secrets, Harbor projects).
- **Order (git dependencies):** firmwerk → pruefwerk → werkbank → werkpilot; then registry/portal link fixes.
- **Deliverables:** - **Deliverables:**
- **PowerDNS Authoritative** on `vm-edge` (Orca-managed). PostgreSQL backend on same VM (small; ~100 records). 1. `sharang/firmwerk` → `platform/firmwerk`: `README.md` package path; workflows `.github/` → `.gitea/` (`runs-on: docker`); tag `v0.4.3`.
- At the registrar (Benjamin's account): set `ns1.breakpilot.com` and `ns2.breakpilot.com` glue records pointing at vm-edge public IP; delegate the domain to those NS. 2. `sharang/compliance-scanner-agent` → `platform/pruefwerk` (transfer + rename): firmwerk git deps → `platform/firmwerk` tag `v0.4.3`, imports `tramiton_*` → `firmwerk_*`, `cargo update`; CI + 3 Dockerfiles → `platform-ci` token, `full_name: platform/pruefwerk`, images → `repo.breakpilot.com/pruefwerk/*`; fix `fixtures/demo-targets/targets.json`, vitepress config, demo-targets docs, `.cargo/audit.toml`, `.env.example` + `config.rs` openplc default, `dedup.rs`, `agent_client.rs`; delete the mailserver compose; delete stale branches; remove the retired repo webhook.
- Zone file committed in `orca-platform/dns/breakpilot.com.zone`; Orca syncs into PowerDNS on apply. 3. `sharang/werkbank` → `platform/werkbank`: Cargo deps → `platform/pruefwerk` at a **tag**; `DESIGN.md`; add `Dockerfile` + `.gitea/workflows/ci.yml` → `repo.breakpilot.com/pruefwerk/werkbank`.
- Records: apex `breakpilot.com`, wildcards `*.breakpilot.com` + `*.stage.breakpilot.com`, plus `auth.`, `erp.`, `mcp.`, `cdn.`, `mail.`, `ns1.`, `ns2.`, SPF/DKIM/DMARC TXT records (for M3.2). 4. `sharang/werkpilot` → `platform/werkpilot`: `release.yml` fallback; `custom_providers/litellm.json` → `llm.breakpilot.com`.
- Wildcard TLS via Let's Encrypt **DNS-01 against PowerDNS** (Lego's `--dns=pdns` provider); ACME credentials in Infisical at `/prod/orca-proxy/PDNS_API_KEY`. 5. `platform/tenant-registry` `go.mod` module → `git.breakpilot.com/platform/tenant-registry` (+ imports); README/CONTRIBUTING links in registry, portal, seed-data, docs.
- Orca-Proxy reloads the cert via watch on the secret file; renewal cron runs at 02:00 daily. 6. `sharang/certifai`: delete its two retired webhooks only.
- **Acceptance:** `dig @1.1.1.1 anything.breakpilot.com` returns an answer; `curl https://anything.breakpilot.com` returns 404 from Orca-Proxy (no TLS error). - **Acceptance:** CI green on `main` in all four repos after the move; `cargo build` of werkbank and pruefwerk against the new git deps; `grep -r "sharang/\|meghsakha"` in the four repos returns only LICENSE/history; images visible under Harbor `pruefwerk/`.
- **Tests:** ACME renewal dry-run; PowerDNS zone-diff check in CI; reach via stage and prod subdomains; cert expiry page wired to SigNoz alert. - **Gate:** standard. **Effort:** M.
- **Gate:** standard + manual DNS-delegation check by both founders (irreversible from registrar side without 24–48h propagation)
- **Effort:** M (was S — registrar delegation + PowerDNS adds setup time vs. Cloudflare)
### M1.1 — `orca-platform` repo (IaC staging) ### M-MIG-5 — Platform services on staging
- **Depends on:** M0.1, M0.2 - **Goal:** signup → tenant → login → catalog works at `app-stage.breakpilot.com`.
- **Repos:** `platform/orca-platform` - **Depends on:** M-MIG-3, M-MIG-4 (registry module path).
- **Deliverables:** per-cluster manifest layout under `clusters/breakpilot-{edge,control,app}/services/`; per-env overlays (`overlays/dev`, `overlays/stage`, `overlays/prod`); `cluster.toml.tmpl` template parameterized by cluster; a `Makefile` with `make plan` / `make apply` per env; `scripts/validate.sh` enforces a per-cluster `placement.node` whitelist (`breakpilot-edge → vm-edge`, `breakpilot-control → vm-control`, `breakpilot-app → {vm-app-prod, vm-app-stage}`). - **Repos:** `platform/orca-platform`, `platform/tenant-registry`, `platform/portal`, Keycloak (core).
- **Acceptance:** `make plan ENV=stage` and `make plan ENV=prod` both resolve cleanly; `make validate` passes the per-cluster node check on all manifests. - **Deliverables:** realm `breakpilot-stage` from an adapted `dev/keycloak/realm-export.json` (orgs on; clients per `PLATFORM_ARCHITECTURE.md §4`; scope `tenant-context` = `tenant_id, tenant_slug, org_roles, tenant_status`; device flow; roles; theme) exported to `orca-platform/keycloak/breakpilot-stage.json`. Registry: migration `0002` (`products` table replacing `catalog.go`, seeded `pruefwerk` (+addon `werkbank`), `werkpilot`, `firmwerk`; `certifai` and `compliance` keys removed/disabled), `GET /v1/tenants`, `POST /v1/internal/entitlements/check`, per-client authorization map, invite `client_id`/`redirect_uri` from env, provisioning fan-out with outbox retry, `SyncClaims(tenant_status)`. Portal: path tenancy in `middleware.ts`/`host.ts` (`PORTAL_APEX_HOSTS`), fixtures only under `BP_DEV_FIXTURE`, product tiles use catalog `launch_url`, `AUTH_URL`. Deploy project `platform-stage` (`pg-stage`, `tenant-registry-stage`, `portal-stage`) with CI webhooks.
- **Tests:** `make validate` runs in CI; PRs that break a manifest or cross-place a service into the wrong cluster's node fail. - **Acceptance:** `/start` creates a tenant → KC org + invite mail (to a `@breakpilot.com` address); login at `app-stage.breakpilot.com/<slug>/dashboard`; catalog shows three products; API key create/verify; audit entries; portal Playwright suite passes against staging.
- **Gate:** standard - **Gate:** standard + security checklist. **Effort:** L.
- **Effort:** M
- **Status (2026-06-30):** layout landed; cluster split refactor merged via PR #6 (`6be727d4`). Manifests under `clusters/breakpilot-*/services/` are stubs awaiting per-milestone fill-in. `make apply` is a no-op until M1.2.
### M1.2 — Provision VMs + split cluster repos (locked topology) ### M-MIG-6 — Products on staging
- **Depends on:** M1.1 (manifest layout exists); **legal entity established** (gating SysEleven / Hetzner business contracts; no commercial activity before this). - **Goal:** Prüfwerk (+Werkbank), Firmwerk cloud and the two CLIs run against staging with multi-tenancy.
- **Repos:** `platform/orca-platform` (source of split), `platform/breakpilot-edge`, `platform/breakpilot-control`, `platform/breakpilot-app` (created in this milestone). - **Depends on:** M-MIG-5.
- **Deliverables:** **4 VMs across 3 clusters**, one cluster per plane (per the 2026-06-30 cluster-split decision): - **Repos:** `platform/pruefwerk`, `platform/werkbank`, `platform/firmwerk`, `platform/werkpilot`, `platform/orca-platform`.
- **Deliverables:** Prüfwerk: iss+aud validation, CORS allowlist, scheduler via `GET /v1/tenants`, entitlement check on tenant-context build, §4.1 endpoints, usage events; services `pruefwerk-{mongo,agent,dashboard,mcp,docs}-stage` on `pruefwerk-stage.breakpilot.com` (+ `/mcp`, `/docs`); **no browserless / soft-plc / plc-sim on staging (8 GB budget)**; no mailserver on stage. Werkbank: `werkbank-runner-stage` with a registry API key (`werkbank:runner`). Firmwerk: `firmwerk-cloud-stage` + `firmwerk-mongo-stage` on `firmwerk-stage.breakpilot.com`; CLI `v0.4.3` under `platform` packages. Werkpilot: release under `platform/werkpilot`.
- **Acceptance:** tenants `acme` and `globex` via portal; Prüfwerk login per tenant; scan of `cra-vuln-demo`; tenant B cannot read A's scan (404/403); MCP token bound to tenant; runner completes a `dast` job; `firmwerk` device login against `firmwerk-stage`; Gatus checks for the stage hosts; old volumes on core deleted afterwards.
- **Gate:** standard + security checklist. **Effort:** L.
| Cluster | VM | Flavor | Plane | Services | ### M-MIG-7 — Entitlements, licences and the ERP link
|---|---|---|---|---| - **Goal:** the always-on ERP link and CLI licensing work end-to-end against the ERPNext mock.
| `breakpilot-edge` | `vm-edge` | m2.small, public IP | Identity + Infra | orca-proxy, PowerDNS, Keycloak (repurposed from CERTifAI), pg-keycloak, Infisical, pg-infisical, redis-infisical, Gitea | - **Depends on:** M-MIG-6. (= `ERP/03` Phase 5.)
| `breakpilot-control` | `vm-control` | m2.medium | Control | portal, tenant-registry, ERPNext, Frappe HD, MariaDB, redis-erpnext, Stalwart | - **Repos:** `platform/tenant-registry`, `platform/portal`, `platform/pruefwerk`, `platform/firmwerk`, `platform/werkpilot`, `platform/orca-platform`.
| `breakpilot-app` | `vm-app-prod` | m2.medium | App (prod) | CERTifAI, compliance ×3, MongoDB, LiteLLM, pg-app, Qdrant, MinIO | - **Deliverables:** `cmd/erpmock` (Frappe REST surface for Customer / Subscription / Usage Record / CRM Lead / Sales Invoice, seeded SKU items, request log, `/_mock/fire/*` webhook triggers) deployed as `erpnext-mock-stage`. Registry migration `0003`: `plans`, `subscriptions`, `usage_events`, `erp_outbox`, `licences`; ladder statuses `warning|restricted|halted` on `tenants.status`; ERPNext client + outbox worker; HMAC webhook receiver (idempotent) + 15-min reconcile; licence endpoints (Ed25519 key in Infisical `platform/stage/licence-signing`, `/.well-known/licence-keys.json`, heartbeat, revoke); `SyncClaims` on every ladder change. Products: Prüfwerk usage events; Firmwerk cloud-server replaces its own model with registry licence verification + `entitlements/check`; `firmwerk login` / `werkpilot login` device flow → licence, offline verify, heartbeat, ladder; Werkpilot LiteLLM virtual key at licence issue. Portal: billing page from registry (subscriptions, invoices via ERP), ladder banner, catalog request → CRM Lead through the outbox.
| `breakpilot-app` | `vm-app-stage` | m2.small, public IP | App (stage) | slim parallel set for staging; calls prod KC + prod tenant-registry under `tenant.kind = "stage"` | - **Acceptance:** see M-MIG-8.
- **Gate:** standard + security checklist. **Effort:** L (2–3 weeks).
- **Split the cluster repos:** for each cluster, lift `platform/orca-platform/clusters/breakpilot-<name>/` into its own Gitea repo `platform/breakpilot-<name>` with the §1.2 scaffolding + its own `cluster.toml` + its own `services/` tree. Empty out (or stub) the original `clusters/breakpilot-<name>/` in `orca-platform` and leave a pointer README. ### M-MIG-8 — End-to-end tests on staging (gate for the production plan)
- **Repurpose the existing Keycloak.** The CERTifAI Keycloak realm export + user database moves to `vm-edge` rather than standing up a fresh instance — a hostname swap and realm export/import, not a re-bootstrap. - **Depends on:** M-MIG-7.
- **Private network** 10.0.0.0/16 between all four VMs. - **Deliverables:** Playwright (portal) + `hurl`/`curl` scripts in `orca-platform/tests/stage/` covering:
- **Public ingress** per Orca's per-node-ingress model: every VM binds 80/443 and runs its own Let's Encrypt ACME; A records for a service point at the agent IP that runs the container, not at a master. 1. signup → trial → KC org → mock Customer with `tenant_id` → `erp_customer_id` set;
- **SSH disabled**; only `orca exec` for shell access. 2. `fire/sales-order-submit` (`PLT-CORE-CLD-STD` + `CRA-CSA-CLD-STD`) → active → Prüfwerk allowed; a tenant without entitlement → 403;
- **Acceptance:** 3. scan → usage event → outbox → usage record in the mock ≤ 60 s; kill the worker, scan, restart → exactly one record;
- Every VM is reachable from its cluster's Orca master; private-network connectivity verified. 4. `fire/invoice-overdue` → warning banner; past grace → restricted → Prüfwerk writes 402, reads OK; `fire/payment-entry` → active;
- Resource limits per service set in manifest per `INFRASTRUCTURE.md §6` co-tenant notes. 5. Firmwerk licence: login → offline verify with network off → revoke → degrade → hard-stop (clock-skewed);
- `make validate` (in `orca-platform`) and the new per-cluster repo CIs all pass. 6. Werkpilot login, licence check, seat event;
- Cold-start sequence from `INFRASTRUCTURE.md §10 Scenario F` runs successfully on `vm-app-stage`. 7. isolation: cross-tenant API key / MCP token → 403; separate Mongo databases;
- **Tests:** cold-start drill on `vm-app-stage`; cross-cluster reachability matrix; KC realm-import smoke (stage tenant logs in). 8. ops: restore drill of `pg-stage`; redeploy via CI webhook; Gatus green 24 h.
- **Gate:** standard + manual sign-off (touches infra spend and 36M commitment decision) + legal-entity confirmation before any contract signing. - **Acceptance:** all eight pass on two consecutive days.
- **Effort:** L (was M — adds the 3-repo split + KC realm migration on top of provisioning). - **Gate:** owner sign-off → production plan starts. **Effort:** M.
- **Cost impact:** see COST_PLAN.md §3. Initial run: ~€552/mo On-Demand, dropping to ~€310/mo after 36M-upfront commit in Month 4. `vm-app-stage` is the cheapest VM in the topology so adding it doesn't materially shift the bill.
**Pre-M1.2 reality (today, single-VM era):** until this milestone lands, everything runs on the existing single VM (`46.225.100.82`) via `~/workspace/orca-infra`. M7.x work (tenant-registry-aware compliance-agent, per-tenant MCP) and other product work is meaningful on the single-VM setup and ports cleanly into `breakpilot-app/services/prod/` at migration time. ### M-MIG-9 — breakpilot-dsms migration (last)
- **Depends on:** M-MIG-8; decision on pitch-deck's home (shares `breakpilot-db`).
### M1.3 — Backups, monitoring, on-call - **Deliverables:** pin dsms images to digests; `pg_dump` `compliance_db` + `breakpilot_db`; tar `/data/ipfs`, Qdrant, dataroom, Ollama volumes; copy to the platform node; project `dsms` (12 services, pinned, no public Postgres port, Qdrant on the project network) with `AUTH_TENANT_REGISTRY_URL` → `tenant-registry-stage`, `SCANNER_MCP_URL` → `pruefwerk-stage…/mcp`, realm `breakpilot-stage` clients `compliance-client`/`compliance-svc`, `BP_S3_*`; Strato repoint of `admin-dev/developers-dev/api-dev/sdk-dev/qdrant-dev.breakpilot.ai` and `pitch.breakpilot.com`; then stop + remove `breakpilot-dsms` and `dsms-deps` on core, close port 54321, prune `breakpilot-dev` clients, drop `auth-dev.meghsakha.com`, retire `mail.scanner.meghsakha.com`, delete Harbor `certifai/*`; update `BreakPilot Infra` docs.
- **Depends on:** M1.2 - **Acceptance:** dsms health on the new IPs; a known CID resolves; Prüfwerk control mapping works against the new `BREAKPILOT_BASE_URL`; core `orca status` = core only.
- **Repos:** `platform/breakpilot-edge`, `platform/breakpilot-control`, `platform/breakpilot-app` (each cluster owns its own `[backup]` block + restore script per `INFRASTRUCTURE.md §6`) - **Gate:** standard + manual (data move, DNS). **Effort:** M–L.
- **Deliverables:** backup cron per VM per `INFRASTRUCTURE.md §3` (Postgres pg_dump on `pg-keycloak` / `pg-app` / `mariadb`, MinIO bucket replication); SigNoz OTel collector running on every VM; alert routing to `oncall@breakpilot.com`; restore runbook in `platform/docs/runbooks/restore.md`. Each cluster repo has its own S3 bucket per `INFRASTRUCTURE.md §6` so a runaway backup on `breakpilot-app` cannot fill the bucket `breakpilot-edge` writes to.
- **Acceptance:** restore drill on `vm-app-stage` succeeds (script in `breakpilot-app/scripts/restore-drill.sh`); SigNoz shows traces from a synthetic request through `vm-app-stage` → `vm-control` → `vm-edge`.
- **Tests:** disaster-recovery exercise per failure scenario in `INFRASTRUCTURE.md §10` — at least Scenarios A, B, F validated on stage.
- **Gate:** standard + manual sign-off
- **Effort:** L
### M2.1 — Keycloak deployment (repurpose from CERTifAI)
- **Depends on:** M1.2, M1.3
- **Repos:** `platform/breakpilot-edge`
- **Deliverables:** Keycloak 26 on **`vm-edge`** (co-tenant with the rest of infra; JVM heap pinned `-Xmx1500m` so it cannot starve PowerDNS / Infisical, per `INFRASTRUCTURE.md §6`). Postgres backing store (`pg-keycloak`) also on `vm-edge`. Exposed at `auth.breakpilot.com`; stage tenants authenticate against the same instance under `tenant.kind = "stage"` (no separate stage realm). **The CERTifAI Keycloak instance is repurposed here** — its realm export + user database moves to `vm-edge` rather than standing up a fresh instance. Realm import file in `breakpilot-edge/services/keycloak/realm-export.json` (committed, source-of-truth).
- **Acceptance:** master admin login works; realm `breakpilot-prod` exists; the realm carries the migrated CERTifAI users; a stage tenant test login succeeds with `tenant.kind = "stage"` in the JWT.
- **Tests:** automated realm-state diff in CI (`kcadm` against checked-in export); side-by-side comparison of pre-migration and post-migration realm exports flags any silent drift.
- **Gate:** standard + security checklist + manual sign-off on the realm-import diff (irreversible without restoring from KC backup).
- **Effort:** M
- **Note:** the escape hatch — if the JVM/PowerDNS fight shows up in alerts after launch — is to flip Keycloak's `placement.node` to a new `vm-edge-identity` VM inside the same `breakpilot-edge` cluster. No schema migration, just a container move.
### M2.2 — Realm configuration: roles + protocol mappers + Organizations
- **Depends on:** M2.1
- **Repos:** `platform/breakpilot-edge` (realm config)
- **Deliverables:** Organizations feature enabled; realm roles `BREAKPILOT_ADMIN`, `SUPPORT_ENGINEER`, `SALES_REP`; org roles `IT_ADMIN`, `CXO`, `FINANCE`, `LEGAL`, `USER`; protocol mapper that calls Tenant Registry at token issuance for `products`, `plan`, `tenant_status`, `tenant_kind` claims; SALES_REP guardrail policy (token only issuable with `org_id = demo`).
- **Acceptance:** a test user gets the expected JWT claims; a SALES_REP user cannot get a JWT for a non-demo org (verified by integration test).
- **Tests:** Keycloak integration suite in `platform/tenant-registry/test/keycloak_test.go`.
- **Gate:** standard + security checklist
- **Effort:** M
### M3.1 — Infisical
- **Depends on:** M1.2
- **Repos:** `platform/breakpilot-edge`
- **Deliverables:** Infisical on **`vm-edge`** (co-tenant with Keycloak, PowerDNS, Gitea), machine identity per service, secret paths laid out per `PRODUCT_INTEGRATION_SPEC.md §9.4`.
- **Acceptance:** a stub service can read its secrets at startup; rotating a secret in Infisical UI is picked up on next pod start.
- **Tests:** smoke test container reads secrets.
- **Gate:** standard + security checklist
- **Effort:** S
- **Bootstrap exception (per `INFRASTRUCTURE.md §8 rule 3`):** Keycloak's `KC_DB_URL` lives in Orca env (not Infisical) because both run on `vm-edge` and we'd otherwise have a circular bootstrap dependency.
### M3.2 — Stalwart transactional email
- **Depends on:** M0.3 (needs DNS records under our control), M3.1
- **Repos:** `platform/breakpilot-control`
- **Deliverables:**
- **Stalwart** on `vm-control` (Orca-managed); reachable at `mail.breakpilot.com`.
- DNS records added to the zone in M0.3: `mail` A record, MX → mail, SPF (`v=spf1 mx -all`), DKIM (Stalwart-generated public key), DMARC (`p=quarantine; rua=mailto:dmarc@breakpilot.com`), reverse DNS (PTR) configured at the cloud provider for the vm-control public IP — coordinate with vm-edge since outbound mail must egress from a host with a clean PTR.
- SMTP submission service account per platform sender: `noreply@`, `oncall@`, `support@`, `billing@`, `dmarc@`.
- Outbound queue and bounce handler; failed deliveries surface as audit events.
- Webhook receiver at `/inbound/postmaster` for bounce/complaint feedback loops (Gmail FBL, MS SNDS).
- **IP warming plan**: write a `platform/docs/runbooks/email-warming.md` documenting the 4–8 week ramp from low daily volumes; first 2 weeks of trial nudges (M12.2) explicitly throttled.
- **Acceptance:** test email from `noreply@breakpilot.com` to `parnerkarsharang@gmail.com` lands in inbox (not spam) on day 1; SPF/DKIM/DMARC all "pass" in Gmail's "show original" view; mail-tester.com score ≥ 9/10.
- **Tests:** automated daily mail-tester check (failure pages on-call); bounce-handling integration test.
- **Gate:** standard + security checklist + manual deliverability sign-off (DKIM keys are load-bearing)
- **Effort:** L (deliverability tuning is the long tail)
**Phase 0 exit criteria:**
- `vm-app-stage` boots cold from cron-driven nightly stop/start using only `INFRASTRUCTURE.md §5` ordering; `breakpilot-edge` and `breakpilot-control` clusters remain warm throughout (no nightly cycling for identity / control).
- A synthetic HTTPS request to `https://hello.stage.breakpilot.com` reaches a stub container on `vm-app-stage`.
- Restore drill on `vm-app-prod` Postgres (`pg-app`) and `vm-control` Postgres (`pg-keycloak`, `pg-mariadb`) both succeed end-to-end.
- All three cluster repos (`platform/breakpilot-edge`, `platform/breakpilot-control`, `platform/breakpilot-app`) have green CI on main and a successful `make validate`.
--- ---
## 3. Phase 1 — Control plane core (M4.x – M5.x) ## 4. Production (separate plan, after M-MIG-8)
**Goal:** Tenant Registry stores tenants; the portal authenticates a user and resolves their tenant. No products surfaced yet. Book `bp-platform-prod`, join as agent over the private network, realm `breakpilot-prod`, projects `*-prod`, A records `app`, `registry`, `licence`, `pruefwerk`, `firmwerk`; wire the live ERPNext (`tenant_id` custom field, API user `platform-registry`, Frappe Webhooks with HMAC — `ERP/03` Phase 5 *live* steps); `prod` branch webhooks; deployer-token handling per RISK-2; demo tenant on prod; go-live checklist from `PRODUCT_INTEGRATION_SPEC.md §13` per product.
### M4.1 — Tenant Registry: schema + migrations
- **Depends on:** M1.2, M2.2
- **Repos:** `platform/tenant-registry`
- **Deliverables:** Go service scaffold; `golang-migrate` migrations for `tenants`, `tenant_projects`, `tenant_products`, `tenant_idp_config`, `api_keys`, `audit_log` per `PLATFORM_ARCHITECTURE.md §5c`; the `tenant.status` enum + `tenant.kind` column from the lifecycle spec.
- **Acceptance:** `make migrate-up` on a fresh Postgres produces the documented schema.
- **Tests:** migration up/down round-trip via `testcontainers-go`.
- **Gate:** standard
- **Effort:** M
### M4.2 — Tenant Registry: REST API
- **Depends on:** M4.1
- **Repos:** `platform/tenant-registry`
- **Deliverables:** OpenAPI 3.1 spec at `/openapi.yaml`; endpoints `POST /tenants`, `GET /tenants/:id`, `POST /tenants/:id/activate`, `POST /tenants/:id/cancel`, `GET /catalog`, `POST /catalog/request`, `POST /catalog/trial-request`, `POST /api-keys`, `POST /internal/api-keys/verify`, `POST /audit`, `GET /audit`.
- **Acceptance:** every endpoint passes the OpenAPI contract test; returns documented errors for invalid input.
- **Tests:** integration tests against real Postgres for every endpoint.
- **Gate:** standard
- **Effort:** L
### M4.3 — Tenant Registry: Keycloak adapter
- **Depends on:** M4.2, M2.2
- **Repos:** `platform/tenant-registry`
- **Deliverables:** package `internal/keycloak` that creates orgs, invites IT_ADMIN users, sets realm roles, and serves the protocol-mapper claims endpoint (the URL Keycloak hits during token issuance from M2.2).
- **Acceptance:** creating a tenant via `POST /tenants` provisions a Keycloak org and one IT_ADMIN user; user receives invite email.
- **Tests:** integration test against the stage Keycloak.
- **Gate:** standard
- **Effort:** M
### M5.1 — Portal scaffold: subdomain routing + OIDC login
- **Depends on:** M2.2, M4.3, M0.3
- **Repos:** `platform/portal`, `platform/design-tokens`
- **Deliverables:** Next.js 15 app on `vm-control`; middleware reads `Host` → extracts slug → calls Tenant Registry `GET /tenants?slug=` → injects tenant context; Keycloak OIDC login; logout; `design-tokens` package consumed by portal.
- **Acceptance:** visiting `https://acme.stage.breakpilot.com` redirects to Keycloak; after login, user lands on `/acme/dashboard` (empty page) with valid session.
- **Tests:** Playwright e2e: login + logout for an existing test tenant.
- **Gate:** standard
- **Effort:** M
### M5.2 — Portal: dashboard + backstage shells
- **Depends on:** M5.1
- **Repos:** `platform/portal`
- **Deliverables:** customer dashboard route `/[slug]/dashboard` (renders product tiles from JWT `products` claim — empty initially), backstage routes per `PLATFORM_ARCHITECTURE.md §5a` skeleton, RBAC enforcement (§5a "Operating principles" — hide what user can't access), session refresh.
- **Acceptance:** user with `org_roles=[USER]` cannot see settings or billing links; backstage routes return 403 for non-`BREAKPILOT_ADMIN` users.
- **Tests:** Playwright spec per role × route matrix.
- **Gate:** standard
- **Effort:** M
### M5.3 — Playwright e2e harness
- **Depends on:** M5.2
- **Repos:** `platform/portal`
- **Deliverables:** Playwright config that runs against `stage.breakpilot.com` post-deploy; CI job `e2e-stage` triggered after stage deploy; failure pages on-call.
- **Acceptance:** breaking change to login is caught in CI within 10 min of merge.
- **Tests:** the suite itself.
- **Gate:** standard
- **Effort:** S
**Phase 1 exit criteria:**
- A tenant created via `POST /tenants` results in a working login flow at `<slug>.stage.breakpilot.com`.
- All Phase 1 routes have a passing Playwright spec running on every stage deploy.
--- ---
## 4. Phase 2 — Existing product uplift (M6.x – M7.x, parallel) ## 5. Cross-cutting work (ongoing)
**Goal:** CERTifAI and breakpilot-compliance both honour the JWT contract and surface a real product tile in the portal. Regression tests first; security review per milestone (`cargo audit`, `npm audit`, `semgrep`); DR drill at M-MIG-8; doc currency (PR template tick); OSS swap-in readiness per `PRODUCT_INTEGRATION_SPEC.md §15`.
### M6.1 — CERTifAI: org_id scoping at DB layer
- **Depends on:** M2.2
- **Repos:** `benjamin_boenisch/certifai`
- **Deliverables:** MongoDB middleware that requires `org_id` on every query; backfill script for existing collections; per-tenant collection-level role checks (`IT_ADMIN` → Admin, etc.).
- **Acceptance:** integration test attempting a cross-tenant read returns `403`; existing single-tenant flows still work for tenant `default`.
- **Tests:** unit + integration; regression tests for every existing controller.
- **Gate:** standard + security checklist
- **Effort:** L (4–6 weeks per prior gap analysis)
### M6.2 — CERTifAI: JWT validation + role mapping
- **Depends on:** M6.1
- **Repos:** `benjamin_boenisch/certifai`
- **Deliverables:** Keycloak JWKS validation middleware; role mapping per `PLATFORM_ARCHITECTURE.md §6`; tenant_status middleware (returns 402 on writes when `frozen`, 410 when `archived`, allows demo with no metering).
- **Acceptance:** all four `tenant.status` states behave per spec; tested against a stage Keycloak.
- **Tests:** integration tests per status value.
- **Gate:** standard + security checklist
- **Effort:** M
### M6.3 — CERTifAI: manifest + integration assets
- **Depends on:** M6.2
- **Repos:** `benjamin_boenisch/certifai`
- **Deliverables:** `product.manifest.yaml` per `PRODUCT_INTEGRATION_SPEC.md §10` published to `cdn.breakpilot.com`; OpenAPI 3.1 spec; `/v1/health`, `/v1/usage`, `/v1/tenants/:id/export`, `DELETE /v1/tenants/:id/data`, `POST /v1/tenants/demo/reset`; web component `certifai-dashboard` per §5.A.
- **Acceptance:** CERTifAI appears in the portal catalog; subscribed tenants can open it from the dashboard.
- **Tests:** contract test that manifest validates against schema; web component renders inside portal shadow-DOM host.
- **Gate:** standard
- **Effort:** L
### M7.1 — Compliance: JWT validation upgrade
- **Depends on:** M2.2
- **Repos:** `benjamin_boenisch/breakpilot-compliance`
- **Deliverables:** Next.js proxy validates JWT against Keycloak JWKS (replacing today's `X-Tenant-ID` trust); tenant_status middleware as in M6.2.
- **Acceptance:** spoofing `X-Tenant-ID` without a JWT returns 401; valid JWT for tenant A cannot read tenant B data.
- **Tests:** integration tests for both auth and status states.
- **Gate:** standard + security checklist
- **Effort:** M (3–5 weeks per prior gap analysis)
### M7.2 — Compliance: manifest + integration assets
- **Depends on:** M7.1
- **Repos:** `benjamin_boenisch/breakpilot-compliance`
- **Deliverables:** same endpoint set as M6.3; web component (existing React → `@r2wc/react-to-web-component` per §5.A); manifest with `supports_projects: true` (already implemented).
- **Acceptance:** compliance appears in portal catalog; opens from dashboard; project switching works inside the product.
- **Tests:** as M6.3.
- **Gate:** standard
- **Effort:** M
**Phase 2 exit criteria:**
- A real tenant on stage can subscribe to both products and use them through the portal.
- Cross-product audit at `/[slug]/audit` shows events from both products in the Retraced schema.
--- ---
## 5. Phase 3 — Business operations (M8.x – M9.x) ## 6. Dependency graph
**Goal:** ERPNext and Frappe HD run, Sales Order → tenant activate works, tickets escalate to Gitea.
### M8.1 — ERPNext deployment
- **Depends on:** M1.2, M2.1
- **Repos:** `platform/breakpilot-control`
- **Deliverables:** Frappe + ERPNext on `vm-control` (separate Postgres database from tenant_registry — see `INFRASTRUCTURE.md` RISK-1); reached at `erp.breakpilot.com`; Keycloak OIDC; IP-restricted at Orca-Proxy.
- **Acceptance:** us login works; a Customer record can be created manually.
- **Tests:** smoke test for OIDC; backup of Frappe filestore validated.
- **Gate:** standard + manual sign-off (touches `vm-control` resources)
- **Effort:** M
### M8.2 — ERPNext customization
- **Depends on:** M8.1
- **Repos:** `platform/breakpilot-control` (`erpnext-app/` subdir under the cluster repo)
- **Deliverables:** custom Frappe app with: `tenant_id` field on `Customer`; `sales_owner` field on `Lead`; server scripts for the Sales Order → Tenant Registry webhook; `Cancel` workflow that calls Tenant Registry `/cancel`.
- **Acceptance:** submitting a Sales Order in ERPNext triggers a tenant activation in stage Tenant Registry.
- **Tests:** server-script unit tests (Frappe test harness); integration test exercises the full webhook.
- **Gate:** standard
- **Effort:** M
### M8.3 — Self-serve billing (Polar.sh)
- **Depends on:** M8.1, M5.2
- **Repos:** `platform/portal`, `platform/tenant-registry`
- **Deliverables:**
- Polar.sh organization + products configured for Starter / Professional / per-seat tiers.
- Polar Checkout embedded in portal `/[slug]/billing/upgrade`.
- Webhook listener at `tenant-registry /polar/webhook` (HMAC-verified) handles `subscription.created`, `subscription.updated`, `subscription.canceled`, `order.paid` → flips `tenant.status`, mirrors the customer + invoice into ERPNext via REST.
- Polar acts as Merchant of Record — they handle EU VAT MOSS, no per-country tax registration needed for our side.
- Portal billing page reads invoices from ERPNext (single source of truth for accounting) but links out to Polar's customer portal for payment-method management.
- **Acceptance:** signing up self-serve creates a tenant, a Polar subscription, an ERPNext Customer + Invoice, and a usable login; VAT line item appears correctly on the EU customer's invoice.
- **Tests:** integration test against Polar sandbox; webhook replay test; tax calculation correct for at least DE, FR, NL, US.
- **Gate:** standard + security checklist
- **Effort:** L
> **Why Polar.sh over Stripe / Lemon Squeezy:** OSS-aligned, Merchant of Record (handles EU VAT MOSS automatically), developer-first, 4% + Stripe fees vs. Lemon's 5%. Stripe direct would require us to register for VAT in 27 countries — not viable for a 2-person team. See [[self-hosted-oss-first]].
### M9.1 — Frappe Helpdesk
- **Depends on:** M8.1
- **Repos:** `platform/breakpilot-control`
- **Deliverables:** Frappe HD on the same Frappe bench; customer portal embedded at `/[slug]/support/`.
- **Acceptance:** a customer user can submit a ticket; we receive it.
- **Tests:** Playwright spec for ticket submission.
- **Gate:** standard
- **Effort:** S
### M9.2 — HD → Gitea escalation
- **Depends on:** M9.1
- **Repos:** `platform/breakpilot-control` (`erpnext-app/` subdir)
- **Deliverables:** server script that on a `Ticket: Escalate to Engineering` action creates a Gitea issue in the matching repo via Gitea REST API; reverse webhook from Gitea on issue close marks ticket resolved.
- **Acceptance:** the round-trip works for a test ticket on stage.
- **Tests:** integration test against stage Gitea.
- **Gate:** standard
- **Effort:** S
**Phase 3 exit criteria:**
- ERPNext is the source of truth for billing/CRM/HR.
- The full Lead → Quote → Sales Order → Tenant chain works on stage.
---
## 6. Phase 4 — Customer UX & lifecycle (M10.x – M14.x)
**Goal:** Every customer-facing flow from `PLATFORM_ARCHITECTURE.md` works end-to-end on stage.
### M10.1 — Customer area: full surfaces
- **Depends on:** M5.2, M6.3, M7.2
- **Repos:** `platform/portal`
- **Deliverables:** real implementations of `/[slug]/dashboard`, `/[slug]/products/*`, `/[slug]/projects`, `/[slug]/settings/{identity,users,api-keys,integrations}`, `/[slug]/billing`, `/[slug]/audit`, `/[slug]/support`.
- **Acceptance:** every route is implemented, RBAC-gated, with empty/loading/error states.
- **Tests:** one Playwright spec per route × primary role.
- **Gate:** standard
- **Effort:** L
### M10.2 — Cross-product audit view
- **Depends on:** M10.1, M4.2
- **Repos:** `platform/portal`
- **Deliverables:** audit page filters by product/actor/action/time; CSV + PDF export; events rendered from the Retraced-shape schema.
- **Acceptance:** a DPO-style query ("show me everything user X did across all products last month") returns in <2s for a tenant with 100k events.
- **Tests:** load test with synthetic events.
- **Gate:** standard + security checklist
- **Effort:** M
### M11.1 — Catalog flow (P13)
- **Depends on:** M4.2, M10.1
- **Repos:** `platform/portal`, `platform/tenant-registry`
- **Deliverables:** `/[slug]/catalog` UI per `PLATFORM_ARCHITECTURE.md` P13; "Request" button creates ERPNext CRM Lead.
- **Acceptance:** customer requests a non-subscribed product; sales sees a Lead in ERPNext with the right `sales_owner`.
- **Tests:** Playwright e2e covering the full P13 sequence.
- **Gate:** standard
- **Effort:** M
### M12.1 — Self-serve trial (P15)
- **Depends on:** M8.3, M11.1
- **Repos:** `platform/portal`, `platform/tenant-registry`
- **Deliverables:** public `/start` form; trial tenant provisioning (status=trial, trial_ends_at); banner; trial_quota enforcement (read by products from JWT).
- **Acceptance:** prospect signs up; trial tenant with 14-day timer exists; quota enforced.
- **Tests:** Playwright e2e signs up → uses → hits quota.
- **Gate:** standard
- **Effort:** M
### M12.2 — Trial lifecycle cron + emails
- **Depends on:** M12.1, M3.2 (Stalwart must be deliverability-clean)
- **Repos:** `platform/tenant-registry`
- **Deliverables:** scheduler in tenant-registry that runs day-7/12/14 emails; status transitions trial → active (on payment) or trial → frozen → archived; SMTP via Stalwart at `mail.breakpilot.com:587`; sender `noreply@breakpilot.com`; HTML + plaintext templates committed under `tenant-registry/templates/email/`; List-Unsubscribe headers per RFC 8058.
- **Acceptance:** in a time-warped stage test (script that advances `trial_ends_at`), all transitions fire in order and all three emails land in Gmail inbox.
- **Tests:** integration test with time injection; deliverability spot-check at each release.
- **Gate:** standard
- **Effort:** M
### M13.1 — Demo tenant seeding
- **Depends on:** M6.3, M7.2
- **Repos:** `platform/seed-data`
- **Deliverables:** per-product fixture archives (`certifai/seed-v1.tar.gz`, `compliance/seed-v1.tar.gz`); publishing pipeline to `cdn.breakpilot.com`; `catalog.demo.seed_data_url` populated in product manifests.
- **Acceptance:** calling `POST /v1/tenants/demo/reset` on either product restores fixtures.
- **Tests:** integration test asserts fixture state after reset.
- **Gate:** standard
- **Effort:** M
### M13.2 — Sales demo flow (P14)
- **Depends on:** M2.2, M13.1
- **Repos:** `platform/portal`, `platform/tenant-registry`
- **Deliverables:** demo tenant created in stage and prod with `kind=demo, status=demo`; SALES_REP role usable; backstage routes restricted to `/backstage/leads` and `/backstage/demo`; demo tenant audit events tagged `{"demo": true}` and hidden from real-tenant audit views.
- **Acceptance:** sales rep logs in at `demo.breakpilot.com`, walks both products live, [Request Trial] modal creates a CRM Lead with `sales_owner = the rep`.
- **Tests:** Playwright e2e for the sales walk-through.
- **Gate:** standard + security checklist (SALES_REP guardrail enforcement is the load-bearing piece)
- **Effort:** M
### M13.3 — Nightly demo reset
- **Depends on:** M13.2
- **Repos:** `platform/tenant-registry`
- **Deliverables:** cron at 03:00 Europe/Berlin calls each product's reset endpoint; failures page on-call.
- **Acceptance:** after a deliberately-corrupted demo state, the next 03:00 reset restores fixtures.
- **Tests:** test runs the reset manually + verifies fixture state.
- **Gate:** standard
- **Effort:** S
### M14.1 — Cancel + frozen state (P16 part 1)
- **Depends on:** M10.1, M6.2, M7.1
- **Repos:** `platform/portal`, `platform/tenant-registry`
- **Deliverables:** cancel modal with reason + typed-confirm; status active → frozen transition; Stripe `cancel_at_period_end`; ERPNext Opportunity → Lost; reactivation path within 30 days.
- **Acceptance:** test customer cancels; portal switches to read-only; reactivate restores `active` status without data loss.
- **Tests:** Playwright e2e covering cancel + reactivate.
- **Gate:** standard + security checklist
- **Effort:** M
### M14.2 — Offboarding cron + final export (P16 part 2)
- **Depends on:** M14.1, M6.3, M7.2
- **Repos:** `platform/tenant-registry`
- **Deliverables:** day-30 cron builds final export ZIP per product, emails signed URL (7-day TTL), calls `DELETE /v1/tenants/:id/data` on every subscribed product, archives Keycloak org, marks `tenant.status = archived`.
- **Acceptance:** time-warped test runs the full P16 sequence end-to-end on stage; export ZIP contains data from both products; second post-archive request to either product returns 410.
- **Tests:** integration test with time injection; GDPR-compliance regression suite added.
- **Gate:** standard + security checklist + manual sign-off (irreversible operation)
- **Effort:** L
**Phase 4 exit criteria:**
- Every flow P1–P16 from `PLATFORM_ARCHITECTURE.md` has a passing Playwright spec.
- Stage runs a full lifecycle: sign-up trial → convert → use → cancel → offboard, in an automated nightly job.
- We can hand a prospect a real demo using `demo.breakpilot.com`.
---
## 7. Phase 5 — Headless products (M15.x – M17.x)
**Goal:** Make the platform host products with no UI of their own.
### M15.1 — API key infrastructure
- **Depends on:** M4.2, M10.1
- **Repos:** `platform/tenant-registry`, `platform/portal`
- **Deliverables:** API key CRUD per `PRODUCT_INTEGRATION_SPEC.md §6.2`; portal UI at `/[slug]/settings/api-keys`; `POST /internal/api-keys/verify` for products.
- **Acceptance:** create key in portal; product call with key succeeds; revoke kills access within 60s.
- **Tests:** integration tests for verify endpoint; Playwright for portal UI.
- **Gate:** standard + security checklist (rotation + scope enforcement)
- **Effort:** M
### M15.2 — Webhook delivery
- **Depends on:** M15.1
- **Repos:** `platform/tenant-registry`, `platform/portal`
- **Deliverables:** webhook config + delivery service per `PLATFORM_ARCHITECTURE.md` H4; portal page `/[slug]/integrations`; signed payloads; 3-attempt retry with backoff; dead-letter visible at `/webhooks/deliveries`.
- **Acceptance:** test webhook to https://requestbin.com works; failed deliveries appear in dead letter.
- **Tests:** integration tests with a local sink.
- **Gate:** standard
- **Effort:** M
### M16.1 — First headless product reference implementation
- **Depends on:** M15.2
- **Repos:** TBD (proof-of-concept can live in `platform/docs/examples/headless-template/`)
- **Deliverables:** a minimal headless product (e.g., echo-bot) that implements the full §5.C contract: manifest, API, audit emit, usage emit, demo reset, GDPR endpoints.
- **Acceptance:** echo-bot is bookable from catalog, works end-to-end, passes the same lifecycle test as Phase 4.
- **Tests:** the lifecycle e2e from M14.2 extended to include echo-bot.
- **Gate:** standard
- **Effort:** M
### M17.1 — MCP servers (Enterprise)
- **Depends on:** M6.3, M7.2
- **Repos:** `benjamin_boenisch/certifai`, `benjamin_boenisch/breakpilot-compliance`
- **Deliverables:** MCP endpoints per `PRODUCT_INTEGRATION_SPEC.md §10` `mcp:` block; gated on `plan == enterprise`; routed via `mcp.breakpilot.com`.
- **Acceptance:** Claude Code can connect to `mcp.breakpilot.com/certifai` with a service token and call `list_ai_agents`.
- **Tests:** MCP contract test using `mcp-cli`.
- **Gate:** standard + security checklist
- **Effort:** L
**Phase 5 exit criteria:**
- A third-party (or us) can add a new headless product by following `PRODUCT_INTEGRATION_SPEC.md` and a referenced template, with no portal code changes required.
---
## 8. Phase 6 — Enterprise + scale (M18.x – M19.x)
These ship only when a paying customer requires them.
### M18.1 — Custom domains
- **Depends on:** M0.3, M10.1
- **Repos:** `platform/breakpilot-edge` (Orca-Proxy ACME), `platform/portal` (UI)
- **Deliverables:** ACME on-demand TLS in Orca-Proxy; portal UI for customer to add domain; CNAME verification.
- **Acceptance:** `compliance.acme.com` resolves and renders the Acme portal.
- **Tests:** integration test with a synthetic domain.
- **Gate:** standard
- **Effort:** M
### M18.2 — Physical data isolation
- **Depends on:** M4.1, M6.1, M7.1
- **Repos:** all app-plane products + `platform/tenant-registry`
- **Deliverables:** option per tenant for a dedicated Postgres / Mongo schema or database; provisioning automation; migration path from logical → physical.
- **Acceptance:** an enterprise tenant runs on a dedicated schema; cross-tenant queries are physically impossible.
- **Tests:** isolation enforcement test.
- **Gate:** standard + security review + manual sign-off
- **Effort:** L
### M19.1 — A/B testing infra
- **Depends on:** anywhere `featureFlags.evaluate()` is called
- **Repos:** new `platform/feature-flags` (Unleash on `vm-control` or hosted) + portal SDK shim
- **Deliverables:** swap the hard-coded `evaluate()` from §1.12 to call Unleash; eval results land in audit events for reproducibility.
- **Acceptance:** flipping a flag in Unleash changes behaviour for the targeted tenant set within 30s; no behavior change for other tenants.
- **Tests:** integration test asserts flag-driven branches.
- **Gate:** standard
- **Effort:** M
---
## 9. Cross-cutting work (every phase, ongoing)
These are not milestones — they are commitments enforced by CI and process.
- **Regression suite expansion.** Every bug fix lands with a regression test FIRST. Tracked by `tests-added` label on PRs; fix-without-test PRs are rejected by reviewer.
- **Security review per phase.** End of each phase: dependency audit (`cargo audit`, `npm audit`, `pip-audit`), SAST scan (`semgrep`), threat model update in `platform/docs/security/`.
- **Disaster-recovery drills.** Once per phase on stage: pick one scenario from `INFRASTRUCTURE.md §10`, run it, document time-to-recover in the runbook.
- **Doc currency.** PR template requires the author to tick "docs updated" or "n/a" — CI fails on a missing tick.
- **OSS swap-in readiness.** When adding metering / audit / SCIM / flag eval code, use the schema/interface noted in `PRODUCT_INTEGRATION_SPEC.md §15` so swap-in stays cheap.
---
## 10. First-PR checklist for Claude Code
When starting work, the first sequence of PRs should be:
1. **PR-1** (M0.1): Create `platform/docs` with copied architecture docs + this plan. Land in 1 day.
2. **PR-2 to PR-7** (M0.1 continued): Bootstrap each of the other five repos with §1.2 scaffolding. Land in parallel.
3. **PR-8** (M0.2): CI templates + branch protection per repo.
4. **PR-9** (M1.1): `orca-platform` directory layout + first stub manifest.
5. **PR-10** (M1.2): VM provisioning + cluster-repo split. Per the 2026-06-30 decision: 4 VMs across 3 clusters (`vm-edge` in `breakpilot-edge`, `vm-control` in `breakpilot-control`, `vm-app-prod` + `vm-app-stage` in `breakpilot-app`). Spin up `vm-edge` first since DNS, Keycloak, and Infisical all live there. **Gated on legal entity** (cannot sign SysEleven / Hetzner business contracts before).
6. **PR-11** (M0.3): PowerDNS on vm-edge + zone file + registrar NS delegation + wildcard TLS via Let's Encrypt DNS-01.
After PR-11, the dependency graph fans out and parallel work begins.
For each PR, Claude Code MUST:
- Open the PR with the §1.4 template filled in.
- Link the milestone ID in PR body (`Linked milestone: M0.1`).
- Wait for human approval (no self-merge — branch protection enforces).
- After merge: verify the stage deploy succeeds before starting the next dependent PR.
---
## 11. Dependency graph
``` ```
┌── M6.1 ── M6.2 ── M6.3 ──┐ M-MIG-0 ──┬── M-MIG-1 (specs, parallel)
│ │ ├── M-MIG-2 (stop on core) ─────────────────────────────────────────┐
┌── M2.1 ── M2.2 ────────┤ ├── M10.1 ── M10.2 ├── M-MIG-3 (stage VM + cluster) ──┐ │
│ │ │ │ └── M-MIG-4 (repo moves) ──────────┴── M-MIG-5 ── M-MIG-6 ── M-MIG-7 ── M-MIG-8 ── M-MIG-9
M0.1 ── M0.2 ── M1.1 ──┼── M1.2 ── M0.3 ── M1.3 │ │ ├── M11.1 ── M12.1 ── M12.2 │
│ │ │ │ │ │ production plan
│ └── M3.1 ── M3.2 │ ├── M13.2 ── M13.3 │
│ │ │ │ │
└─────────────────────── M4.1 ── M4.2 ── M4.3 ── M5.1 ── M5.2 ── M5.3 M13.1 │
│
M8.1 ── M8.2 ── M8.3 ── M9.1 ── M9.2 ──────────────────────┤
│
M15.1 ── M15.2 ── M16.1 ── M17.1 │
│
M14.1 ── M14.2
Phase-6 (M18, M19) depends on Phase-4 completion + a paying customer.
M12.2 depends on M3.2 (Stalwart deliverability must be clean before trial emails go out).
``` ```
**Critical path** (longest chain to first paying customer): **Critical path:** M-MIG-0 → M-MIG-3 → M-MIG-5 → M-MIG-6 → M-MIG-7 → M-MIG-8. With one agent and standard review pacing: **6–9 weeks** to a passing staging gate. M-MIG-1, M-MIG-2 and M-MIG-4 run in parallel with M-MIG-3.
`M0.1 → M0.2 → M1.1 → M1.2 → M0.3 → M1.3 → M2.1 → M2.2 → M4.1 → M4.2 → M4.3 → M5.1 → M5.2 → M6.2 → M6.3 → M10.1 → M11.1 → M12.1`
That's 18 milestones. With one full-time agent and standard human review pacing, plan for **9–13 weeks** to first paying customer flow on stage (added 1 week for the PowerDNS / DNS-delegation cycle vs. the prior Cloudflare path); **+2–4 weeks** for prod hardening and the Phase-4 lifecycle completion.
> **Note on M3.2 critical path:** Stalwart IP warming (4–8 weeks) runs in *background parallel* — start it immediately after M3.1 so warming finishes before M12.2 needs it. It is NOT on the critical path for first paying customer (that customer can be onboarded by hand), but it IS on the critical path for self-serve trial volume.
**Parallelism opportunities:**
- M6.x and M7.x can run fully in parallel (different repos, different stacks).
- M8.x is independent of all app-plane work once M2.2 is done.
- M15.x can begin as soon as M10.1 lands.
--- ---
## 12. Open questions to resolve before starting ## 7. Open questions
**Resolved:** - **Pitch-deck's home** (shares the dsms Postgres): move with dsms or split the database first? Decide before M-MIG-9.
- ~~Email provider~~ → **Stalwart**, self-hosted on vm-control. Plan in M3.2; 4–8 week IP warming acknowledged. - **Gitea Actions runner location** (not an Orca service; verify in M-MIG-0) and whether a second runner should live on the platform master for isolation.
- ~~Stripe vs Lemon Squeezy~~ → **Polar.sh**. Plan in M8.3. - **Second backup provider** for the platform bucket (3-2-1) before production.
- ~~Cloudflare account ownership~~ → not used; DNS is self-hosted via PowerDNS on vm-edge (M0.3). Registrar account (Benjamin's) still needs documented 2FA recovery — see new DR item below. - **Prüfwerk crate/binary renames** (`compliance-*` → `pruefwerk-*`) and the Mongo prefix: cosmetic, deferred; the Mongo prefix rename is a data migration.
- **`DR-WS-08 §6B` role mapping** remains open; staging uses the V1 `org_roles` model.
**Still open:** - **ERP Phase 0/1** (Steuerberater, SKU import) proceed independently on the live ERPNext; the platform only needs the SKU codes, which are already fixed in the SKU sheet.
- **CDN host** for `cdn.breakpilot.com`: self-hosted MinIO + Caddy on vm-edge is the OSS-aligned default; alternative is BunnyCDN (cheap, EU). Decide before M6.3 (manifest bundles + hero images).
- **Cloud provider for port 25 outbound.** Stalwart needs unblocked port 25 to send mail. Hetzner blocks by default and requires a request to unblock with proof of intent + abuse contact; OVH and Scaleway unblock on request faster. Confirm with Benjamin which provider vm-control runs on. Block on M3.2 if port 25 is unblockable — fallback is sending via a different provider's IP with reverse DNS.
- **Test data privacy.** The demo tenant must contain ONLY synthetic data — confirm seed pipeline strips real PII even if our test orgs accidentally seed from prod.
- **Registrar + DNS bus-factor.** Document who owns the registrar account, who has 2FA recovery codes, and the procedure to update NS records without that person available. Goes in `platform/docs/runbooks/dr.md` before M0.3 ships.
- **Internal CA.** `step-ca` listed in INFRASTRUCTURE.md vm-edge as "optional" — decide whether inter-service mTLS is in scope for Phase 0 or deferred until Phase 4 (Enterprise tier).
--- ---
*End of document. Open items in §12 should be triaged before M0.1 starts; the bus-factor and port-25 items are the only hard blockers.* *End of document. Revised 2026-09-11.*
+351 -660
View File
File diff suppressed because it is too large. Load diff
+358 -955
View File
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
+13 -13
View File
@@ -2,20 +2,20 @@
Platform-wide architecture, integration spec, runbooks. Platform-wide architecture, integration spec, runbooks.
> Part of the **Breakpilot Platform**. For the big picture see [`platform/docs`](https://gitea.meghsakha.com/platform/docs): > Part of the **Breakpilot Platform**. For the big picture see [`platform/docs`](https://git.breakpilot.com/platform/docs):
> [Architecture](https://gitea.meghsakha.com/platform/docs/src/branch/main/PLATFORM_ARCHITECTURE.md) · > [Architecture](https://git.breakpilot.com/platform/docs/src/branch/main/PLATFORM_ARCHITECTURE.md) ·
> [Infrastructure](https://gitea.meghsakha.com/platform/docs/src/branch/main/INFRASTRUCTURE.md) · > [Infrastructure](https://git.breakpilot.com/platform/docs/src/branch/main/INFRASTRUCTURE.md) ·
> [Product Integration Spec](https://gitea.meghsakha.com/platform/docs/src/branch/main/PRODUCT_INTEGRATION_SPEC.md) · > [Product Integration Spec](https://git.breakpilot.com/platform/docs/src/branch/main/PRODUCT_INTEGRATION_SPEC.md) ·
> [Implementation Plan](https://gitea.meghsakha.com/platform/docs/src/branch/main/IMPLEMENTATION_PLAN.md) > [Implementation Plan](https://git.breakpilot.com/platform/docs/src/branch/main/IMPLEMENTATION_PLAN.md)
## What this is ## What this is
Platform-wide architecture, integration spec, runbooks. Scaffolded under milestone M0.1. See [`platform/docs`](https://gitea.meghsakha.com/platform/docs) for the full architecture context. Platform-wide architecture, integration spec, runbooks. Scaffolded under milestone M0.1. See [`platform/docs`](https://git.breakpilot.com/platform/docs) for the full architecture context.
**Plane:** Control **Plane:** Control
**Owner:** @sharang **Owner:** @sharang
**Status:** pre-alpha **Status:** pre-alpha
**Linked milestone:** [M0.1](https://gitea.meghsakha.com/platform/docs/src/branch/main/IMPLEMENTATION_PLAN.md) **Linked milestone:** [M0.1](https://git.breakpilot.com/platform/docs/src/branch/main/IMPLEMENTATION_PLAN.md)
## Run locally ## Run locally
@@ -36,17 +36,17 @@ For IaC: list the make targets.}}
## Deployment ## Deployment
| Env | URL | How | | Env | URL / host | How |
|---|---|---| |---|---|---|
| dev | `http://localhost:3000` | `make dev` | | dev | `http://localhost:3000` | `make dev` |
| stage | `https://docs.stage.breakpilot.com` | auto on merge to `main` | | stage | `app-stage.breakpilot.com` (portal) · `<product>-stage.breakpilot.com` (product UI) · internal for services without a UI | auto on merge to `main` (CI → Harbor → signed webhook → `orca redeploy <svc>-stage`) |
| prod | `https://docs.breakpilot.com` | manual: tag `vX.Y.Z` + sign-off | | prod | `app.breakpilot.com` · `<product>.breakpilot.com` | tag `vX.Y.Z` + sign-off → `prod` branch webhook → `orca redeploy <svc>-prod` |
Rollback: `orca rollout undo docs --env={{env}}`. Tenants are addressed by path (`/[slug]/…`), never by subdomain. Rollback: `orca rollback <svc>-{{env}}` (previous image) on the platform master. No `docs.breakpilot.com` — this repo is documentation only and is not deployed.
## Observability ## Observability
- Traces, logs, metrics: [SigNoz](https://signoz.meghsakha.com) — service name `docs` - Traces, logs, metrics: [SigNoz](https://signoz.breakpilot.com) — service name `docs`
- Audit events: Tenant Registry `/audit` (Retraced-shape schema) - Audit events: Tenant Registry `/audit` (Retraced-shape schema)
- On-call: `oncall@breakpilot.com` · runbook at `platform/docs/runbooks/docs.md` - On-call: `oncall@breakpilot.com` · runbook at `platform/docs/runbooks/docs.md`