feat(onprem): APP_ENV=onprem for a customer's own node #142

Closed
sharang wants to merge 2 commits from feat/onprem-mode into main
pull from: feat/onprem-mode
Owner

On-prem blocker #1 from the test install (platform/onprem, testenv/results/gaps.md), plus gaps 2–5, 7 and 9. This adds APP_ENV=onprem, a mode for a registry running on a customer's own node.

Problem. Today the provisioning and launch URLs come from the migrations (*.breakpilot.com, keyed stage/prod). Activating a workspace on-prem would send its id, name and slug to our cloud, together with a service token.

What on-prem changes

  • Products and URLs: they come only from PRODUCTS and PRODUCT_LAUNCH_URLS / PRODUCT_PROVISION_URLS (key=url,…). A store decorator applies them to every product read, so catalog, activation, provisioning, entitlement checks and the Prüfwerk targets all agree. The URLs are checked at start.
  • No ERP: nothing goes into the outbox, and the webhook route is off.
  • No trial: a new workspace starts active, and the time ladder never escalates. The cloud still escalates, and a control test pins that.
  • Routes off: these answer 404 not_available:
    • trial offers and trial terms
    • catalog request and trial request
    • admin trial
    • ERP webhook
  • Start refused while a cloud or dev default is still in effect:
    • auth off
    • no authz rules
    • ephemeral licence key
    • portal, invite or sender not set
    • LLM gateway not set while an LLM key is
    • an ERP configured
    • contract documents on
  • Mail: a new setting SMTP_TLS=starttls|tls|none (plain internal relay). Credentials are never sent unencrypted.

Cloud. Without the new variables, stage and prod behave as before (TestLoad_cloudUnchangedWithoutTheNewVariables).

Migration 0032. The Werkpilot catalog text no longer names llm.breakpilot.com. It now says "the platform's language-model gateway". This applies to all environments, so the text on prod changes too.

Not in this PR:

  • Invites for directory (AD) users (gap 6). A federated user probably already exists in Keycloak, so POST /v1/tenants with admin_email answers email_taken. The next PR adds attaching an existing directory user.
  • Mail templates with our imprint.

Tests. go test ./... passes. The server and migration suites also pass with Postgres (testcontainers via podman). New tests: onprem_test.go (server, config) and plain_test.go (mail).

🤖 Generated with Claude Code

On-prem blocker #1 from the test install (`platform/onprem`, `testenv/results/gaps.md`), plus gaps 2–5, 7 and 9. This adds `APP_ENV=onprem`, a mode for a registry running on a customer's own node. **Problem.** Today the provisioning and launch URLs come from the migrations (`*.breakpilot.com`, keyed stage/prod). Activating a workspace on-prem would send its id, name and slug to our cloud, together with a service token. **What on-prem changes** - **Products and URLs:** they come only from `PRODUCTS` and `PRODUCT_LAUNCH_URLS` / `PRODUCT_PROVISION_URLS` (`key=url,…`). A store decorator applies them to every product read, so catalog, activation, provisioning, entitlement checks and the Prüfwerk targets all agree. The URLs are checked at start. - **No ERP:** nothing goes into the outbox, and the webhook route is off. - **No trial:** a new workspace starts `active`, and the time ladder never escalates. The cloud still escalates, and a control test pins that. - **Routes off:** these answer 404 `not_available`: - trial offers and trial terms - catalog request and trial request - admin trial - ERP webhook - **Start refused** while a cloud or dev default is still in effect: - auth off - no authz rules - ephemeral licence key - portal, invite or sender not set - LLM gateway not set while an LLM key is - an ERP configured - contract documents on - **Mail:** a new setting `SMTP_TLS=starttls|tls|none` (plain internal relay). Credentials are never sent unencrypted. **Cloud.** Without the new variables, stage and prod behave as before (`TestLoad_cloudUnchangedWithoutTheNewVariables`). **Migration 0032.** The Werkpilot catalog text no longer names `llm.breakpilot.com`. It now says "the platform's language-model gateway". This applies to all environments, so the text on prod changes too. **Not in this PR:** - Invites for directory (AD) users (gap 6). A federated user probably already exists in Keycloak, so `POST /v1/tenants` with `admin_email` answers `email_taken`. The next PR adds attaching an existing directory user. - Mail templates with our imprint. **Tests.** `go test ./...` passes. The server and migration suites also pass with Postgres (testcontainers via podman). New tests: `onprem_test.go` (server, config) and `plain_test.go` (mail). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
sharang added 1 commit 2026-11-19 16:36:08 +00:00
feat(onprem): APP_ENV=onprem for a customer's own node
ci / shared (pull_request) Successful in 11s
ci / test (pull_request) Failing after 38s
ci / image (pull_request) Skipped
2f6fa5f3e8
The registry on a customer's node must never reach a Breakpilot host and
must not run the cloud's commercial machinery.

- APP_ENV=onprem: no ERP (nothing queued, webhook off), no trial (new
  workspaces start active, the ladder never escalates by time), and the
  trial-offer, trial-terms, catalog/trial request and admin trial routes
  answer 404 not_available.
- PRODUCTS, PRODUCT_LAUNCH_URLS, PRODUCT_PROVISION_URLS: one store
  decorator applies the product list and URLs to every catalog read
  (catalog, activation, provisioning, entitlement checks). On-prem has no
  seeded URLs, so provisioning goes only to the local products. Checked at
  start ({id} in provision URLs, absolute http(s)).
- On-prem start fails when the values leave something to a cloud or dev
  default (auth off, no authz rules, ephemeral licence key, portal, invite,
  sender, LLM gateway) or set an ERP or contract documents.
- SMTP_TLS=starttls|tls|none: a plain relay inside the customer's network;
  no AUTH without encryption.
- Migration 0032: the Werkpilot text no longer names our LLM host.

Cloud behaviour is unchanged without the new variables (tested).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CODEOWNERS rules requested review from Benjamin_Boenisch 2026-11-19 16:36:08 +00:00
sharang added 1 commit 2026-11-19 16:39:23 +00:00
feat(onprem): refuse unknown product keys, no trials in the catalog, tighter tests
ci / shared (pull_request) Successful in 12s
ci / test (pull_request) Failing after 1m54s
ci / image (pull_request) Skipped
3e42b1ceb8
- Start fails when PRODUCTS or a URL override names no catalog product.
- The on-prem catalog sets supports_trial=false (the portal hides the button).
- Test that seeded cloud provision URLs are never called on-prem, with a
  cloud control; the outbox test gets its cloud control too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Author
Owner

Heads-up: #145 (tenant connections, merged c6de358) added migrations/0032_tenant_connections. This PR also adds a 0032 (0032_werkpilot_description), so once it's rebased onto main the two collide.

  • Rename: rename it to 0033_werkpilot_description.{up,down}.sql when you rebase. #143 and #144 are stacked on this PR and add no migrations, so they need nothing.
  • If it merged as is: golang-migrate refuses duplicate versions, so the migrations test fails loudly; nothing is applied silently.
  • Stage: it's at version 32 with 0032_tenant_connections since this morning.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Q9inRcu428A2iNjDHPEAT9

Heads-up: #145 (tenant connections, merged c6de358) added `migrations/0032_tenant_connections`. This PR also adds a `0032` (`0032_werkpilot_description`), so once it's rebased onto main the two collide. - **Rename:** rename it to `0033_werkpilot_description.{up,down}.sql` when you rebase. #143 and #144 are stacked on this PR and add no migrations, so they need nothing. - **If it merged as is:** golang-migrate refuses duplicate versions, so the migrations test fails loudly; nothing is applied silently. - **Stage:** it's at version 32 with `0032_tenant_connections` since this morning. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01Q9inRcu428A2iNjDHPEAT9
Author
Owner

Merged as part of #146 (the same commits on today's main; migration renumbered to 0033).

Merged as part of #146 (the same commits on today's main; migration renumbered to 0033).
sharang closed this pull request 2026-11-20 16:31:14 +00:00

Pull request closed

Please reopen this pull request to perform a merge.
Sign in to join this conversation.