Staging runs without browserless / soft-plc / plc-sim; Werkbank runner optional; memory caps ≈ 6.1 GB. Cost plan and M-MIG-3 updated to match. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
22 KiB
Implementation Plan — Breakpilot Platform
Companion to PLATFORM_ARCHITECTURE.md, INFRASTRUCTURE.md, PRODUCT_INTEGRATION_SPEC.md and ERP/03 Implementation Plan.
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
- Each milestone ships independently and leaves the system in a working state; no milestone starts before the previous one's Acceptance is verified.
- "Gate": standard = 1 human reviewer + green CI; some milestones add a manual sign-off (anything that touches live systems, DNS, or is irreversible).
- Effort: S ≤ 1 day, M = 2–4 days, L ≥ 1 week.
- §1 conventions apply to every PR in every repo.
1. Cross-cutting conventions
1.1 Repo strategy
Polyrepo under the Gitea org git.breakpilot.com/platform/. One repo per deployable unit.
| Repo | Purpose | Status |
|---|---|---|
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 |
sharang/orca-infra |
IaC for the core cluster (unchanged owner; company infra) | exists |
platform/tenant-registry |
Go: tenants, catalog, entitlements, usage, licences, ERP link, audit, cmd/erpmock |
exists; extended M-MIG-5/7 |
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 |
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).
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).
1.7 Versioning + release strategy (Orca reality)
- Semver per repo. Images:
:sha-<short>and:lateston everymainbuild (Harborrepo.breakpilot.com/<project>/<image>), cosign-signed. - 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 aprodbranch that triggers the<svc>-prodwebhook. Manual sign-off before the tag. - Rollback:
orca rollback <svc>-<env>on the master (previous image). RTO ≤ 5 min. - Config changes (service files): PR → merge →
git pull && orca deployon the master (documented inorca-platform/README.md). - Database migrations forward-only, run by an init container /
migratebinary before the service starts.
1.8 Environments
| Env | Where | Keycloak realm | tenant-registry | ERPNext | Data | Deploy |
|---|---|---|---|---|---|---|
| dev | laptop, orca-platform/dev/ compose |
breakpilot-dev (local KC) |
local | mock | fixtures | n/a |
| stage | bp-platform-stage (cluster master) |
breakpilot-stage on core KC |
tenant-registry-stage + pg-stage |
erpnext-mock-stage |
synthetic + demo | auto on merge |
| prod | bp-platform-prod (agent) |
breakpilot-prod on core KC |
tenant-registry-prod + pg-prod |
live erp.breakpilot.com |
real | tag + sign-off |
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.
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.
2. What already exists (2026-09-11 baseline)
- Core cluster
breakpilot(orca-infra) with Keycloak (realmsmaster,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 (projectcertifai), and the dsms stack (projectbreakpilot-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/03Phase 0 blocked on Steuerberater; Phase 1 SKUs can start).
3. Migration milestones
M-MIG-0 — Preparation (no service changes)
- Goal: clean repos, recorded live state, cold archives, credentials ready.
- Depends on: plan approval.
- Repos:
sharang/orca-infra,platform/orca-platform, Gitea admin, Harbor. - Deliverables: commit the master's uncommitted
cluster.tomlon orca-infra and pull everywhere; discard the stale local edits in orca-platform and pullorigin/main; recordorca status,orca webhooks list,docker ps(both nodes), realm export ofbreakpilot-dev, Gitea runner host + labels; archives tos3://bp-orca-backups/archive-2026-09-platform-stop/(registrypg_dumpall,certifai-mongomongodump, tar of every portal/registry/certifai volume) with one test restore; lower Strato TTLs on the hosts that move; Gitea org secrets inplatform(REGISTRY_USER/PASS,COSIGN_KEY/PASSWORD,ORCA_WEBHOOK_SECRET_STAGE,BP_S3_*) and a bot userplatform-ciwith read access toplatform/*; Harbor projectspruefwerk,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/docsmirrors them. - Deliverables:
PLATFORM_ARCHITECTURE.md,INFRASTRUCTURE.md,IMPLEMENTATION_PLAN.md,PRODUCT_INTEGRATION_SPEC.md(2.0),COST_PLAN.md,CHANGELOG.md,Readme.mdtemplate,ERP/02,ERP/03revised;BreakPilot Infradocs updated after M-MIG-2; one mirror commit inplatform/docs. - Acceptance: grep of the Collectives tree for
*.stage.breakpilot.com,web component,widget,custom domain,SysEleven,PowerDNS,Stalwart,Stripe,Polarhits only changelog/history lines;platform/docsdiff 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 stopin order:breakpilot-portal-{acme,hello,globex,sandbox},breakpilot-portal,compliance-dashboard,compliance-docs,compliance-agent,browserless,soft-plc,plc-sim,mailserver. Keepbreakpilot-tenant-registry(+db),compliance-mcp,certifai-mongo(dsms depends on them) → moved intoservices/dsms-deps/service.toml. Remove the stopped blocks,git pull && orca deployon the master, verify prune ordocker rm -fon 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. UpdateBreakPilot InfraReadme + Service Catalog. - Acceptance:
orca status= core + dsms + dsms-deps;docker pson both nodes matches; Gatus green;https://api-dev.breakpilot.ai/healthand 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-platformcluster exists with one node servinghttps://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 networkbreakpilot-platform, Cloud Firewall perINFRASTRUCTURE.md §3; browserless / soft-plc / plc-sim are not deployed on staging, seeINFRASTRUCTURE.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 withorca install-service; repo restructure:cluster.toml(namebreakpilot-platform, ACME email, S3 backupbp-platform-backups, LiteLLM, admin + deployer tokens),services/<project>/service.tomllayout (platform-stage,pruefwerk-stage,firmwerk-stage), every service pinned + memory-limited,[security_headers] frame_options="DENY"; deleteclusters/,overlays/,dns/,manifests/,scripts/{apply,plan}.sh,release.yaml, the restore-drill stub; adaptvalidate.sh(pins ∈ {bp-platform-stage,bp-platform-prod}, memory required, secret refs project-scoped); README +WEBHOOKS.mddescribe the deploy flow; Strato A recordsapp-stage,registry-stage,pruefwerk-stage,firmwerk-stage; a hello service onapp-stage. - Acceptance:
orca statushealthy;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:
sharang/firmwerk→platform/firmwerk:README.mdpackage path; workflows.github/→.gitea/(runs-on: docker); tagv0.4.3.sharang/compliance-scanner-agent→platform/pruefwerk(transfer + rename): firmwerk git deps →platform/firmwerktagv0.4.3, importstramiton_*→firmwerk_*,cargo update; CI + 3 Dockerfiles →platform-citoken,full_name: platform/pruefwerk, images →repo.breakpilot.com/pruefwerk/*; fixfixtures/demo-targets/targets.json, vitepress config, demo-targets docs,.cargo/audit.toml,.env.example+config.rsopenplc default,dedup.rs,agent_client.rs; delete the mailserver compose; delete stale branches; remove the retired repo webhook.sharang/werkbank→platform/werkbank: Cargo deps →platform/pruefwerkat a tag;DESIGN.md; addDockerfile+.gitea/workflows/ci.yml→repo.breakpilot.com/pruefwerk/werkbank.sharang/werkpilot→platform/werkpilot:release.ymlfallback;custom_providers/litellm.json→llm.breakpilot.com.platform/tenant-registrygo.modmodule →git.breakpilot.com/platform/tenant-registry(+ imports); README/CONTRIBUTING links in registry, portal, seed-data, docs.sharang/certifai: delete its two retired webhooks only.
- Acceptance: CI green on
mainin all four repos after the move;cargo buildof werkbank and pruefwerk against the new git deps;grep -r "sharang/\|meghsakha"in the four repos returns only LICENSE/history; images visible under Harborpruefwerk/. - Gate: standard. Effort: M.
M-MIG-5 — Platform services on staging
- Goal: signup → tenant → login → catalog works at
app-stage.breakpilot.com. - Depends on: M-MIG-3, M-MIG-4 (registry module path).
- Repos:
platform/orca-platform,platform/tenant-registry,platform/portal, Keycloak (core). - Deliverables: realm
breakpilot-stagefrom an adapteddev/keycloak/realm-export.json(orgs on; clients perPLATFORM_ARCHITECTURE.md §4; scopetenant-context=tenant_id, tenant_slug, org_roles, tenant_status; device flow; roles; theme) exported toorca-platform/keycloak/breakpilot-stage.json. Registry: migration0002(productstable replacingcatalog.go, seededpruefwerk(+addonwerkbank),werkpilot,firmwerk;certifaiandcompliancekeys removed/disabled),GET /v1/tenants,POST /v1/internal/entitlements/check, per-client authorization map, inviteclient_id/redirect_urifrom env, provisioning fan-out with outbox retry,SyncClaims(tenant_status). Portal: path tenancy inmiddleware.ts/host.ts(PORTAL_APEX_HOSTS), fixtures only underBP_DEV_FIXTURE, product tiles use cataloglaunch_url,AUTH_URL. Deploy projectplatform-stage(pg-stage,tenant-registry-stage,portal-stage) with CI webhooks. - Acceptance:
/startcreates a tenant → KC org + invite mail (to a@breakpilot.comaddress); login atapp-stage.breakpilot.com/<slug>/dashboard; catalog shows three products; API key create/verify; audit entries; portal Playwright suite passes against staging. - Gate: standard + security checklist. Effort: L.
M-MIG-6 — Products on staging
- Goal: Prüfwerk (+Werkbank), Firmwerk cloud and the two CLIs run against staging with multi-tenancy.
- Depends on: M-MIG-5.
- 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; servicespruefwerk-{mongo,agent,dashboard,mcp,docs}-stageonpruefwerk-stage.breakpilot.com(+/mcp,/docs); no browserless / soft-plc / plc-sim on staging (8 GB budget); no mailserver on stage. Werkbank:werkbank-runner-stagewith a registry API key (werkbank:runner). Firmwerk:firmwerk-cloud-stage+firmwerk-mongo-stageonfirmwerk-stage.breakpilot.com; CLIv0.4.3underplatformpackages. Werkpilot: release underplatform/werkpilot. - Acceptance: tenants
acmeandglobexvia portal; Prüfwerk login per tenant; scan ofcra-vuln-demo; tenant B cannot read A's scan (404/403); MCP token bound to tenant; runner completes adastjob;firmwerkdevice login againstfirmwerk-stage; Gatus checks for the stage hosts; old volumes on core deleted afterwards. - Gate: standard + security checklist. Effort: L.
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.
- Depends on: M-MIG-6. (=
ERP/03Phase 5.) - Repos:
platform/tenant-registry,platform/portal,platform/pruefwerk,platform/firmwerk,platform/werkpilot,platform/orca-platform. - 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 aserpnext-mock-stage. Registry migration0003:plans,subscriptions,usage_events,erp_outbox,licences; ladder statuseswarning|restricted|haltedontenants.status; ERPNext client + outbox worker; HMAC webhook receiver (idempotent) + 15-min reconcile; licence endpoints (Ed25519 key in Infisicalplatform/stage/licence-signing,/.well-known/licence-keys.json, heartbeat, revoke);SyncClaimson every ladder change. Products: Prüfwerk usage events; Firmwerk cloud-server replaces its own model with registry licence verification +entitlements/check;firmwerk login/werkpilot logindevice 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. - Acceptance: see M-MIG-8.
- Gate: standard + security checklist. Effort: L (2–3 weeks).
M-MIG-8 — End-to-end tests on staging (gate for the production plan)
- Depends on: M-MIG-7.
- Deliverables: Playwright (portal) +
hurl/curlscripts inorca-platform/tests/stage/covering:- signup → trial → KC org → mock Customer with
tenant_id→erp_customer_idset; fire/sales-order-submit(PLT-CORE-CLD-STD+CRA-CSA-CLD-STD) → active → Prüfwerk allowed; a tenant without entitlement → 403;- scan → usage event → outbox → usage record in the mock ≤ 60 s; kill the worker, scan, restart → exactly one record;
fire/invoice-overdue→ warning banner; past grace → restricted → Prüfwerk writes 402, reads OK;fire/payment-entry→ active;- Firmwerk licence: login → offline verify with network off → revoke → degrade → hard-stop (clock-skewed);
- Werkpilot login, licence check, seat event;
- isolation: cross-tenant API key / MCP token → 403; separate Mongo databases;
- ops: restore drill of
pg-stage; redeploy via CI webhook; Gatus green 24 h.
- signup → trial → KC org → mock Customer with
- Acceptance: all eight pass on two consecutive days.
- Gate: owner sign-off → production plan starts. Effort: M.
M-MIG-9 — breakpilot-dsms migration (last)
- Depends on: M-MIG-8; decision on pitch-deck's home (shares
breakpilot-db). - Deliverables: pin dsms images to digests;
pg_dumpcompliance_db+breakpilot_db; tar/data/ipfs, Qdrant, dataroom, Ollama volumes; copy to the platform node; projectdsms(12 services, pinned, no public Postgres port, Qdrant on the project network) withAUTH_TENANT_REGISTRY_URL→tenant-registry-stage,SCANNER_MCP_URL→pruefwerk-stage…/mcp, realmbreakpilot-stageclientscompliance-client/compliance-svc,BP_S3_*; Strato repoint ofadmin-dev/developers-dev/api-dev/sdk-dev/qdrant-dev.breakpilot.aiandpitch.breakpilot.com; then stop + removebreakpilot-dsmsanddsms-depson core, close port 54321, prunebreakpilot-devclients, dropauth-dev.meghsakha.com, retiremail.scanner.meghsakha.com, delete Harborcertifai/*; updateBreakPilot Infradocs. - Acceptance: dsms health on the new IPs; a known CID resolves; Prüfwerk control mapping works against the new
BREAKPILOT_BASE_URL; coreorca status= core only. - Gate: standard + manual (data move, DNS). Effort: M–L.
4. Production (separate plan, after M-MIG-8)
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.
5. Cross-cutting work (ongoing)
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.
6. Dependency graph
M-MIG-0 ──┬── M-MIG-1 (specs, parallel)
├── M-MIG-2 (stop on core) ─────────────────────────────────────────┐
├── 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
│
production plan
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.
7. Open questions
- Pitch-deck's home (shares the dsms Postgres): move with dsms or split the database first? Decide before M-MIG-9.
- 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.
- Second backup provider for the platform bucket (3-2-1) before production.
- Prüfwerk crate/binary renames (
compliance-*→pruefwerk-*) and the Mongo prefix: cosmetic, deferred; the Mongo prefix rename is a data migration. DR-WS-08 §6Brole mapping remains open; staging uses the V1org_rolesmodel.- 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.
End of document. Revised 2026-09-11.