Skip to content
Docs
Changelog

CI and the runner

Every workflow job runs on the self-hosted VPS runner, never on a GitHub-hosted one: what the runner image offers, what each job adds, and the rules a job follows on a shared machine.

Markdown

The rule

All CI runs on the self-hosted VPS runner. GitHub-hosted runners are never used. The repository is private, so every minute on ubuntu-latest (or any other hosted label) is billed; the owner decided on 2026-11-28 that the project pays no GitHub Actions bill. Every job of every workflow under .github/workflows/ therefore says:

runs-on: [self-hosted, vps]
timeout-minutes: 30

A job the runner cannot run is disabled (if: false, with a comment that names what the image lacks) and keeps the same runs-on, so enabling it again cannot bring a hosted runner back. It is never moved to a hosted runner, not even for one run.

[test] scripts/ci-runners.test.mjs (in pnpm test) fails on a runs-on that is not exactly [self-hosted, vps] (disabled jobs included), a job without timeout-minutes, services: or container:, a workflow called from another repository, a workflow without a concurrency group, and a preview job that is not limited to pull requests into main. scripts/preview-workflow.test.mjs holds the trust zones.

The runner

The runner is one ephemeral Docker container per job on the owner's VPS, started by vps-runners-agent from the image vps-runner:latest (the private repository CarlosZiegler/vps-runners holds its Dockerfile). Two jobs run at once; each has 8 CPU cores, 16 GB of memory and an 8 GB memory-backed /tmp. A third job waits in the queue. A project made from this template points runs-on at its own runner with the same label, or builds one from that image.

The image hasThe image does not have
Ubuntu 24.04, git, curl, jq, unzip, build-essential, Python 3A Docker daemon: no services:, container: or Docker actions
Node 24 in the tool cache (actions/setup-node resolves it without download)PostgreSQL 15 or 18 (the RLS matrix installs them, see below)
The pinned pnpm (its default store on /cache is not used, see the rules)Chromium and its system libraries (the e2e job installs them)
PostgreSQL 16 server binaries on PATH (initdb, pg_ctl, psql)wrangler, gh (Wrangler comes from the lockfile or its action)
Passwordless sudo inside the containerAccess to the VPS, its private network or other containers

So a workflow skips pnpm/action-setup: pnpm is already there. It also skips cache: pnpm, for the reason every job has a package store of its own (below).

What each job needs

WorkflowJobRuns onAdds to its own container
ci.ymlchecksevery pull requestnothing
ci.ymlrls-matrixevery pull requestPostgreSQL 15 and 18 from apt.postgresql.org
e2e.ymlwebsame-repository pull requests, mainChromium with its system libraries (--with-deps)
pr-preview.ymlprovisionpull requests into mainnothing (its own package store)
pr-preview.ymlbuildpull requests into mainnothing (its own package store)
pr-preview.ymldeploypull requests into mainthe lockfile's Wrangler, under /tmp
pr-preview.ymlcleanupclosed pull requests into mainnothing (its own package store)
deploy-prod.ymlprodpush to mainnothing (Wrangler through wrangler-action)
delete-deploy.ymldelete, rejectmanualnothing (curl)
emergency-shutdown.ymltoggle, rejectmanualnothing (curl, jq)

What a job installs with apt lands in its container and is removed with it. Baking PostgreSQL 15 and 18 and the Chromium libraries into the image would save that download on every run; the jobs already skip what they find.

The RLS matrix without Docker. rls-matrix.mjs has one seam, startPostgres(version), with two adapters. docker (the default, for a laptop) starts a postgres:<major> container per server. native starts an initdb/pg_ctl cluster per server in the temp directory from each major's own binaries (PG_BIN_<major>, then /usr/lib/postgresql/<major>/bin, then Homebrew's postgresql@<major>), which is what CI uses:

pnpm --filter @fofo/db test:rls-matrix -- --driver native

Both accept the same password over TCP, so the suites are identical. See database.

Previews only for pull requests into main. A preview rehearses the production deploy with the Neon parent branch and domain of main. A pull request into another branch (an integration branch, a stacked pull request) gets none; before this rule it failed after it had created a database branch. cleanup runs when a pull request into main closes: the trusted jobs need an environment that accepts main alone. It first asks GitHub whether the pull request is still closed, removes what was recorded when the preview was provisioned, and then sweeps the previews of other closed pull requests (one retargeted away from main, one whose cleanup failed). See deployment.

Rules for a job

The runner is shared by every private repository of the account, and two jobs run side by side.

  • A timeout on every job. A hung job holds one of two slots; the agent only kills it after six hours.
  • A concurrency group on every workflow. Pull request workflows cancel the superseded run (cancel-in-progress); deploys and preview operations never cancel, because a run stopped halfway leaves a Worker, a Hyperdrive or a database branch behind.
  • Nothing outside the workspace and /tmp. The container, its processes, its ports and its file system disappear with the job. The /cache volume does not, so no job writes to it: every job that installs sets pnpm_config_store_dir to .pnpm-store in its own workspace. The image's shared store would hand what one job wrote, a pull request's code included, to the next job of any repository. The cost is one download per job.
  • No cache on main. A pull_request_target run executes pull request code and saves caches into the default branch's scope, the one a push to main restores from. The e2e job restores its browser cache on pull requests only; jobs that hold a credential use no cache. Every setup-node step sets package-manager-cache: false.
  • Secrets in files go to /tmp, never to the workspace or runner.temp. Both sit on the /cache volume while the job runs, where the other running job can read them; /tmp is the job's own. The file lives in a directory the job creates with mode 0700 and removes in an always() step. Checkouts of jobs that hold deploy secrets use persist-credentials: false.
  • No connection string in GITHUB_ENV or in a job output. The runner keeps both as files under runner.temp. A value one job hands to the next crosses the job output sealed (scripts/preview-handoff.mjs) and is masked where it is opened.
  • Local servers stop with the step. scripts/test-local-postgres.mjs, scripts/e2e-stack.mjs and the RLS matrix stop their clusters on every exit path and keep them under /tmp.
  • No Docker. A job that needs a database starts a native cluster with scripts/test-local-postgres.mjs.

Trust zones

A pull request's code is not trusted with anything that outlives its preview. pr-preview.yml runs on pull_request_target, so the workflow file comes from main and a pull request cannot rewrite a job; every job refuses a fork.

JobCode it runsHolds
provision, cleanupmain onlyNeon API key, Cloudflare token (environment preview-provision)
buildthe pull request, after main's stepsthe preview's own database URLs (environment preview), a read-only GitHub token
deploymain onlyCloudflare token, preview secrets (environment preview-provision)
prod (deploy-prod.yml)main onlyproduction secrets (environment production)
  • Pull request code never holds the Cloudflare token. build migrates and builds, then hands its output on as one archive. deploy runs none of it: scripts/preview-deploy.mjs checks the archive's SHA-256 against the one build reported, unpacks it with its own reader (files and directories under server/ and client/, no link, no path outside) and validates the Wrangler configuration the build wrote.
  • A preview's name, bindings, variables, routes and triggers come from main (scripts/preview-worker-config.mjs); a pull request contributes the shape only: entry point, compatibility date and flags, assets, placement, observability, limits. A built configuration that changes a setting, binds or routes anything else, names an account, sets a build command or turns bundling on stops the deploy. Wrangler starts on a configuration and in a directory deploy wrote (it loads .env from its working directory), with the token and nothing else of the job's environment.
  • deploy writes the preview comment, from an address it derived. build has contents: read only.
  • build writes its configuration with main's script, kept outside the workspace before the pull request is checked out, so a head of any age builds the same way.
  • No preview job receives the production database URL. The isolation check compares against the PRODUCTION_DATABASE_TARGET variable (postgresql://<host>/<database>, refused with a user or password).
  • provision hands on only the preview URLs, sealed with PREVIEW_HANDOFF_KEY for that pull request and run. build opens them with main's reader before it checks out the pull request, into a file under /tmp; deploy opens them in memory.
  • deploy executes nothing from the workspace. It fetches main into its own directory under /tmp, installs the lockfile's Wrangler there without install scripts, and downloads the archive there.
  • Secrets live in environments limited to main, never in the repository. A repository secret is handed to every job of every workflow, one a pull request or a pushed branch changed included. Each job reads its secrets from its own environment; preview holds PREVIEW_HANDOFF_KEY alone. pnpm run setup --github-secrets publishes each secret to its environment (SECRET_ENVIRONMENTS in packages/project-setup-cli/src/secrets.mjs), refuses one that accepts any branch but main and removes the repository-scoped copy.

A pull request that needs a new binding gets its preview once the binding is on main.

Runner isolation

The rules above are what a job can do by itself. The runner must do the rest, and this is its target layout (set up on the VPS by the owner, not by a workflow):

Path in the containerTarget
workspace and runner.tempa directory created for the job, mounted into that container only, deleted with it
/cache/pnpm-storenot mounted (no job uses it); a shared store only as a read-only mount
Node tool cachepart of the image, or mounted read-only
/tmpthe job's own memory-backed mount, as today, mounted with exec

Until then two running jobs can read each other's workspace, so the workspace of a job never holds a secret; the runner itself still writes each step's script and each action there. deploy starts a native binary from /tmp and fails in its first step, with the reason, when /tmp is mounted noexec (Docker's default for --tmpfs).

Storage

The runner costs nothing per minute, but three GitHub stores still count against the account's included quota: the e2e report artifact (kept seven days), the preview build archive (kept one day) and the Playwright browser cache (actions/cache, pull requests only). Both are small; lower retention-days before adding another artifact.

Key files

Edit on GitHubDocumentation is in English.
Cookie settings
We use essential cookies to make our app work. With your consent, we also use optional cookies to improve your experience.

Read our Cookie Policy and Privacy Policy.