Deployment
How each component of the Qubital system is built and deployed.
Component map
| Component | Runtime | Registry | Deploy trigger |
|---|---|---|---|
Go backend: api + Centrifugo broker | Northflank (qubital-staging, qubital-prod) | GHCR, by digest | Staging: every merge to main. Prod: the promote workflow |
Observability agent (alloy) | Northflank (qubital-prod) | GHCR, by digest | A dispatch of qubital-observer's workflow |
Web app (webapp) | Northflank (qubital-staging, qubital-prod) | GHCR, by digest | Staging: every merge to main. Prod: the release workflow (Web and Desktop Release) |
| Desktop app (Windows, Mac) | People's machines; updates from releases.qubital.space (Cloudflare R2) | — | The release workflow, with the web app (Web and Desktop Release) |
| office-router Worker | Cloudflare Workers | — | wrangler deploy |
| upload-worker | Cloudflare Workers | — | wrangler deploy |
| Recording pipeline (livekit-listener + video-upload-job) | Google Cloud Run | GCP Artifact Registry | Manual (workflow_dispatch) |
The staging web app, app.qubital-test.com, is private to the team: Staging Web App Access explains how.
Backend, alloy and web app on Northflank (GitOps)
The decision and its alternatives are in ADR-0006.
How it works
qubital-infraholds the desired state. It has one Northflank template file per deploy unit:<env>/project.json,<env>/redis.json,<env>/backend.json(broker + api),<env>/webapp.jsonand prod'salloy.json. Each file is linked to a Northflank template, so a merge to itsmainthat touches a file is a deploy.- Producers build,
qubital-infradeclares, Northflank applies. Backend, web app and observer CI push images to GHCR, then commit the new digest to the file through the GitHub Appqubital-infra-deployer. Northflank syncs the file and runs its template. - verify checks every deploy. After each push to
qubital-infra, itsverifyworkflow checks that the template synced, the run succeeded, every service runs the file's image, and nothing restarted that shouldn't have. A producer job goes green only when verify does. - Images are pinned by digest, so prod runs the exact bytes staging ran.
- Secret values live only in Northflank secret groups.
qubital-infralists their names, never their values.
merge to qubital-backend main
→ build api (and the broker, only when centrifugo/ changed) → GHCR
→ commit the broker digest to staging/backend.json → Northflank runs it → verify
→ commit the api digest → Northflank runs it → verify → /health → job green
promote (manual, from main, a version)
→ guards (staging proof, validate, version, scans, API contract)
→ copy the api image to the prod package by digest
→ commit broker, then api digests to production/backend.json → Northflank → verify
→ /health → git tag v<version> + GitHub Release + prod API contract
Staging
- Every merge to
qubital-backend'smaindeploys staging; a docs-only merge deploys nothing. The CI page covers what runs before. - The broker rebuilds and restarts only when a build input in
centrifugo/changed (anything but its README and.env.example). A broker restart drops every WebSocket; clients reconnect. - From merge to live usually takes 3 to 6 minutes.
Prod
- Only through the promote ("Prod - Promote Staging Image to Prod" in
qubital-backendActions), dispatched frommainwith a staging commit and a version. Run it withdry_runfirst. Steps: Release the Backend to Prod. - The promote refuses a commit staging didn't run and verify (
verified), a version not above every published one, a prod image staging never ran, a breaking API change without a major version, and an image with a fixable HIGH or CRITICAL vulnerability. - DB migrations run at the api's boot and are one-way.
Alloy
Dispatch "Build, scan and deploy qubital-observer (prod)" in qubital-observer with a version not yet published. It builds the image, blocks on fixable HIGH or CRITICAL vulnerabilities, writes the digest into production/alloy.json and waits for verify.
Web app
The whole path, with the desktop app, the release's checks and the charts, is in Web and Desktop Release. The steps are in Release the Web and Desktop Apps and Hotfix the Web and Desktop Apps.
- Staging: every merge to
qubital-apps'maindeploysapp.qubital-test.com("ci: web app to staging"), private to the team behind Cloudflare Access (Staging Web App Access). A merge where every changed file is underapps/website/or is a.mdfile deploys nothing. - Prod: only through the release ("release: web and desktop" in
qubital-appsActions). Itscandidatestage copies the image staging ran to the prod package by digest, so prod runs the same image; itspublishstage deploys it toapp.qubital.space, which is public.
The rules
- Never edit a template or a service in the Northflank UI. Change the file in
qubital-infrathrough a pull request. A service edit is silently reverted by the next deploy, and a template edit pushes the whole file tomainunreviewed. The only exception is break-glass. - Never put a secret in git. Edit secret values in their secret group, then restart dependents in the same sitting: a saved value goes live at the next restart of any kind, untested.
- Staging first. A config change that applies to both environments goes to staging, then prod. Staging and prod declare the same env keys; values differ.
- Release prod only through each component's workflow: the promote for the backend, the release for the web app, the dispatch for alloy. If a promote or a release fails, fix the cause, then use Re-run all jobs, never "Re-run failed jobs": their jobs refuse a partial re-run. The header of
qubital-apps'release.ymllists what a re-run of the release can't finish. - A red verify stops the line. Find out why before the next deploy: Deploy Failed: verify Is Red.
Where each change goes
| Change | Where |
|---|---|
| Backend image | Automatic: every merge to main deploys staging; prod by the promote |
| Web app image | Automatic: every merge to main deploys staging; prod by the release (Release the Web and Desktop Apps) |
| Web app runtime value, release flag | A pull request to qubital-infra, or to qubital-apps for a flag (Change a Web App Setting or Release a Flag) |
| Env value, ports, domains, plan, health checks | A pull request to qubital-infra (Add an Environment Variable) |
| Secret value | Northflank → project → Secrets → the group, then restart dependents; a release secret: gh secret set in qubital-apps (Rotate a Secret) |
| Roll back | git revert of the deploy commit in qubital-infra (Roll Back a Deploy) |
| New service | A pull request adding its node, its secret group created first; the owner links new files |
| Restart, logs, shell | Northflank UI |
| Template or service settings in the UI | Nobody, except break-glass |
Further reading
qubital-infraREADME: the repo layout, the rules and the common changes.qubital-infraarchitecture: the design on one page, with diagrams, what verify checks and the static rules.
Cloudflare Workers
Both Cloudflare Workers (office-router and upload-worker) are deployed via the Wrangler CLI. There is no automated CI/CD pipeline for them — deployments are manual.
# From the qubital-workers repo root
pnpm deploy --env production # office-router or upload-worker
Each worker has staging and production environments defined in its wrangler.jsonc.
Recording pipeline — Google Cloud Run
The recording pipeline lives in qubital-workers/pkg/google-cloud-uploader/ and is deployed to Google Cloud Run via the build-publish.yaml workflow (workflow_dispatch).
One Docker image is built and deployed as two distinct components:
| Component | Type | Entry point | Purpose |
|---|---|---|---|
livekit-listener | Cloud Run Service (always-on) | dist/service.js | Receives egress_ended webhooks from LiveKit, triggers the upload job |
video-upload-job | Cloud Run Job (on-demand) | dist/job.js | Fetches recording from R2, uploads to YouTube, logs to Google Sheets, notifies Slack |
Both run under the video-sa GCP service account. The image is pushed to GCP Artifact Registry before deployment.
Recording pipeline flow
LiveKit Cloud
│ egress_ended webhook
▼
livekit-listener (Cloud Run Service)
│ triggers
▼
video-upload-job (Cloud Run Job)
│ fetches file from Cloudflare R2 (temporary recording storage)
│ uploads to YouTube as unlisted video
│ logs entry to Google Sheets
│ sends link to Slack