vole
Site
Clone
Read only, no credentials:
https://rodent.software/vole.git
Write over SSH with a registered key:
git clone ssh://git@rodent.software/vole.git
Self-hosted forge that lives in your Git repo.
Restructure documentation around reader tasks
348a43c364fbb04be834af44a7cd43a0931fa280 · Keenan Nemetz · 20d ago · parent b7383c19
Restructure documentation around reader tasks Group the site by getting started, collaboration, CI, publishing, and administration. Rewrite the guides as executable procedures and move issue formats, merge semantics, configuration defaults, customization, and access-control mechanics into dedicated references. Verify the quickstart and review flow against a throwaway instance, execute the service recipe, inspect the rendered site, and run the complete verify workflow. Closes: 01M7B6X6RDYBAP3JVA5SYSA1K8
docs/deploy/runner.md +130−147
| @@ -1,75 +1,97 @@ | |||
| 1 | # CI runners | ||
| 2 | |||
| 3 | A runner is a machine that leases jobs from your instance over SSH, runs each job | ||
| 4 | in a container, and reports the result. It is a second machine, never the forge's | ||
| 5 | own: it executes repository code and can read every secret its jobs declare, so it | ||
| 6 | should not share a disk with the account database and the SSH host key. | ||
| 7 | |||
| 8 | Give it its own machine the same way you created the forge — a rendered first-boot | ||
| 9 | file pasted into the console — or set one up on a machine you already have. Either | ||
| 10 | way there is one step only an admin can do, and it is per repository. | ||
| 11 | |||
| 12 | ## Create a runner machine | ||
| 13 | |||
| 14 | Create a server the way [Deploying § Create the machine](index.md#create-the-machine) | ||
| 15 | describes, with three differences: the runner's file instead of the forge's, no | ||
| 16 | inbound ports except 22, and a disk sized for container images. | ||
| 1 | # Set up a CI runner | ||
| 2 | |||
| 3 | Run CI on a separate machine from the forge. A runner executes repository code | ||
| 4 | and can read every secret its jobs declare, so it should not share storage or | ||
| 5 | credentials with the account database and SSH host key. | ||
| 6 | |||
| 7 | You need a running Vole instance, an instance-admin SSH key, and an Ubuntu 24.04 | ||
| 8 | or Debian 13 machine that can reach the instance on TCP port 2222. These | ||
| 9 | instructions install the same Vole package as the server but enable only | ||
| 10 | `vole-runner.service`. | ||
| 11 | |||
| 12 | ## Create a runner with cloud-init | ||
| 13 | |||
| 14 | From a Vole source checkout on your computer: | ||
| 15 | |||
| 16 | 1. Render the runner's first-boot configuration: | ||
| 17 | |||
| 18 | ```sh | ||
| 19 | cd deploy/cloud-init | ||
| 20 | FORGE_HOST=forge.example.com \ | ||
| 21 | VOLE_PACKAGE_URL=https://rodent.software/vole/releases/v0.2.0/artifacts/vole_0.2.0-1_amd64.deb \ | ||
| 22 | ./render.sh runner > runner-user-data.yaml | ||
| 23 | ``` | ||
| 24 | |||
| 25 | `render.sh` requires `envsubst`, provided by `gettext-base` on Debian and | ||
| 26 | Ubuntu or `gettext` on other distributions. Inspect the rendered file before | ||
| 27 | using it. | ||
| 28 | |||
| 29 | 2. Create a machine with your provider and paste `runner-user-data.yaml` into its | ||
| 30 | user-data or cloud-config field. Use the same Ubuntu or Debian image and | ||
| 31 | package architecture. Allow inbound shell SSH on port 22 only from your | ||
| 32 | addresses; the runner makes outbound connections to the forge and container | ||
| 33 | registries. | ||
| 34 | |||
| 35 | Size memory for `RUNNER_JOBS × RUNNER_MEMORY`. Leave additional room for the | ||
| 36 | runner and host, and size disk for saved checkouts, caches, and OCI images. | ||
| 37 | |||
| 38 | 3. Wait for first boot to finish. Setup output is in | ||
| 39 | `/var/log/vole-runner-first-boot.log` on the runner. The configuration creates | ||
| 40 | an unprivileged `ci-runner` user, installs rootless Podman, generates the | ||
| 41 | runner's SSH key, pins the forge's host key, and enables the service. | ||
| 42 | |||
| 43 | First boot pins the first host key returned by `ssh-keyscan`. Before allowing | ||
| 44 | production jobs, compare `/etc/vole/runner_known_hosts` with the forge's host | ||
| 45 | key fingerprint through a trusted channel. Replace the file if it does not | ||
| 46 | match. | ||
| 47 | |||
| 48 | ### Runner cloud-init settings | ||
| 49 | |||
| 50 | | Variable | Default | Purpose | | ||
| 51 | |---|---|---| | ||
| 52 | | `FORGE_HOST` | required | Forge DNS name; port 2222 is used for SSH | | ||
| 53 | | `VOLE_PACKAGE_URL` | required | Debian package for the runner's architecture | | ||
| 54 | | `RUNNER_HOSTNAME` | `vole-runner` | Machine host name | | ||
| 55 | | `RUNNER_RUNTIME` | `podman` | OCI runtime | | ||
| 56 | | `RUNNER_NETWORK` | `bridge` | Maximum network offered to jobs | | ||
| 57 | | `RUNNER_DIR` | `/var/lib/vole-runner` | Checkouts, caches, and runner home | | ||
| 58 | | `RUNNER_LABEL_NAMES` | `linux` | Space-separated labels matched by `runs-on` | | ||
| 59 | | `RUNNER_JOBS` | `1` | Concurrent job slots | | ||
| 60 | | `RUNNER_MEMORY` | `4G` | Memory limit per job container | | ||
| 61 | | `RUNNER_PIDS` | `2048` | Process limit per job container | | ||
| 62 | | `RUNNER_TMPFS` | `1G` | Memory-backed `/tmp` size per job | | ||
| 63 | | `RUNNER_DISK_RESERVE` | `2G` | Free space preserved below `RUNNER_DIR` | | ||
| 64 | |||
| 65 | The unit's `MemoryMax=90%` is a host-level backstop, not a replacement for | ||
| 66 | per-job limits. [Running several jobs at once](../runner.md#running-several-jobs-at-once) | ||
| 67 | explains how to size concurrent slots. | ||
| 68 | |||
| 69 | ## Use an existing machine | ||
| 70 | |||
| 71 | Install the package and rootless Podman, then create a dedicated account: | ||
| 17 | 72 | ||
| 18 | 73 | ```sh | |
| 19 | cd deploy/cloud-init | ||
| 20 | FORGE_HOST=forge.example.com \ | ||
| 21 | VOLE_PACKAGE_URL=https://rodent.software/vole/releases/v0.2.0/artifacts/vole_0.2.0-1_amd64.deb \ | ||
| 22 | ./render.sh runner > runner-user-data.yaml | ||
| 74 | sudo apt install ./vole_0.2.0-1_amd64.deb | ||
| 75 | sudo apt install podman slirp4netns fuse-overlayfs uidmap | ||
| 76 | sudo useradd --create-home --home-dir /var/lib/vole-runner \ | ||
| 77 | --shell /usr/sbin/nologin ci-runner | ||
| 78 | sudo usermod --add-subuids 100000-165535 \ | ||
| 79 | --add-subgids 100000-165535 ci-runner | ||
| 80 | sudo install -d -o ci-runner -g ci-runner -m 0700 \ | ||
| 81 | /var/lib/vole-runner/.ssh | ||
| 82 | sudo -u ci-runner ssh-keygen -q -t ed25519 -N '' \ | ||
| 83 | -f /var/lib/vole-runner/.ssh/id_ed25519 | ||
| 23 | 84 | ``` | |
| 24 | 85 | ||
| 25 | `render.sh runner` also reads `RUNNER_LABEL_NAMES` (default `linux`), | ||
| 26 | `RUNNER_NETWORK` (default `bridge`), `RUNNER_RUNTIME` (default `podman`), | ||
| 27 | `RUNNER_JOBS` (default `1`, how many jobs run at once), `RUNNER_HOSTNAME`, | ||
| 28 | `RUNNER_MEMORY` (default `4G`, what one job may take from RAM), `RUNNER_PIDS` | ||
| 29 | (default `2048`), `RUNNER_TMPFS` (default `1G`, the job's `/tmp`, which is a tmpfs | ||
| 30 | and therefore memory), and `RUNNER_DISK_RESERVE` (default `2G`, free space kept under | ||
| 31 | `RUNNER_DIR`). | ||
| 32 | |||
| 33 | Size the machine for `RUNNER_JOBS` times `RUNNER_MEMORY`, and keep that below the | ||
| 34 | unit's `MemoryMax=90%` backstop, which bounds the whole runner if a job gets past its | ||
| 35 | own cgroup. `RUNNER_DISK_RESERVE` is what the machine keeps for itself: a job that | ||
| 36 | takes the filesystem under `RUNNER_DIR` below it is stopped while it runs, and the | ||
| 37 | job's log says so. See | ||
| 38 | [Runners § What a job may consume](../runner.md#what-a-job-may-consume) for what each | ||
| 39 | limit means, and [Running several jobs at once](../runner.md#running-several-jobs-at-once) | ||
| 40 | for `RUNNER_JOBS`. | ||
| 41 | The file installs the package, creates an unprivileged | ||
| 42 | `ci-runner` account with the subordinate ids rootless Podman needs, generates the | ||
| 43 | runner's key, pins the instance's host key once, and enables `vole-runner.service`. | ||
| 44 | |||
| 45 | If you would rather do it by hand on a machine that already exists, the steps are | ||
| 46 | below. | ||
| 47 | |||
| 48 | ## On a machine you already have | ||
| 49 | |||
| 50 | A runner needs an OCI runtime — rootless Podman is preferred, because membership | ||
| 51 | in the Docker group is effectively root on the host — and it needs to reach the | ||
| 52 | instance's SSH port. | ||
| 53 | |||
| 54 | On a machine you configure yourself, the package carries the unit, so it is three | ||
| 55 | steps: install it, set up the account the runtime needs, and fill in the | ||
| 56 | arguments. | ||
| 86 | Pin the forge's host key. Confirm the fingerprint through a trusted channel | ||
| 87 | before relying on it: | ||
| 57 | 88 | ||
| 58 | 89 | ```sh | |
| 59 | sudo apt install ./vole_0.2.0-1_amd64.deb # dnf on Fedora and RHEL | ||
| 60 | sudo useradd --create-home --home-dir /var/lib/vole-runner --shell /usr/sbin/nologin ci-runner | ||
| 61 | sudo usermod --add-subuids 100000-165535 --add-subgids 100000-165535 ci-runner | ||
| 62 | sudo apt install podman slirp4netns fuse-overlayfs uidmap | ||
| 63 | sudo install -d -o ci-runner -g ci-runner -m 0700 /var/lib/vole-runner/.ssh | ||
| 64 | sudo -u ci-runner ssh-keygen -q -t ed25519 -N '' -f /var/lib/vole-runner/.ssh/id_ed25519 | ||
| 65 | |||
| 66 | # Pin the instance's host key. A runner executes repository code, so a host that | ||
| 67 | # can answer in the instance's place could send it any job. | ||
| 68 | ssh-keyscan -p 2222 git@forge.example.com | sudo tee /etc/vole/runner_known_hosts | ||
| 90 | ssh-keyscan -p 2222 forge.example.com \ | ||
| 91 | | sudo tee /etc/vole/runner_known_hosts | ||
| 69 | 92 | ``` | |
| 70 | 93 | ||
| 71 | Then put the arguments in `/etc/vole/runner.env`. The package ships an example | ||
| 72 | with each option explained: | ||
| 94 | Write `/etc/vole/runner.env`: | ||
| 73 | 95 | ||
| 74 | 96 | ```sh | |
| 75 | 97 | sudo tee /etc/vole/runner.env >/dev/null <<'EOF' | |
| @@ -79,110 +101,71 @@ sudo systemctl daemon-reload | |||
| 79 | 101 | sudo systemctl enable --now vole-runner | |
| 80 | 102 | ``` | |
| 81 | 103 | ||
| 82 | Add `--jobs N` to that line to run several jobs at once on a machine with room for | ||
| 83 | them, and raise `--container-memory` with it: the memory limit is per job, so a machine | ||
| 84 | running two jobs at `4G` needs room for `8G` below the unit's `MemoryMax` backstop. | ||
| 85 | |||
| 86 | `systemctl stop vole-runner` stops taking work and lets the jobs in flight finish, | ||
| 87 | up to the unit's `TimeoutStopSec` (60 seconds). Raise it in a drop-in if this | ||
| 88 | machine's builds run longer and you would rather wait for them: | ||
| 89 | |||
| 90 | ```sh | ||
| 91 | sudo systemctl edit vole-runner # [Service] / TimeoutStopSec=30min | ||
| 92 | ``` | ||
| 93 | |||
| 94 | `systemctl status vole-runner` and `journalctl -u vole-runner` are where a runner | ||
| 95 | that is not taking work says why. | ||
| 104 | Add `--jobs <n>` for concurrent jobs and size the machine for that many | ||
| 105 | containers. The file is split at spaces, so keep all arguments on one line. | ||
| 106 | `systemctl status vole-runner` and `journalctl -u vole-runner` report runtime | ||
| 107 | probe and connection failures. | ||
| 96 | 108 | ||
| 97 | 109 | ## What the package configures in the container runtime | |
| 98 | 110 | ||
| 99 | A rootless runtime needs two settings the distributions do not agree on, so the | ||
| 100 | package installs both as drop-ins. Each merges with the distribution's own file | ||
| 101 | instead of replacing it, and both reach the runner's account: system configuration | ||
| 102 | is read for rootless users too, so nothing has to be written into a home directory. | ||
| 111 | The package installs two system-level Podman drop-ins for the runner: | ||
| 103 | 112 | ||
| 104 | | File | What it sets, and why | | ||
| 113 | | File | Purpose | | ||
| 105 | 114 | |---|---| | |
| 106 | | `/etc/containers/registries.conf.d/50-vole-runner.conf` | `unqualified-search-registries = ["docker.io"]`. Debian and Ubuntu ship `registries.conf` entirely commented out, so a base image named as a short name has no registry to resolve against and the build fails with `short-name … did not resolve to an alias and no unqualified-search registries are defined`. The digest in `.vole/images` is the pin; this list only says where to ask. | | ||
| 107 | | `/etc/containers/containers.conf.d/50-vole-runner.conf` | `[engine] cgroup_manager = "cgroupfs"`. `vole-runner.service` is a system service, so the runner's account has no systemd user manager for podman to ask for a cgroup scope. It falls back to sd-bus, which answers `Interactive authentication required`, and the first `RUN` step of an image build fails. `cgroupfs` writes into the cgroup subtree `Delegate=yes` already gives the service. | | ||
| 115 | | `/etc/containers/registries.conf.d/50-vole-runner.conf` | Resolves short image names through `docker.io`; the image digest still pins the content | | ||
| 116 | | `/etc/containers/containers.conf.d/50-vole-runner.conf` | Uses `cgroupfs` because a system service has no systemd user manager for rootless Podman | | ||
| 108 | 117 | ||
| 109 | A site that wants a different registry list writes its own drop-in with a higher | ||
| 110 | number, such as `99-site.conf`, which is read after these. | ||
| 118 | A site can override these with a later file such as `99-site.conf`. The runner | ||
| 119 | unit permits setuid user-mapping helpers with `NoNewPrivileges=false`; rootless | ||
| 120 | runtimes need them. Job isolation comes from the container, while the rest of the | ||
| 121 | unit's hardening remains in place. | ||
| 111 | 122 | ||
| 112 | The unit also runs with `NoNewPrivileges=false`, alone among the units this package | ||
| 113 | installs. Rootless podman, Docker, and nerdctl all map the calling user into the | ||
| 114 | container through setuid `newuidmap` and `newgidmap`; under `NoNewPrivileges=true` | ||
| 115 | a setuid helper cannot gain privilege, so the mapping fails before a container | ||
| 116 | exists (`newuidmap: write to uid_map failed: Operation not permitted`). The | ||
| 117 | isolation a job gets is its container, not the unit's sandbox, so the rest of the | ||
| 118 | hardening stays. | ||
| 123 | These settings describe the shipped system unit. A custom user unit needs a | ||
| 124 | systemd user session and a different cgroup and runtime-directory arrangement; | ||
| 125 | do not combine its assumptions with the packaged unit. | ||
| 119 | 126 | ||
| 120 | If you would rather give podman the systemd user manager it prefers, run the | ||
| 121 | runner as a user unit instead: `loginctl enable-linger ci-runner`, a unit in | ||
| 122 | `ci-runner`'s own `systemctl --user` session, and no `cgroup_manager` setting. That | ||
| 123 | session lives at `/run/user/<uid>`, so the unit's `RuntimeDirectory=vole-runner` and | ||
| 124 | `XDG_RUNTIME_DIR=/run/vole-runner` have to go with it — the two arrangements cannot | ||
| 125 | both be assumed, and this one is not what the shipped unit does. | ||
| 127 | ## Register and authorize the runner | ||
| 126 | 128 | ||
| 127 | ## Register the runner, then allow it on a repository | ||
| 128 | |||
| 129 | The runner's key is not an admin key. It becomes a bot account, and the | ||
| 130 | allowlist decides what it may build: | ||
| 129 | Copy the runner's public key into a new bot account on the forge: | ||
| 131 | 130 | ||
| 132 | 131 | ```sh | |
| 133 | # The public key is on the runner; this copies it to the instance as a new bot. | ||
| 134 | 132 | ssh root@<runner-address> cat /var/lib/vole-runner/.ssh/id_ed25519.pub \ | |
| 135 | 133 | | vole admin --remote ssh://git@forge.example.com:2222 \ | |
| 136 | 134 | account create ci-runner-1 --bot --key - | |
| 137 | |||
| 138 | # Per repository: let it take jobs, and give it read so it can clone. | ||
| 139 | vole admin --remote ssh://git@forge.example.com:2222 acl runners add demo ci-runner-1 | ||
| 140 | vole admin --remote ssh://git@forge.example.com:2222 acl set-role demo ci-runner-1 read | ||
| 141 | 135 | ``` | |
| 142 | 136 | ||
| 143 | This is the part that cannot happen at first boot: repositories do not exist yet, | ||
| 144 | and the allowlist is per repository. Add each new repository to it as you create | ||
| 145 | it, or the runner will sit idle while its jobs wait in the queue. | ||
| 137 | Authorize that bot for each repository it should build: | ||
| 146 | 138 | ||
| 147 | A bot cannot sign in to the browser and cannot be an instance admin. That second | ||
| 148 | part matters: admins count as trusted reporters, so a bot that was an admin would | ||
| 149 | make every result count whatever the allowlist said. | ||
| 150 | |||
| 151 | ## Check that it works | ||
| 152 | |||
| 153 | - The Admin page's **Runners** tab (`/-/admin?tab=runners`) shows what is connected, | ||
| 154 | what each runner is building, and how much is queued. | ||
| 155 | - Push a commit on a branch with a workflow. The run page shows which runner took | ||
| 156 | it and whether the result counts. | ||
| 157 | - A run that executed on a runner outside the allowlist still exists and still | ||
| 158 | says so; it just does not count for the branch. | ||
| 139 | ```sh | ||
| 140 | vole admin --remote ssh://git@forge.example.com:2222 \ | ||
| 141 | acl runners add demo ci-runner-1 | ||
| 142 | vole admin --remote ssh://git@forge.example.com:2222 \ | ||
| 143 | acl set-role demo ci-runner-1 read | ||
| 144 | ``` | ||
| 159 | 145 | ||
| 160 | ## What to know before you give it a repository | ||
| 146 | The allowlist makes its CI results count. The read role lets it clone private | ||
| 147 | repositories without granting write access. Repeat both commands for additional | ||
| 148 | repositories; registration alone does not authorize every repository. | ||
| 161 | 149 | ||
| 162 | **A runner can read every secret its jobs declare.** That is what running the job | ||
| 163 | means: the values arrive on the machine. If the machine is not yours, the secrets | ||
| 164 | are not either. This is also why an instance admin's machine should not be a | ||
| 165 | runner for a repository whose secrets it should not see. | ||
| 150 | A bot cannot sign in to the browser or become an instance admin. This prevents a | ||
| 151 | runner key from acquiring the implicit trust granted to admins. | ||
| 166 | 152 | ||
| 167 | **The allowlist is the control, not the container.** A job that escapes its | ||
| 168 | container finds a machine that can reach the instance and the internet. Keep the | ||
| 169 | runner on its own machine, run it as an unprivileged account, and give it no | ||
| 170 | credentials except the one key. | ||
| 153 | ## Verify the runner | ||
| 171 | 154 | ||
| 172 | **Network is a per-job decision this machine permits.** A `bridge` runner still | ||
| 173 | gives a job that asks for none no network. What it cannot do is take the choice | ||
| 174 | away from a job, so a workflow you approve for a contributor branch is a workflow | ||
| 175 | that may reach the internet with whatever it can read. | ||
| 155 | 1. Open **Admin → Runners** on the forge. The runner's slots should appear as | ||
| 156 | connected. | ||
| 157 | 2. Push a commit that triggers a workflow. The run page should name this runner | ||
| 158 | and show whether its result counts. | ||
| 159 | 3. If the job remains queued, check that its `runs-on` labels and `network:` | ||
| 160 | request match this runner, then inspect `journalctl -u vole-runner`. | ||
| 176 | 161 | ||
| 177 | **Disk fills where builds happen.** Container images, the `/cache` mount, and the | ||
| 178 | saved checkouts live under `--dir`. `--cache-size` (5 GiB) and `--git-cache-size` | ||
| 179 | (10 GiB) bound the last two; the images are the runtime's own storage, so size the | ||
| 180 | machine for them. | ||
| 162 | The first `systemctl stop vole-runner` stops new leases and waits for active jobs | ||
| 163 | to report, up to the unit's 60-second stop timeout. See | ||
| 164 | [Stopping a runner](../runner.md#stopping-a-runner) before changing that limit. | ||
| 181 | 165 | ||
| 182 | ## Upgrading | ||
| 166 | ## Upgrade | ||
| 183 | 167 | ||
| 184 | The runner is the same package as the instance, and the two talk over a versioned | ||
| 185 | protocol. Upgrade the instance first, then the runner machines: | ||
| 168 | Upgrade the forge first, then each runner: | ||
| 186 | 169 | ||
| 187 | 170 | ```sh | |
| 188 | 171 | sudo apt install ./vole-<new-version>.deb | |
| @@ -191,6 +174,6 @@ sudo systemctl restart vole-runner | |||
| 191 | 174 | ||
| 192 | 175 | ## Next | |
| 193 | 176 | ||
| 194 | - [Runners reference](../runner.md) — every option, the container defaults, caching, | ||
| 195 | and how a lease is reported | ||
| 196 | - [Workflows](../workflows.md) — what a job asks a runner for, including `runs-on` | ||
| 177 | - [Runner reference](../runner.md) — execution isolation, network, cache, logs, | ||
| 178 | and queue behavior. | ||
| 179 | - [Workflows](../workflows.md) — define jobs that use this runner. | ||