vole
Clone
Read only, no credentials:
https://rodent.software/git/vole.git
Write over SSH with a registered key:
git clone ssh://git@0.0.0.0:2222/vole.git
A free and open-source forge that lives in your Git repo.
Bound the runner's containers and keep its disk free
4e3759da08a603ede50107e89a23ff6d5432b7ac · Keenan Nemetz · 1h ago · parent c4ad0d5a
Bound the runner's containers and keep its disk free The container boundary was good and the resource the job consumes was not. A job could fork without a bound, write /tmp until the machine's RAM was gone, and fill the disk its workspace sits on — and the runner would only notice when a build died. The isolation protects the forge's data; this protects the machine that runs the code. - `--container-pids` now defaults to 2048 and zero means the default, not "no limit": a bound nobody set is the easiest one to be missing, and a job that can fork without one is a fork bomb away from taking the machine. - `--container-tmpfs` is new and defaults to 1G. /tmp is a tmpfs, so its size is memory, and an unsized one is a build that fills RAM without writing a byte to the workspace. It is passed to service containers too. - `--container-memory` stays the operator's setting rather than a default, because the right number is the machine's size and a wrong default would show up as an OOM kill in someone's build. All three places a runner is configured now set it: the packaged runner.env example, the manual steps in the deploy guide, and the cloud-init template (RUNNER_MEMORY, default 4G, alongside RUNNER_PIDS, RUNNER_TMPFS and RUNNER_DISK_RESERVE). - `--disk-reserve` (default 2G) is how the job tree is bounded. It is a host bind mount, so the runtime cannot quota it and a filesystem quota needs root; a walker over the tree would cost more than it protects. What the runner can promise is that it notices: one statfs per second while a command runs, and the job is stopped below the reserve with the numbers in its log. `--dir` on its own sized filesystem is the hard bound, and the docs say so. - The runner unit gets `MemoryMax=90%` as the backstop under all of it, for a job that gets past its own cgroup. It is a percentage so the unit does not have to know the machine. TasksMax is deliberately not set: the container's own --container-pids already applies, and a unit value would have to track --jobs and --container-pids and would fail builds, looking like the workflow's fault, when they drifted apart. A workflow still cannot raise or remove any of this: the limits are flags on the runner and the unit, never fields a job can set. scripts/check-deploy.py now fails when the rendered runner arguments stop carrying the memory, pids, tmpfs or disk limits, so the first-boot file cannot quietly lose them. Closes 01M6S798BH0BK00R2B5N1KDJYM
packaging/runner.env +12−1
| @@ -12,6 +12,17 @@ | |||
| 12 | 12 | # --container-network none (the default) or bridge. A machine without a | |
| 13 | 13 | # network never receives a job that asks for one, and a | |
| 14 | 14 | # job that fetches dependencies needs bridge. | |
| 15 | # --container-memory what one job may take from RAM, e.g. 4G. Set it: the | ||
| 16 | # runtime's default is the whole machine, and --jobs | ||
| 17 | # multiplies it. Size the machine for --jobs times this. | ||
| 18 | # --container-pids processes one container may have (default 2048). | ||
| 19 | # --container-tmpfs size of the job's /tmp (default 1G). It is a tmpfs, so | ||
| 20 | # it is memory; raise it for a build that writes large | ||
| 21 | # temporary files. | ||
| 22 | # --container-cpus optional CPU cap for one job, e.g. 2. | ||
| 23 | # --disk-reserve free space to keep under --dir (default 2G). A job that | ||
| 24 | # takes the filesystem below it is stopped while it runs, | ||
| 25 | # because a job tree is a host directory with no quota. | ||
| 15 | 26 | # --label what this machine is, such as linux or arm64. A job | |
| 16 | 27 | # with runs-on only comes to a runner carrying every | |
| 17 | 28 | # label it asks for. | |
| @@ -25,4 +36,4 @@ | |||
| 25 | 36 | # gets its own container, so size the machine for this | |
| 26 | 37 | # many times the container limits. | |
| 27 | 38 | # | |
| 28 | # VOLE_RUNNER_ARGS=--remote ssh://git@forge.example.com:2222 --container-runtime podman --container-network bridge --dir /var/lib/vole-runner --known-hosts /etc/vole/runner_known_hosts --label linux | ||
| 39 | # VOLE_RUNNER_ARGS=--remote ssh://git@forge.example.com:2222 --container-runtime podman --container-network bridge --container-memory 4G --container-tmpfs 1G --disk-reserve 2G --dir /var/lib/vole-runner --known-hosts /etc/vole/runner_known_hosts --label linux | ||