Goal
Document and enable a self-hosted/local OCM control plane that preserves the hosted architecture: Cloudflare Tunnel, Cloudflare Worker/KV data plane, Firebase or Cloudflare Access human auth, OCM-issued ocm_token, KVM host enrollment, and Firecracker VM runtime.
This is not a separate localhost-only architecture. The self-hosted control plane should behave like the hosted control plane, using the operator’s domain, Cloudflare account, auth provider, and registered KVM workers.
Target flow
- Operator deploys OCM control plane on any machine.
- Operator configures Cloudflare DNS, Tunnel, Worker, KV, and wildcard routing.
- Operator configures Firebase auth or Cloudflare Access.
- Admin logs into OCM.
- Admin creates an enrollment token for a KVM host.
- KVM host registers as a worker through OCM using the enrollment token and Cloudflare/service-token path where required.
- User logs in through Firebase or Cloudflare Access.
- User creates an OCM machine.
- OCM places the machine on the registered KVM host and provisions per-machine routing/tunnel metadata.
- User accesses terminal/gateway/SSH through the configured data-plane domain.
Deployment prerequisites to document
- Operator-controlled domain or delegated subdomain on Cloudflare.
- Cloudflare account ID, zone ID, and API token with DNS, Tunnel, Worker, and KV permissions.
- Cloudflare Worker deployed for account/machine route authorization.
- Cloudflare KV namespace for account and route cache.
- Cloudflare Tunnel for the control plane.
- Wildcard DNS/routing for account and machine hostnames.
- Auth provider:
- Firebase: project ID, web app config, authorized domain, frontend config.
- Cloudflare Access: team domain, AUD tag, optional service token.
- OCM secrets/config:
JWT_SECRET, SECRET_ENCRYPTION_KEY, COOKIE_DOMAIN, DATA_PLANE_DOMAIN, CONTROL_PLANE_URL, OCM_ADMIN_EMAILS.
- KVM host with Firecracker support, cloudflared, bridge/tap networking, rootfs/kernel/runtime assets, and outbound access to Cloudflare/control plane.
Implementation gaps identified
openclawmachines.com is still hard-coded in backend routing, cookies, enrollment, frontend helpers, Worker host routing/CORS/CSP, and some direct machine URLs.
- Admin/superuser access is currently hard-coded to one email instead of bootstrap configuration.
ocm_token cookie domain is hard-coded and must be operator-configurable.
- Worker
BASE_DOMAIN, routes, host map, and KV bindings need self-hosted configuration guidance or templates.
- Host enrollment is not fully tunnel-first/service-token-aware.
- Firebase is intentionally supported and should remain first-class; emulator support needs an explicit path because emulator ID tokens are unsigned.
- Direct
m-*/ssh-* hostnames need a clear protection model: Cloudflare Access, OCM machine token, or account-subdomain Worker route only.
LLM operator runbook
Create a copy-pasteable llms/self-hosted-setup.txt or equivalent that a user can give to Codex/Claude. It should be phase-gated:
- Inspect repository and existing deployment state.
- Collect required operator inputs.
- Validate Cloudflare and auth prerequisites.
- Generate env/config plan.
- Deploy/configure Worker/Tunnel/control plane with explicit confirmation.
- Register KVM host.
- Run smoke tests.
- Report resource IDs, URLs, unresolved gaps, and next commands without printing secrets.
Acceptance criteria
- A public doc explains self-hosted prerequisites, architecture, config, setup order, and validation flow.
- A copy-pasteable LLM operator runbook exists and forbids architecture drift.
- The docs make clear that self-hosted OCM keeps the hosted Cloudflare/Firebase/Worker/KVM architecture.
- Required env vars and Cloudflare/Firebase setup are listed before deployment steps.
- The issue links to follow-up implementation work for domain/config portability if not completed in the same PR.
Goal
Document and enable a self-hosted/local OCM control plane that preserves the hosted architecture: Cloudflare Tunnel, Cloudflare Worker/KV data plane, Firebase or Cloudflare Access human auth, OCM-issued
ocm_token, KVM host enrollment, and Firecracker VM runtime.This is not a separate localhost-only architecture. The self-hosted control plane should behave like the hosted control plane, using the operator’s domain, Cloudflare account, auth provider, and registered KVM workers.
Target flow
Deployment prerequisites to document
JWT_SECRET,SECRET_ENCRYPTION_KEY,COOKIE_DOMAIN,DATA_PLANE_DOMAIN,CONTROL_PLANE_URL,OCM_ADMIN_EMAILS.Implementation gaps identified
openclawmachines.comis still hard-coded in backend routing, cookies, enrollment, frontend helpers, Worker host routing/CORS/CSP, and some direct machine URLs.ocm_tokencookie domain is hard-coded and must be operator-configurable.BASE_DOMAIN, routes, host map, and KV bindings need self-hosted configuration guidance or templates.m-*/ssh-*hostnames need a clear protection model: Cloudflare Access, OCM machine token, or account-subdomain Worker route only.LLM operator runbook
Create a copy-pasteable
llms/self-hosted-setup.txtor equivalent that a user can give to Codex/Claude. It should be phase-gated:Acceptance criteria