Skip to content

Self-hosted BoardReadyOps Cloud deployment

Customer-operated execution workers are deployed separately from the control plane. See Self-hosted runner mode for enrollment, source-boundary, service, network, and rollback procedures.

This guide describes a generic self-hosted BoardReadyOps Cloud control-plane deployment. It intentionally does not name a current production machine or IP address. Select the deployment host and the operator-selected HTTPS origin before commissioning, and keep those environment-specific values in the operations system rather than in the public repository.

Single-pass worker mode (isolated migration testing only)

The built control-plane worker can process one finite batch per queue instead of opening a health listener and polling indefinitely. For isolated tests invoke: BOARDREADYOPS_WORKER_MODE=once node apps/web/.next/worker.mjs

The default mode is continuous; existing production services are unchanged. Single-pass mode still needs normal worker credentials and PostgreSQL access. It acquires the existing exclusive PostgreSQL worker ownership lock before processing, reuses durable leases and idempotent outbox transitions, processes one bounded claim batch in each configured category, runs one maintenance pass, releases the lock and closes the database connection. It exits nonzero on invalid configuration, a claim failure, or an uncaught batch error. Do not overlap with an existing production worker.

Not yet a serverless deployment contract: one pass might leave backlog; external requests or maintenance can exceed short function time limits. Periodic reconciliation, notifications, retries, object storage, idle wakeups and real-user latency still require independently verified scheduling and staging acceptance. Do not turn off the production worker or move DNS merely because this mode exists.

Neon scheduled worker admission (integration contract only)

The optional Neon Function schedule adapter is available as the library apps/web/lib/neon-scheduled-worker-handler.ts. It validates a platform-authenticated scheduled POST / envelope, the exact configured trigger ID and matching invocation ID, rejects unsolicited tenant/repository selectors, limits body size to 40 KiB, and maps failures or concurrent same-isolate work to HTTP 503 with Retry-After: 60. The callback must acquire the existing exclusive PostgreSQL worker ownership and use durable claims/idempotency; no caller input grants tenant or repository authority.

The admission helper alone is not a deployed Function or a production HTTP endpoint; a disabled-by-default Function source exists below. Neon Functions strip client-supplied X-Neon-* headers at their own edge; that guarantee does not hold on arbitrary reverse proxies or other hosting environments. Do not publish the handler outside the verified Neon platform or call its identity header a transferable shared secret. Neon may redeliver the same invocation up to 72 hours later, so keep durable database-backed processing idempotent rather than relying on in-memory deduplication. An isolated, source-bound customer acceptance run and bounded free-tier usage proof are still mandatory before a VPS migration.

Direct-connection ownership for scheduled Neon worker passes

The optional createExclusiveNeonScheduledWorkerHandler composes the schedule-admission helper with the existing runOneWorkerPass and the canonical exclusive PostgreSQL advisory lock. The caller must pass the dedicated session connection DATABASE_URL_UNPOOLED (not the pooled Neon DATABASE_URL) and supply the existing worker's durable, tenant-authorized queue operations. It claims ownership only after the Neon trigger is admitted, finishes one bounded pass in order, and releases the owner session in a finally block before returning 200. A busy lock or failed pass returns 503, allowing Neon to retry.

If the dedicated database session is lost, an AbortSignal is set: no further queue category starts. Currently executing effects must also honor the signal and rely on existing durable idempotency/fencing; the helper does not cancel an arbitrary in-flight external request. Separate Neon Function isolates are serialized by PostgreSQL, not by the HTTP handler's in-memory busy flag. This adapter is still a library, not a deployed Neon Function or completed real-business-workflow integration. There is no new public endpoint, production schedule, or platform configuration in this change. Verify the actual callable queue factory, bounded work duration, failure replay and tenant authorization against an isolated PostgreSQL instance before enabling hosted execution.

Opt-in Neon lifecycle Function source (not deployed)

The standalone source at functions/boardreadyops-lifecycle.ts is a Neon-native default-exported fetch(request) module. After running the repository worker build, its ESM/YAML-compatible output is apps/web/.next/neon-lifecycle.mjs. The same self-contained artifact is copied to apps/web/.next/neon/index.mjs for the Neon Functions ZIP entry contract; it includes the PostgreSQL driver and does not require production node_modules. Use the canonical prebuilt entry file (not the raw TypeScript) with: neon functions deploy boardreadyops --no-bundle --src apps/web/.next/neon/index.mjs --project-id --branch --env BOARDREADYOPS_NEON_LIFECYCLE_ENABLED=false. This is an isolated staging procedure, not a production deployment instruction; keep the outbox and GitHub reconciliation flags disabled too, and do not create an enabled schedule until source-bound user acceptance. It handles one GitHub webhook lifecycle batch (maximum four persisted jobs; default two) using the existing control_plane_jobs and transactional GitHub App lifecycle stores. It does not accept a repository or installation ID from the HTTP request; authority comes from verified GitHub webhook jobs already stored by the control plane.

The Function is disabled by default. An isolated accepted Neon project would need BOARDREADYOPS_NEON_LIFECYCLE_ENABLED=true, the exact BOARDREADYOPS_NEON_LIFECYCLE_TRIGGER_ID, GITHUB_APP_ID, GITHUB_APP_PRIVATE_KEY, and Neon-injected DATABASE_URL plus direct DATABASE_URL_UNPOOLED. The schedule must target the native Neon edge, which strips forged X-Neon-* headers. Do not forward this endpoint through a generic proxy or reuse the unrelated portfolio database. This scheduled Function does not guarantee immediate first-user latency.

The adapter takes the canonical exclusive session advisory lock before claiming stored jobs, uses a small PostgreSQL work-query pool, processes sequentially and closes it before releasing ownership. On lease loss, it refuses to start another job; an external GitHub API call already in flight cannot yet be cancelled automatically, so a real fault/replay test is required before enabling customer data. Each durable job records its own retry or dead-letter result. A scheduled HTTP 200 does not imply that every business operation succeeded.

Lifecycle processing is wired by default after activation. The same scheduled Function can additionally process the existing durable GitHub outbox (Check Run creation/completion and GitHub Actions workflow dispatch) only when a second explicit opt-in BOARDREADYOPS_NEON_OUTBOX_ENABLED=true is present. Without it the outbox callback stays a no-op. The outbox lane uses the canonical PostgreSQL outbox store, GitHub App Check Run client, Actions dispatcher, and existing reconciliation-required quarantine for uncertain external delivery. It requires github-actions runner mode, valid GitHub App credentials, and an HTTPS public result-callback origin; it rejects self-hosted/disabled runner mode before claiming work. Outbox batches default to two effects and are bounded to four. Tests must prove a stored dispatch is not submitted twice and unknown delivery is quarantined. This schedule still cannot guarantee an immediate user-triggered response. Current Coolify/VPS worker stays authoritative until all categories, runtime cost, first-user source-bound workflow, data retention and rollback pass acceptance. A GitHub result reconciliation step is independently available as a third opt-in, BOARDREADYOPS_NEON_GITHUB_RECONCILIATION_ENABLED=true. Only after native Neon schedule admission and under the same exclusive PostgreSQL advisory owner session, it runs bounded workflow and Check Run reconciliation using the canonical SQL detector/claim/guarded-transition store and existing GitHub App read/repair clients. Each pass detects at most two workflow and two Check Run candidates (maximum four per category), observes missing signed callbacks after 300 seconds, retains a 30-minute deadline and schedules ongoing checks at 60-second intervals. A green GitHub workflow conclusion is not a signed BoardReadyOps result: a missing signed callback stays pending until the deadline and then becomes a truthful failure, never a fabricated pass. Already-published Check Runs are not rewritten. The operation fails closed for unsupported runner mode or missing GitHub App credentials and stops between claimed records on ownership loss. Loss of the owner session still cannot cancel an external GitHub API request already in flight.

Artifact deletion, Stripe, lifecycle reconciliation, notifications, maintenance and exports remain on the existing worker; this is not a complete VPS replacement. A schedule alone cannot guarantee immediate first-user latency, and synthetic PostgreSQL evidence is not real customer acceptance. No production migration is implied.

Quiesced worker release for artifact fencing

For a planned local-storage fencing migration, an operator may stop the old worker only after recording an encrypted backup, confirming no active artifact deletion or unresolved legal hold, and enumerating all old unlink actors. Select dry_run=false and pre_quiesced_worker=true in the production cloud-deploy dispatch. Choosing pre_quiesced_worker=true with dry_run=true is rejected by the first workflow step before loading deployment secrets or connecting Tailscale, and again by the remote preflight; it never runs a deployment. The default remains false: ordinary releases still require one running, healthy web and worker on the same immutable image.

This explicit mode requires a healthy running web container and exactly one stopped Compose worker that exited cleanly, both referencing the identical image. An absent/extra worker, running worker, abnormal exit or mismatched image fails closed. This does not automatically stop workers or waive backups, live queue checks, release-policy mounts, readiness or HTTPS smoke. After a fencing migration, do not restart an old pre-fence worker on rollback; preserve unresolved fences and recover using the new fenced worker.

Target topology

operator-selected HTTPS origin
  -> operator-managed DNS / ingress
  -> operator-selected deployment host
  -> Caddy on the boardreadyops-cloud Docker network
  -> immutable BoardReadyOps web image on web:3000
  -> durable PostgreSQL webhook inbox and control-plane jobs
  -> PostgreSQL transactional outbox for GitHub side effects
  -> independent BoardReadyOps worker image on worker:3001
  -> PostgreSQL, Redis, and a persistent artifact volume

DNS and public origin

Choose the public HTTPS origin as part of deployment commissioning. The repository does not define a production hostname, provider, IP address, or DNS record. deploy/env.example uses the reserved boardreadyops.example.com documentation domain only as a placeholder. Replace it with the real origin before deployment and configure BOARDREADYOPS_CADDY_HOST, APP_URL, NEXT_PUBLIC_APP_URL, BOARDREADYOPS_PUBLIC_URL, and BOARDREADYOPS_CLOUD_HEALTH_URL consistently.

OAuth ingress source verification (release-gated)

The generic deploy/Caddyfile overwrites X-BoardReadyOps-Verified-Client-IP with Caddy's verified {client_ip} when proxying to the private web service. OAuth login-resumption and token endpoints require a single valid address from that header, apply per-source PostgreSQL request limits, and fail closed if this trusted ingress contract is missing. Client-supplied X-Forwarded-For is never accepted as authority by these handlers; rate-limit bucket keys are hashed before persistence.

If another CDN or load balancer precedes Caddy, {client_ip} can represent the intermediary instead of the end user. Before enabling the remote OAuth release switch, commission a reviewed Caddy trusted_proxies policy for the actual ingress and verify spoof rejection, forwarded address normalization, shared-network behavior, per-client/global limits, and edge-layer abuse protection with real clients. Do not assume the generic Compose example describes production's commissioned proxy or authorization state. A successful synthetic unit test or Compose parse is not approval to deploy or activate MCP.

Runtime layout

Recommended paths:

/opt/repos/boardreadyops-prod       # clean production worktree tracking origin/main
/opt/boardreadyops-cloud            # deployment env, stable Caddyfile, and runtime files
/opt/boardreadyops-cloud/runtime-env # root-only symlink or file mounted read-only into web

Keep the live Caddy bind mount under /opt/boardreadyops-cloud; do not bind it from an expendable Git worktree.

Host requirements

The repository Compose file bounds all service stdout/stderr JSON log streams to 3 files of 10 MB each per container using Docker's built-in json-file rotation. It does not modify the host's Docker daemon configuration, application data volumes, PostgreSQL WAL, or retained manufacturing artifacts. Docker only applies container logging options to newly created/recreated containers; merging these settings does not rotate existing production logs or authorize a restart. During an independently approved deployment, verify effective settings with docker inspect <container> --format '{{json .HostConfig.LogConfig}}' and monitor host disk/inode use. Do not truncate Docker-managed log files directly; preserve any incident evidence required by retention policy.

Docker Engine and Docker Compose are the host runtime requirements. Host Node.js is not required for the Compose build path: the production web image performs its Node.js build inside Docker. The web and control-plane worker processes have independent healthchecks, and PostgreSQL and Redis healthchecks are defined in deploy/docker-compose.yml.

Local artifact volume permissions and worker reachability

With ARTIFACT_STORAGE_DRIVER=local, both the web process (which hard-links validated uploads) and the deletion worker (which resolves the stored path before unlink) need the same boardreadyops_artifacts named volume mounted at /data/artifacts. The generic Compose topology supplies that mount to both services and configures ARTIFACT_STORAGE_ROOT=/data/artifacts for each. The image runs both processes as the unprivileged node user (UID/GID 1000) and creates /data/artifacts as that user with mode 0700 in the image, so a new empty named volume can inherit appropriate ownership when Docker initializes it. Neither container should run as root, and the entrypoint must not automatically change volume permissions.

Existing named volumes require independent verification. In isolated Docker tests, a fresh or completely empty named volume inherited image-directory ownership; a nonempty, root-owned existing volume retained its own root:root/0755 permissions. Do not assume an upgrade will fix any deployed volume automatically. Before any separately authorized deployment, an operator must inspect the current volume's ownership, mode, free space, mount identity, tenant/hold obligations, and backup/rollback evidence; also verify that the same intended volume is mounted on both services and that the effective application UID can read/write the root. A running web/worker healthcheck does not establish artifact upload or deletion readiness. If an existing volume is owned by root with mode 0755, node cannot write it. Stop the rollout and obtain separate change approval for a narrowly scoped, audited permission repair with appropriate worker quiescence and legal-hold protection; do not indiscriminately run recursive chown, change host paths, rebuild the volume, clear deletion jobs, or enable a new worker merely because Compose config validates. Restore/rollback must not expose old unfenced physical-unlink workers while holds are active.

For read-only, non-sensitive preflight, inspect container user IDs and mount destinations through docker inspect, and test existence and writability as the actual application user without creating a file. Follow ambiguous artifact upload operator evidence and the artifact hold/unlink coordination contract. Actual PostgreSQL row/hold reconciliation requires a separately approved least-privileged read-only database identity; neither this image change nor green source CI authorizes production data queries, migration, permission repair, deployment or deletion.

Production maintenance service

A BoardReadyOps-operated host may install the repository-owned maintenance service when an unprivileged exec-agent needs two production-safe maintenance operations without receiving root shell or Docker access. The service runs as root, listens only on /run/boardreadyops-maintenance/control.sock, verifies the exact exec-agent peer UID, and accepts only the versioned runtime-status and backup-restore-verify requests. The installer does not add exec-agent to the Docker group, does not create a privileged shell path, and stores only the operator-selected deployment directory in its root-only configuration.

Install it once from the exact reviewed BoardReadyOps release on the deployment host:

sudo bash deploy/maintenance/install.sh --deployment-dir /absolute/path

For a normal layout, replace /absolute/path with the directory that contains the production repo/ checkout and deployment state. The installer validates that the path is absolute, normalized, real, and contains repo/deploy/docker-compose.yml; it then binds only that deployment tree read-only into the hardened service namespace. Runtime secrets remain outside the maintenance protocol.

After installation the unprivileged maintenance client has only these two commands:

boardreadyops-maintenance runtime-status
boardreadyops-maintenance backup-restore-verify

runtime-status returns aggregate service state, restart counts, and the checkout/image revision binding for the fixed boardreadyops-cloud Compose project. backup-restore-verify reads production PostgreSQL with native pg_dump, restores into disposable containers on an internal Docker network, compares migrations/tables/representative aggregate row counts, starts isolated web and worker containers with runner execution disabled, requires both readiness endpoints, verifies cleanup, and only then emits aggregate evidence. The maintenance response never includes database URLs, passwords, GitHub credentials, tenant identifiers, findings, webhook payloads, artifact paths, or OIDC claims.

VPS migration and portable cutover

Treat a control-plane move as a state transfer and ingress cutover, not as a new logical BoardReadyOps installation. The portable state boundary has four parts: PostgreSQL state, any local artifact volume used by ARTIFACT_STORAGE_DRIVER=local, the root-only runtime environment, and the operator-managed ingress or tunnel credential. Keep those materials outside the Git checkout and transfer them only through an encrypted, access-controlled operator path. Do not copy shell history, temporary OIDC tokens, GitHub installation tokens, webhook payloads, or application logs as migration inputs.

The fail-closed cutover order is backup → restore → isolated health → ingress cutover → canaries → old-host shutdown. The public hostname does not need to change when the ingress credential is portable; move the credential and route ownership instead of baking a VPS address into repository configuration.

  1. Freeze the source revision and capture state. Record the exact production Git SHA and image tag. Create a PostgreSQL backup using the existing cloud:backup:verify contract or an operator backup with equivalent pg_dump --format=custom --no-owner --no-privileges semantics. If local managed artifact bytes are enabled, create an encrypted backup or snapshot of the local artifact volume at a recovery point consistent with the database backup. Copy the root-only runtime environment and ingress/tunnel credential through a restricted operator channel; never commit them to the repository.
  2. Provision the destination without public ingress. Install Docker Engine and Docker Compose, clone or copy a clean BoardReadyOps checkout at the frozen revision, restore the runtime environment with root-only permissions, create the expected named volumes/network, and restore PostgreSQL plus any local artifact volume. Do not start the production ingress on the new host before isolated health checks pass.
  3. Verify restored state in isolation. Run the same schema and representative-state checks documented in the control-plane restore drill. Require the migration set to match, then start web and worker without taking over the production hostname. Require web /api/health/ready, worker /health/ready, PostgreSQL, and Redis to report healthy. Verify a bounded restored run/attempt through tenant-scoped access without copying private findings or source into evidence.
  4. Cut over ingress atomically. Stop or withdraw the production ingress/tunnel connector on the old host before starting the connector that owns the same production hostname on the new host. Avoid concurrent active connectors unless the ingress product has an explicitly reviewed multi-connector routing model for this deployment. Confirm TLS and the public health endpoints through the normal hostname.
  5. Commission with target-repository canaries. Run the documented public synthetic canary first and the private synthetic canary second. Require exact-SHA checkout, GitHub App webhook intake, Check Run publication, workflow dispatch, OIDC-authenticated callback, and terminal success before accepting the destination host.
  6. Retire the old host only after evidence is complete. Do not destroy the old host until both public and private canaries pass. Keep it stopped or ingress-withdrawn but recoverable for the operator-defined rollback window. If cutover validation fails, withdraw the new ingress, restore the old ingress against the unchanged hostname, and investigate before retrying; do not run divergent writable PostgreSQL primaries.

Migration evidence should contain only the frozen release SHA, backup/restore timestamps and aggregate sizes, readiness outcomes, canary URLs/SHAs, and the cutover/rollback result. Credentials, database URLs, tenant identifiers, repository source, findings, artifact paths, webhook bodies, and OIDC claims remain private. The control-plane restore drill remains the canonical database restore-readiness proof; this section defines how that proof fits into a real host move rather than introducing a second backup format.

The webhook endpoint never performs GitHub Check Run creation or workflow dispatch inline. It verifies and normalizes the request, atomically stores one webhook_inbox row and one control_plane_jobs row, and returns HTTP 202. The lifecycle worker claims jobs with PostgreSQL leases and writes release-run state plus required control_plane_outbox records transactionally. An independent outbox loop delivers Check Run and workflow effects, so GitHub API latency does not block unrelated webhook planning. Check Run creation is replay-safe through external_id = runId; an uncertain workflow dispatch becomes reconciliation_required and is not automatically replayed. See Transactional outbox for the state model, reconciliation procedure, metrics, and external-broker triggers.

Web intake logs expose only outcome and request-to-accept latency. The worker periodically emits aggregate available, leased, retrying, dead-letter, reconciliation-required, oldest-age, and outbox-lag metrics without payload or finding content. Terminal worker logs include only safe correlation identifiers such as delivery, installation, repository, run, attempt, job, and outbox IDs. All structured fields pass through recursive credential, OIDC, capability, source, and finding redaction before serialization. Successful webhook processing immediately replaces normalized actions with an empty array. BOARDREADYOPS_WEBHOOK_RETENTION_DAYS controls terminal webhook inbox metadata retention and defaults to 30; accepted values are 1 through 3650 days. The configured value is applied only to newly accepted webhook inbox rows and does not rewrite existing retention_until deadlines. Bounded cleanup batches remove only processed, failed, or dead-letter rows after their deadline; accepted or processing in-flight rows are never purged. Dead-letter actions remain available only until their retention deadline. The effective retention period, cleanup interval, and cleanup batch size appear in the worker startup event and /health/ready response. The same maintenance cadence removes expired runner request nonce digests and transitions other expired ephemeral control-plane credentials in bounded, FOR UPDATE SKIP LOCKED batches. Expired runner request nonce digests are removed periodically in bounded batches after their persisted deadline, so cleanup does not remove active nonce replay protection. Pending artifact upload capabilities become expired, unconsumed runner enrollment tokens become revoked, and pending or dispatched repository setup probes become expired after their persisted deadline. Active uploads and in-flight probes are not deleted. BOARDREADYOPS_EPHEMERAL_RECORD_RETENTION_DAYS defaults to 30 and accepts 1 through 3650 days; after that cutoff, bounded cleanup deletes terminal artifact capability rows, consumed or revoked enrollment rows, and completed, failed, or expired setup probe rows. The durable run, finding, artifact, setup revision, and audit records that those one-time rows helped create remain governed by their separate lifecycle contracts. Changing this setting changes the cutoff used by later cleanup cycles; it does not rewrite row timestamps. BOARDREADYOPS_CONTROL_PLANE_HISTORY_RETENTION_DAYS defaults to 90 days and accepts 1 through 3650 days. Bounded cleanup removes only completed outbox effects and completed reconciliation items older than the calculated cutoff. It preserves available or leased work, dead-letter and reconciliation-required records, and completed outbox effects with retained reconciliation references. Durable release runs, attempts, findings, artifacts, replay operations, transition events, and append-only audit events are not deleted by this setting. Changing the value changes future cutoff calculations without rewriting stored completion timestamps. BOARDREADYOPS_RETENTION_CLEANUP_BATCH_SIZE defaults to 1000 and accepts 1 through 10000 rows; it bounds every cleanup scope per cycle. Logs expose aggregate transition counts and error classes only; they do not include token digests, artifact declarations, repository names, outbox payloads, external results, or reconciliation diagnostics. Verified deliveries are guarded by a configurable per-installation, per-process rate window (BOARDREADYOPS_WEBHOOK_RATE_LIMIT_PER_MINUTE, default 1200); retries with the same GitHub delivery ID are exempt so idempotent acknowledgement remains available.

Server-issued artifact upload capabilities are single-use and bound to one run, execution attempt, lease, declared byte count, and optional digest. BOARDREADYOPS_ARTIFACT_CAPABILITY_TTL_SECONDS controls the lifetime of newly issued capabilities, defaults to 900 seconds, and accepts values from 60 through 3600 seconds. Changing the value does not rewrite persisted expires_at deadlines. Invalid values fail closed by making capability issuance unavailable and causing /api/health/ready to report not ready; uploads using already issued capabilities continue to be evaluated against their persisted deadline. The readiness response exposes only the effective TTL integer as artifactCapabilityTtlSeconds. Capability tokens and upload URLs must not be retained in logs or evidence bundles.

BOARDREADYOPS_SELF_HOSTED_RUNNER_MIN_VERSION optionally sets a strict stable major.minor.patch floor for new self-hosted runner claim requests. The legacy protocol signature remains unchanged for control-plane rollback compatibility, while a second Ed25519 signature binds the runner version to the same canonical request; changing either extension header invalidates authentication. Missing or lower versions receive HTTP 426 before a lease or execution attempt is created. Managed runners are not affected. Invalid configured values fail readiness before PostgreSQL is queried. When configured, /api/health/ready exposes the effective value as selfHostedRunnerMinimumVersion. Existing leases may drain through heartbeat, artifact, result, or relinquish requests so an operator can upgrade without stranding in-flight work.

When an accepted runner result replaces an earlier artifact record, BoardReadyOps removes the old metadata immediately and creates a tenant-scoped durable physical-deletion job in the same PostgreSQL transaction. The age-based retention loop now uses the same deletion path for managed artifacts whose persisted deadline, explicit tenant retention policy, or plan default has elapsed. Persisted artifact deadlines are authoritative; otherwise a repository-specific managed-artifact override takes precedence over the tenant policy, then Free defaults to 30 days and Team to 365 days. Business/Enterprise may retain indefinitely or use a bounded tenant/repository policy. An active tenant legal hold suppresses automatic artifact expiry.

Retention cleanup is bounded and storage-path aware. Concurrent retention workers serialize a shared storage locator, lock its current artifact references, revoke only eligible metadata, and queue physical deletion exactly once when the final retained reference is gone. Retained paths produce a content-free artifact.object.deletion_skipped audit event. Removing metadata also makes previously issued BoardReadyOps signed download URLs fail closed because the artifact row no longer resolves.

The control-plane deletion worker removes local objects only when ARTIFACT_STORAGE_DRIVER=local and ARTIFACT_STORAGE_ROOT is configured; unsupported driver jobs are terminally rejected and audited. It verifies that each queued target remains inside the configured root, treats an already-missing file as idempotent success, retries transient filesystem failures with bounded backoff, and dead-letters unsupported drivers or unsafe paths. Successful and terminal failed deletions create content-free audit events; worker health and queue metrics expose counts and timestamps but never storage paths. BOARDREADYOPS_ARTIFACT_DELETION_CONCURRENCY defaults to 2 and BOARDREADYOPS_ARTIFACT_DELETION_POLL_MS defaults to 1000. Run/finding/audit-history expiry, non-local object deletion, complete erasure execution, and uninstall cleanup remain separate lifecycle work.

Control-plane SLI snapshots

The maintenance loop emits a global worker.control_plane_sli event on the same interval as queue metrics. The event is content-free and contains only these aggregate fields:

  • webhookAcceptanceP95Ms: 24-hour p95 time from webhook receipt to durable acceptance;
  • lifecycleQueueAgeSeconds: age of the oldest available or leased lifecycle job;
  • outboxLagSeconds: age of the oldest available, leased, or reconciliation-required side effect;
  • dispatchLatencyP95Seconds: 24-hour p95 time from dispatch request to confirmed dispatch;
  • completionLatencyP95Seconds: 24-hour p95 execution completion time;
  • staleAttempts: non-terminal attempts without recent progress;
  • reconciliationBacklog: available or leased reconciliation items;
  • reconciliationRepairs24h: successfully repaired reconciliation items in the last 24 hours;
  • terminalFailures24h and terminalRuns24h: terminal run counts used to calculate failure rate; and
  • terminalFailureRateBasisPoints: terminal failures per 10,000 terminal runs.

The query never returns repository source, findings, payloads, artifact names, commit messages, credentials, or tokens. A failed SLI query does not affect worker readiness or queue processing; the worker emits worker.control_plane_sli_failed with only errorClass. Queue metric collection and SLI collection fail independently.

Initial GitHub Cloud GA SLO policy

The initial alert policy is versioned as github-cloud-ga-v1. It evaluates only the aggregate snapshot above and emits transition events without repository, installation, source, finding, payload, artifact, credential, or token fields.

Signal Alert trigger Severity
Webhook acceptance p95 > 1,000 ms for 5 minutes warning
Lifecycle queue age > 60 seconds for 5 minutes critical
Outbox lag > 60 seconds for 5 minutes critical
Dispatch latency p95 > 30 seconds for 10 minutes warning
Completion latency p95 > 1,800 seconds for 10 minutes warning
Stale attempts > 0 for two consecutive snapshots critical
Reconciliation backlog > 20 immediately or increasing for three consecutive snapshots warning
Terminal failure rate > 500 basis points with at least 20 terminal runs in 24 hours critical

The terminal failure-rate gate is 500 basis points and is evaluated only when there are at least 20 terminal runs in the preceding 24 hours.

Every successful snapshot emits worker.control_plane_slo_evaluation with the policy version, aggregate health, and active signal names. A signal emits worker.control_plane_slo_firing only when it first enters the alerting state and worker.control_plane_slo_recovered only when it leaves that state. Repeated breached snapshots do not repeat the firing transition.

Critical transitions page the platform on-call. Warning transitions open or update operational triage and should be correlated with GitHub status, worker restarts, queue lag, outbox lag, and reconciliation activity. reconciliationRepairs24h remains diagnostic and does not alert by itself.

If policy evaluation throws, the worker emits worker.control_plane_slo_failed with only errorClass. SLI collection or SLO evaluation failure does not affect worker readiness or queue processing. The evaluator keeps debounce state in memory, so a worker restart resets local duration and consecutive-snapshot history. External log or metrics infrastructure must retain durable incident state and must not treat a worker restart as recovery.

Control-plane worker boundary

The worker is an orchestrator only. It does not check out repository source, invoke KiCad, materialize a source workspace, or execute customer commands. Target-repository GitHub Actions or a separately enrolled customer-hosted runner remain the execution plane.

The cloud build emits apps/web/.next/worker-meta.json from esbuild and runs pnpm run verify:control-plane-worker-boundary. The build fails if the worker dependency graph contains KiCad execution modules, repository checkout/source-workspace modules, runner executors, or child_process. Treat a boundary-verifier failure as an architectural regression rather than bypassing the check.

First Compose deployment

cp deploy/env.example deploy/.env
# Replace the example hostname and edit deploy/.env before public deployment.
export BOARDREADYOPS_CLOUD_HEALTH_URL="https://boardreadyops.example.com/api/health"
export BOARDREADYOPS_GIT_SHA="$(git rev-parse HEAD)"
export BOARDREADYOPS_BUILD_DATE="$(date -u +%Y-%m-%dT%H:%M:%SZ)"
export BOARDREADYOPS_VERSION="$(node -p "require('./package.json').version")"
export BOARDREADYOPS_IMAGE_TAG="$BOARDREADYOPS_GIT_SHA"
docker compose --env-file deploy/.env -f deploy/docker-compose.yml up -d --build

The build writes the commit SHA, package version, and build timestamp into standard OCI image labels. Compose runs the additive SQL migrations once, then starts the web and worker services from the same immutable image. The worker exposes readiness only inside the Compose network on port 3001.

Health check

curl -fsS "${BOARDREADYOPS_PUBLIC_URL}/api/health"

docker compose --env-file deploy/.env -f deploy/docker-compose.yml exec worker \
  node -e "fetch('http://127.0.0.1:3001/health/ready').then(async r=>{console.log(await r.text());process.exit(r.ok?0:1)})"

Expected response:

{
  "ok": true,
  "service": "boardreadyops-cloud"
}

The worker readiness response also reports the database/configuration state, effective webhook, terminal ephemeral-record, and completed control-plane history retention, cleanup interval, cleanup batch size, and last successful retention cleanup, the latest lifecycle, outbox, internal lifecycle-reconciliation, workflow-reconciliation, and Check Run reconciliation polls, the latest successful repair timestamps including lastLifecycleReconciliationPollAt and lastSuccessfulLifecycleReconciliationAt, and scoped-concurrency active and waiting counts. A worker sets readiness false before graceful shutdown and stops claiming new batches. Existing leased work drains before the database pool closes; after an ungraceful termination, PostgreSQL lease expiry makes unfinished work claimable by another replica.

Inspect the native Docker health state with:

docker inspect --format '{{json .State.Health}}' bro-web

Error tracking (optional)

The web app (apps/web) and the control-plane worker (apps/web/worker.ts) can report unhandled errors to Sentry. This is opt-in only: nothing is sent unless SENTRY_DSN is set. There is no default outbound telemetry.

Variable Required for Purpose
SENTRY_DSN Runtime error capture Enables reporting in both the web app and the worker. Unset = disabled.
SENTRY_ENVIRONMENT Optional Tags events (defaults to NODE_ENV).
SENTRY_ORG, SENTRY_PROJECT Build-time source map upload (web app only) Need SENTRY_AUTH_TOKEN too -- all three must be set for next build to upload source maps via withSentryConfig. Any missing = plain build, no Sentry build step.
SENTRY_AUTH_TOKEN Build-time source map upload (web app only) Only used when SENTRY_ORG/SENTRY_PROJECT are set; needs the project:releases scope, not just org:ci.

The web app uses the full @sentry/nextjs SDK (apps/web/instrumentation.ts), capturing errors from Server Components, Route Handlers, and middleware via its onRequestError hook. The worker uses a different, minimal path (apps/web/lib/sentry-worker-client.ts) instead of the @sentry/node SDK: that SDK statically references node:child_process in its bundled OpenTelemetry/context integrations regardless of which integrations are registered at runtime, and scripts/verify-control-plane-worker-boundary.mjs forbids the worker from gaining process-spawning capability by design — so the worker sends the same Sentry envelope format directly over HTTPS instead. It forwards every log("error", ...) call through the same sanitized fields already written to stdout (sanitizeWorkerLogFields) — no additional payload, no raw request/design data.

Tracing is intentionally disabled (tracesSampleRate: 0); this is error reporting only, not APM. Enabling it is a deliberate follow-up if request tracing becomes worth the added event volume.

Repeatable self-hosted deploy from main

After a change is merged to main, update the clean production worktree without rewriting local history:

cd /opt/repos/boardreadyops-prod
git fetch origin --prune
git checkout prod-main
git merge --ff-only origin/main
pnpm run cloud:deploy:self-hosted

The deploy script performs these steps:

  1. Installs dependencies with pnpm install --frozen-lockfile unless explicitly skipped.
  2. Builds an immutable web image tagged with the current Git commit.
  3. Adds OCI revision, version, and build-date labels to the image.
  4. Applies pending additive PostgreSQL migrations from the immutable image.
  5. Starts a temporary web canary on 127.0.0.1:3004.
  6. Requires both the image-native Docker healthcheck and the canary HTTP health endpoint to pass.
  7. Tags the current live image as a timestamped rollback image.
  8. Replaces bro-web, verifies the public HTTPS endpoint, then replaces bro-worker.
  9. Requires the worker's database-backed readiness check to pass.
  10. Restores both previous containers automatically if either process fails deployment.
  11. Removes previous containers after success while retaining the rollback image.

The deploy no longer copies .next into a running container. Each release is an immutable Docker image tied to one Git revision.

Remote deploy trigger

The cloud-deploy workflow supports an operator-commissioned deployment target using the legacy Compose topology introduced in #550: a host-local deploy.sh wrapper around docker compose (project boardreadyops-cloud, services web/worker/migrate/caddy/cloudflared) with the checkout at /home/ubuntu/boardreadyops-cloud/repo. That path is a commissioning contract, not evidence that a production host is currently live. Current runtime state belongs in the operations system, not in this public repository.

The workflow is workflow_dispatch-only — merging to main never triggers it. After Tailscale and SSH authentication, it first verifies that the expected Git checkout and executable deploy runbook already exist. If either is absent, the preflight fails before git fetch, build, migration, or container mutation. Treat that as an uncommissioned or drifted deployment target: do not create the missing production tree automatically. Recommission or migrate the host with the procedures above, then retry the workflow. Once preflight succeeds, the run fast-forwards the commissioned repo/ checkout to origin/main and executes the host's own ./deploy.sh, which fetches runtime configuration from Doppler itself and drives docker compose.

One-time setup before the workflow can be used:

  1. In Tailscale, create an OAuth client scoped to a dedicated tag (e.g. tag:ci-deploy) that can reach only the production host on port 22, and configure that tag's nodes as ephemeral so a run leaves no persistent tailnet device behind.
  2. In Doppler, create a new config named deploy under the boardreadyops project (separate from main/runtime — the workflow's token can never read the application's runtime secrets, which deploy.sh fetches on the host itself from a separate, read-only runtime-scoped token) containing:
  3. CLOUD_DEPLOY_SSH_PRIVATE_KEY — the private half of a dedicated SSH keypair, authorized only for the ubuntu account on the production host and used only by this workflow (not an operator's personal key).
  4. CLOUD_DEPLOY_SSH_HOST — the host's Tailscale IP or MagicDNS name.
  5. TAILSCALE_OAUTH_CLIENT_ID / TAILSCALE_OAUTH_CLIENT_SECRET — the OAuth client from step 1.
  6. Create a Doppler service token scoped to project boardreadyops, config deploy, and store it as the single GitHub Actions repository secret DOPPLER_TOKEN.
  7. Create a production GitHub Environment (Settings → Environments) so the workflow's environment: production reference resolves and the run appears in the deployments audit trail.

To use it: open the Actions tab, select cloud-deploy, click Run workflow. Leave dry_run at its default true to run ./deploy.sh build migrate web worker — this builds the image from the fast-forwarded checkout and exercises the Doppler/SSH/Tailscale path without touching the running containers. Set it to false to run ./deploy.sh up -d --build migrate web worker, the real deploy. After a successful real deploy, the workflow resolves the commissioned BOARDREADYOPS_PUBLIC_URL from the deploy configuration and fails closed unless representative / and /dashboard responses expose the browser-security header baseline (CSP framing/base/object restrictions, HSTS, nosniff, Referrer-Policy, Permissions-Policy, and X-Frame-Options). retire_superseded_images is a separate, default-off safety valve for a low-disk preflight: it can retire old runtime images only if a distinct verified rollback image was previously pinned; otherwise it fails closed. Before a real deployment, the workflow checks that the running web and worker containers use the same healthy image, then pins it as boardreadyops-rollback-safety:verified. Only after the new deployment and external browser-security smoke both succeed does it retire extra BoardReadyOps image tags, preserving the running image and this single proven prior image. Dry-run builds never pin a rollback or automatically retire runtime images. deploy.sh has no canary or automatic rollback of its own: a failed build fails the workflow before anything is replaced, but a failed up can leave the stack partially replaced — check docker compose -p boardreadyops-cloud ps on the host afterward if a real-deploy run fails.

Early live ownership preflight: Before a real deploy builds images, reclaims disk cache, pins rollback images, or invokes migrations, the workflow inspects running BoardReadyOps runtime containers. A different Compose owner (including a separately managed deployment), an unexpected active runtime, or missing/multiple commissioned web/worker instances blocks deployment with exit 78. For an explicitly pre-quiesced worker, exactly one commissioned web must be running and no commissioned worker may still run; the existing downstream image-retention check also requires exactly one stopped, clean-exit worker. The guard is read-only: it does not stop foreign containers, rewire ingress, copy their data, inspect credentials, or authorize a topology migration. A build-only dry run skips this live ownership preflight because it never starts runtime services. Resolve any different deployment owner through a separately reviewed, backup-backed single-owner cutover before a real deploy.

Production commissioning prerequisite: The cloud-deploy workflow requires one existing healthy web container and one healthy worker container using the identical runtime image before a real deploy can pin that image. A first installation or a partially replaced/unhealthy stack therefore fails before docker compose up and must be commissioned or recovered using the host runbook separately. Rebuilding an unchanged revision preserves an older distinct verified rollback if present. If no distinct rollback exists and the rebuilt image ID remains identical, successful post-smoke image retirement reports a no-op instead of failing the deployment; the opt-in low-disk preflight still refuses retirement without a distinct rollback.

Host deploy runbook image pinning (separate approval)

An older host-local /home/ubuntu/boardreadyops-cloud/deploy.sh can unconditionally assign BOARDREADYOPS_IMAGE_TAG from its Git checkout. This breaks the image-identity guarantee for the repository commissioning workflow and policy migration when the live runtime image uses a different commit SHA from the checked-out source. Do not try to work around this mismatch by weakening image-ID validation or forcing container recreation.

Run bash scripts/repair-cloud-deploy-image-pin.sh --check from the verified repository checkout as the ordinary commissioned deployment user. It only checks the owner-owned wrapper's exact known assignment and Bash syntax; it returns code 2 for a legacy wrapper and code 0 for the verified corrected contract, without changing files. The script does not access the runtime token, print Doppler configuration, open credentials, or use Docker. --apply is a separate production-authorized operator action, not triggered by PR merge or regular deployment. It replaces only the exact known assignment using an atomic file swap, retains a mode-0600 backup, and preserves current deploy behavior when no explicit tag is supplied. An explicit image tag must be a 40-character lowercase Git SHA; the existing commissioning preflight additionally verifies the tag refers to the actual running image ID.

The script's guarded --rollback refuses if the wrapper changed since repair or if the policy's new bind-mount source is already active, preventing silent loss of required image pinning. Apply only after recording the current running image ID/tag and approving the production change separately; afterward, re-run --check and read-only Compose rendering with a proven live tag before any independently authorized migration or restart. Never edit the root-owned policy directory or touch secret-bearing runtime files as part of this fix.

Legacy release-policy bind mount migration (explicit production operation)

The release-repository policy is non-secret; the runtime token and secret-bearing Compose environment stay outside this migration. Existing hosts can have a root-owned /opt/boardreadyops-cloud/release-repositories file that the deploy account cannot atomically replace. The destination /home/ubuntu/boardreadyops-cloud/release-repositories is already within the account's writable deployment root. Neither merging a PR nor routine cloud-deploy automatically migrates it.

The reviewed bash scripts/migrate-cloud-release-policy.sh is an operator-only script from the repository checkout. Its default --check validates the existing mount, exact running image, policy contents/readiness, and a consistent two-service override. It also checks that a proposed replacement Compose configuration preserves the pinned image. Separately approved --apply copies only the non-secret policy, preserves the old root-owned file and a mode-preserved legacy override backup, atomically switches the override and recreates only web/worker. Failure triggers an attempted rollback, including health/mount checks; a failed rollback is explicitly reported. --rollback is available after a successful cutover only while the original and migrated policy contents still match, retaining the new file until reviewed. A later repository-grant change requires explicit reconciliation rather than silently dropping new grants.

Precondition: historical host-local deploy.sh wrappers may unconditionally replace a caller-supplied BOARDREADYOPS_IMAGE_TAG with the Git checkout SHA. The script detects the mismatch by parsing the effective Compose configuration in memory and fails before mutation, rather than risking an unintended runtime change. Updating a host-local wrapper requires separate production approval. Do not disable the preflight or print potentially sensitive Compose JSON. cloud-deploy selects the known old/new source based on the actual override contents; unexpected or mixed sources fail closed.

When repository rollout has been commissioned into the non-secret policy-file topology, the host also contains /home/ubuntu/boardreadyops-cloud/compose.release-policy.yml. cloud-deploy automatically reuses that file as an additional -f argument to the existing deploy.sh wrapper for rehearsals and real deploys, and verifies the web/worker mount after a real deploy. The workflow does not rewrite deploy.sh, compose.cloudflared.yml, or the secret-bearing runtime configuration.

Disk on the build host

Every deploy builds a new boardreadyops-web-runtime:<commit-sha> image on the host and leaves the previous ones in place, because the rollback procedure below depends on the previous image still existing. Build cache accumulates alongside them. Left alone, the host eventually fills up and docker compose build fails part-way through the export with no space left on device — which reads as a build failure rather than a capacity problem, minutes into the run.

The cloud-deploy workflow checks free space before it builds. Below 12 GiB it treats BuildKit cache as disposable and fully reclaims it before touching any tagged rollback image, then removes dangling image layers:

docker builder prune --all --force
docker image prune --force

After every successful build, including dry_run, the workflow enforces the normal 3 GB BuildKit cache cap with docker buildx prune --all --force --max-used-space 3GB --reserved-space 1GB. The explicit --reserved-space is essential on VPS installations whose default Docker Engine BuildKit GC policy reserves ~13 GiB and would otherwise keep well above the 3 GB target. This controls unused build cache only; it is not a hard filesystem quota and does not delete container images, stopped containers, volumes or application data. If cache budget enforcement fails, the workflow reports a failure rather than silently allowing unbounded build garbage; for a real deploy, inspect the live stack because replacement may already have occurred. Every successful build prints an aggregate disk and BoardReadyOps image summary after cleanup, so gradual growth is visible on normal deploys as well as low-space preflights. Repeated rehearsals still build on the production host, so this keeps useful recent cache during normal operation without letting a low-space preflight fail while safe-to-delete cache still occupies the build floor. Before retiring tagged runtime images, the workflow checks the running web and worker containers and reads their actual Docker image references. Missing or unrecognized runtime identities stop cleanup without deleting any images; invalid Compose image-list formatting is not treated as an empty running set. Image cleanup is deliberately separate from cache trimming. A dry-run builds an image but neither validates it as a deploy nor changes runtime-image retention; repeated rehearsals can still accumulate tagged build results. For a real deploy, the previously healthy runtime is pinned before container replacement, and obsolete BoardReadyOps runtime tags are retired only after the external browser-security smoke succeeds. A low-space preflight can reclaim tagged runtime images only with explicit operator opt-in and an existing distinct verified rollback pin.

Tagged runtime images are not touched by cache GC and remain governed by the rollback retention policy below. If the host is still short after safe reclaim, the default behavior remains fail-closed with exit 78. An operator may explicitly enable retire_superseded_images for a bounded, fail-closed reclaim: both current web/worker containers must be healthy and use one identical image, and a different image must already carry the boardreadyops-rollback-safety:verified tag from a previous healthy deployment. A separate boardreadyops-rollback-safety:smoke-verified tag records the last successful external browser-smoke image without keeping a third image. If the latest release passes container health but fails browser smoke, subsequent deployments keep the last smoke-verified image pinned instead of promoting the failed release. The post-smoke confirmation checks the deployed Git revision before updating that marker; only then may image retirement run. If the successful marker is absent while an older rollback pin exists, cleanup and deployment pinning fail closed rather than guessing which release was good. Only surplus boardreadyops-web-runtime:<sha> and boardreadyops-rollback-safety:pre-* tags can be removed. No Docker volumes, shared images, or container references are removed. Without the verified rollback pin, the preflight stops rather than guessing from tag recency. The ordinary success path retires surplus image tags only after the browser-security smoke, keeping the active image and exactly one previously healthy image. When rebuilding the currently running revision, the workflow preserves an existing distinct rollback pin rather than overwriting it; if the image ID is unchanged and no distinct pin exists, the post-smoke retirement is a no-op, while low-space preflight still refuses deletion. A migration that cannot be reversed with the prior application image still requires a separate database rollback and recovery procedure. An image still referenced by a stopped container is kept. The workflow never broad-prunes volumes or arbitrary Docker images. If the host is still below the 12 GiB floor afterward, it emits the aggregate docker system df summary plus only the BoardReadyOps runtime-image count and total MiB; it never emits docker system df -v or per-image, per-volume, or per-container names. The run then stops with exit 78 so volumes, logs, or the retained rollback set remain an explicit operator decision.

To see what is holding the space:

docker system df -v
docker image ls boardreadyops-web-runtime

Keep the running image and at least one previous image as a rollback target. Retire the rest:

docker image rm boardreadyops-web-runtime:<superseded-sha>

Check which one is live first — docker compose -p boardreadyops-cloud images — so a rollback target is never the thing removed.

Independent worker scaling

The lifecycle and outbox batch limits are independent from the web process. Scale worker replicas only after accounting for database connections and GitHub API throughput:

docker compose --env-file deploy/.env -f deploy/docker-compose.yml up -d --scale worker=2

BOARDREADYOPS_WORKER_CONCURRENCY and BOARDREADYOPS_OUTBOX_CONCURRENCY cap each replica's claimed batch. The shared in-process gate then caps concurrent work per installation and repository across both loops. These scoped limits are per replica, so the effective upper bound is the configured limit multiplied by the number of replicas. Database leases preserve single ownership of each job/effect; they do not provide a distributed GitHub API rate limiter.

Recommended initial values are four lifecycle jobs, four outbox effects, four operations per installation, and two operations per repository per replica. Increase them only with queue-lag, GitHub rate-limit, database pool, and readiness data.

Outbound notifications

Notification channels are configured per installation under Settings → Notifications and deliver to Slack incoming webhooks, any HTTPS endpoint the customer controls, or — when this deployment has an SMTP relay — an email address. The worker drains the delivery outbox every BOARDREADYOPS_NOTIFICATION_DELIVERY_INTERVAL_MS and scans for time-based events — a waiver about to lapse, a review left awaiting a decision — every BOARDREADYOPS_NOTIFICATION_SCAN_INTERVAL_MS. Both are safe to leave at their defaults.

Two operational notes:

  • Deep links need BOARDREADYOPS_PUBLIC_URL. Without it notifications still deliver, but carry no link back to the run or review.
  • Delivery is leased and retried like every other outbound effect. A destination that answers 4xx in a way retrying cannot fix (401, 403, 404, 410 — typically an uninstalled Slack app) is dead-lettered immediately and its failure is shown on the channel in Settings, rather than retried until it ages out. Transient failures back off and retry. A slow or failing destination cannot delay a release run or a supply-watch pass: enqueueing is one INSERT on the transaction that produced the news, and delivery happens on the worker.

Email is optional and gated on configuration. Set BOARDREADYOPS_NOTIFICATION_SMTP_URL (smtp:// or smtps://, credentials in the URL when the relay needs them) and BOARDREADYOPS_NOTIFICATION_EMAIL_FROM together. With either missing, the email kind is absent from the Settings form and refused by the API, so a customer cannot create a channel this deployment has no way to deliver to. If a deployment removes the settings while email channels still exist, those channels dead-letter with an explanation on the channel rather than failing the delivery pass. A 5xx from the relay is a permanent refusal; a 4xx or a connection failure backs off and retries.

Scaling worker replicas scales notification delivery with them; for update ... skip locked on the outbox keeps two replicas from delivering the same message twice.

Rolling deployment and rollback

Use an application-first rolling deployment:

  1. Apply forward-compatible additive migrations once.
  2. Deploy and verify the web canary.
  3. Replace the web container.
  4. Withdraw one worker replica from readiness and terminate it with SIGTERM.
  5. Allow active leases to drain, then start the new worker image.
  6. Verify /health/ready, queue metrics, and outbox lag before replacing additional replicas.

For rollback, stop new worker replicas, deploy the previous compatible immutable image for web and worker, and retain the current database schema. Do not automatically reverse migrations. Any work left by a killed replica becomes available after lease expiry. Reconciliation-required workflow dispatches remain operator-controlled and must not be blindly replayed.

Supported environment overrides:

BOARDREADYOPS_CLOUD_CONTAINER=bro-web
BOARDREADYOPS_CLOUD_WORKER_CONTAINER=bro-worker
BOARDREADYOPS_CLOUD_HEALTH_URL=https://boardreadyops.example.com/api/health
BOARDREADYOPS_CLOUD_CANARY_HEALTH_URL=http://127.0.0.1:3004/api/health
BOARDREADYOPS_CLOUD_IMAGE_REPOSITORY=boardreadyops-web-runtime
BOARDREADYOPS_CLOUD_RUNTIME_ENV_FILE=/opt/boardreadyops-cloud/runtime-env
BOARDREADYOPS_CLOUD_ARTIFACT_VOLUME=boardreadyops_artifacts
BOARDREADYOPS_CLOUD_NETWORK=boardreadyops-cloud
BOARDREADYOPS_CLOUD_LIVE_PUBLISH=127.0.0.1:3003:3000
BOARDREADYOPS_CLOUD_CANARY_PUBLISH=127.0.0.1:3004:3000
BOARDREADYOPS_CLOUD_REVISION=<git-sha>
BOARDREADYOPS_CLOUD_SKIP_INSTALL=1
BOARDREADYOPS_CLOUD_DRY_RUN=1
BOARDREADYOPS_CLOUD_HEALTH_ATTEMPTS=60
BOARDREADYOPS_CLOUD_HEALTH_DELAY_MS=1000
BOARDREADYOPS_WORKER_CONCURRENCY=4
BOARDREADYOPS_WORKER_INSTALLATION_CONCURRENCY=4
BOARDREADYOPS_WORKER_REPOSITORY_CONCURRENCY=2
BOARDREADYOPS_WORKER_POLL_MS=1000
BOARDREADYOPS_OUTBOX_CONCURRENCY=4
BOARDREADYOPS_OUTBOX_POLL_MS=500
BOARDREADYOPS_NOTIFICATION_DELIVERY_INTERVAL_MS=30000
BOARDREADYOPS_NOTIFICATION_SCAN_INTERVAL_MS=3600000
BOARDREADYOPS_NOTIFICATION_SMTP_URL=smtps://user:password@smtp.example.com:465
BOARDREADYOPS_NOTIFICATION_EMAIL_FROM=boardreadyops@example.com
BOARDREADYOPS_WORKER_METRICS_INTERVAL_MS=30000
BOARDREADYOPS_WORKER_RETENTION_CLEANUP_INTERVAL_MS=3600000
BOARDREADYOPS_RETENTION_CLEANUP_BATCH_SIZE=1000
BOARDREADYOPS_WEBHOOK_RETENTION_DAYS=30
BOARDREADYOPS_EPHEMERAL_RECORD_RETENTION_DAYS=30
BOARDREADYOPS_CONTROL_PLANE_HISTORY_RETENTION_DAYS=90
BOARDREADYOPS_RECONCILIATION_CONCURRENCY=2
BOARDREADYOPS_RECONCILIATION_POLL_MS=5000
BOARDREADYOPS_RECONCILIATION_DETECT_INTERVAL_MS=30000
BOARDREADYOPS_RECONCILIATION_OBSERVATION_SECONDS=300
BOARDREADYOPS_RECONCILIATION_DEADLINE_SECONDS=1800
BOARDREADYOPS_RECONCILIATION_NEXT_CHECK_SECONDS=60

The same reconciliation cadence covers internal webhook inbox/job drift, missed GitHub Actions callbacks, and terminal Check Run publication drift. Internal lifecycle repair uses lifecycle_job_missing and lifecycle_inbox_state_drift, treats control_plane_jobs.status as authoritative, and does not require GitHub credentials. Its logs never include normalized actions. The worker readiness payload reports lastLifecycleReconciliationPollAt, lastSuccessfulLifecycleReconciliationAt, lastCheckRunReconciliationPollAt, and lastSuccessfulCheckRunReconciliationAt separately so operators can distinguish database repair, publication repair, and workflow-state convergence.

For a dry run, provide the intended public health URL explicitly so the preview cannot inherit a retired deployment target:

BOARDREADYOPS_CLOUD_HEALTH_URL=https://boardreadyops.example.com/api/health \
  BOARDREADYOPS_CLOUD_DRY_RUN=1 pnpm run cloud:deploy:self-hosted

Signed artifact downloads

Hosted run dashboards expose artifact metadata without revealing the internal storage path. Public repository runs are readable from their opaque run identifier. Private repository runs fail closed before child evidence is queried unless the route supplies explicit repository authorization; the current public routes therefore return the same not-found surface for absent and unauthorized private runs. The investigation surface is split into summary, attempts, findings, artifacts, publication, and audit routes. Findings and artifacts are filtered and paged with bounded PostgreSQL queries; the audit route explains the separate operator-authenticated export rather than embedding tenant audit records in the public run page. A download link is rendered only when both NEXT_PUBLIC_APP_URL (or BOARDREADYOPS_PUBLIC_URL) and a dedicated ARTIFACT_DOWNLOAD_SIGNING_KEY are configured.

Generate an independent key with at least 32 random bytes:

openssl rand -base64 48

Store the result in the root-only runtime environment file:

ARTIFACT_DOWNLOAD_SIGNING_KEY=<generated-value>

The artifact signer does not fall back to SESSION_SECRET. URLs are bound to the run ID, artifact ID, and expiry, and are accepted for at most 15 minutes. Rotating the key immediately invalidates previously issued links. Local-file downloads also verify the resolved filesystem path remains inside ARTIFACT_STORAGE_ROOT and that the stored byte count matches the file before streaming it.

For a consolidated inventory of stored data, current defaults, deletion behavior, and known gaps, see Data lifecycle and privacy.

Database bootstrap and migrations

The self-hosted cloud control plane stores GitHub App installations, repositories, release runs, findings, artifacts, durable webhook jobs, and transactional outbox effects in PostgreSQL.

Compose and pnpm run cloud:deploy:self-hosted apply pending migrations before replacing live processes. For an explicit administrative run after DATABASE_URL is configured:

cd /opt/repos/boardreadyops-prod
pnpm --filter @boardreadyops/db db:migrate

Preview pending migrations without applying them:

cd /opt/repos/boardreadyops-prod
pnpm --filter @boardreadyops/db db:migrate:dry-run

The migration runner records applied versions in cloud_schema_migrations; migrations are designed to be idempotent and safe to re-run.

PostgreSQL backup verification and restore drill

The initial GitHub Cloud GA engineering targets are a 15-minute recovery point objective for PostgreSQL state and a 60-minute recovery time objective from incident declaration to an isolated, database-backed ready service. These are validation targets, not a contractual service-level agreement. They must be revisited after measured backup duration, restore duration, database size, and queue-recovery evidence are available.

Recovery-objective scope is explicit for artifact handling:

  • Artifact metadata follows the PostgreSQL recovery objective. Artifact rows, execution-attempt bindings, retention deadlines, checksums, byte counts, and internal locators are PostgreSQL state, so they share the 15-minute RPO and 60-minute service RTO targets above.
  • In explicit runner metadata-only mode, no BoardReadyOps-managed artifact-byte RPO or RTO applies because report bytes are never uploaded to the control plane. Any customer-managed export or retention target remains outside the BoardReadyOps control-plane recovery objective.
  • If runner control-plane mode uses the currently supported local artifact driver, optional managed report bytes have the same 15-minute artifact-byte RPO target. Restoring the encrypted artifact volume and verifying retained object availability must complete inside the same 60-minute service RTO. This target is not satisfied by the PostgreSQL drill alone: the deployment must have a separately tested volume snapshot/backup and restore procedure before managed artifact-byte recovery is considered GA-validated.
  • Non-local artifact storage drivers are not currently supported by the managed runtime paths documented here, so this deployment profile makes no GA recovery claim for external object storage. Do not infer an S3, R2, Vercel Blob, or other provider recovery guarantee from the PostgreSQL objectives.

pnpm run cloud:backup:verify creates a native custom-format PostgreSQL backup and restores it into a separately provisioned database. The restore database must be empty, must not be the source database, and should use the same PostgreSQL major version as production. The verifier refuses a relative backup path, an existing backup file, a non-empty target, a source schema that is behind the repository migration set, or a restore whose migrations, public tables, or representative row counts differ from the source.

Create a fresh isolated target database with dedicated credentials. Do not point the verifier at a shared staging database, a production replica, or any database containing retained data. Supply database URLs at execution time from Doppler or an equivalent restricted secret injection path; do not add these one-shot values to deploy/.env, repository files, shell history, CI artifacts, or logs. Passwords are passed through PostgreSQL client environment variables and are not included in pg_dump or pg_restore command arguments.

export BOARDREADYOPS_BACKUP_SOURCE_DATABASE_URL='<injected-source-url>'
export BOARDREADYOPS_BACKUP_RESTORE_DATABASE_URL='<injected-empty-restore-url>'
export BOARDREADYOPS_BACKUP_PATH='/restricted/boardreadyops-control-plane.dump'
export BOARDREADYOPS_BACKUP_RESTORE_CONFIRMATION=isolated-empty-database
pnpm run cloud:backup:verify

The command requires pg_dump and pg_restore, uses --format=custom, --no-owner, --no-privileges, and --exit-on-error, creates the dump with mode 0600 without inheriting unrelated service secrets, and emits only a bounded JSON summary containing backup size, migration count, public-table count, and aggregate representative row counts. It does not print connection strings, tenant identifiers, repository names, findings, payloads, artifact paths, or database command output.

After the automated restore succeeds, complete the service-readiness portion of the drill in the isolated environment:

  1. Point an isolated web and worker deployment at BOARDREADYOPS_BACKUP_RESTORE_DATABASE_URL; do not change the production deployment.
  2. Run pnpm --filter @boardreadyops/db db:migrate:dry-run and require no unexpected pending or divergent migration.
  3. Start the isolated web and worker processes from the same immutable release image as production.
  4. Require the web health endpoint and worker /api/health/ready response to report ready.
  5. Verify a known restored run and attempt through tenant-scoped database or dashboard access without exposing private findings or source content.
  6. Record backup age, dump duration, restore duration, readiness duration, database size, and any reconciliation backlog in the private operational evidence system.
  7. Destroy the isolated database and restricted backup file after evidence capture unless a documented retention or legal-hold requirement applies.

This verifier covers PostgreSQL schema and representative control-plane state. It does not verify optional managed artifact bytes, local artifact-volume snapshots, external object storage, reverse-proxy logs, platform logs, or backup-provider retention. Those storage classes require separate encrypted backup, restore, expiry, and deletion-proof drills before issue #222 can be closed.