Skip to main content
Reference tooling Archived 7 min read Updated

docs-ci-runners


description: “Register your own machines with gitea-runner: labels, Docker or host jobs, running as a service, and security.” title: Self-hosted runners · Docs image: https://oak.space/social-card-217ab603.png

Get started

Everyday work

Agents

Large repositories

CI

Organizations and access

Integrations

Reference

For agents

<details>

<summary>Docs menu ▾

Get started

Everyday work

Agents

Large repositories

CI

Organizations and access

Integrations

Reference

Self-hosted runners

Copy page .md

Register your own machines with gitea-runner: labels, Docker or host jobs, running as a service, and security.

A runner is a machine of yours that runs your organization’s CI jobs. It’s the open-source Gitea runner (gitea-runner, formerly act_runner), unmodified: Oak speaks the same runner protocol Gitea does. A runner polls Oak for work over HTTPS, so it can sit behind a firewall, on a laptop, or in a closet — nothing ever connects in to it.

Add a runner #

  1. Install gitea-runner on the machine — a single binary from the releases page ( gitea-runner-\<version\>-\<os\>-\<arch\>.xz). It needs git; Docker is optional and only needed for container jobs.

    xz -d gitea-runner-*-darwin-arm64.xz && chmod +x gitea-runner-*-darwin-arm64
    sudo mv gitea-runner-*-darwin-arm64 /usr/local/bin/gitea-runner
  2. Get a registration token from your organization’s Settings → Runners (owners and admins). It’s shown once; generating a new one replaces it, and runners already registered keep working.

  3. Register the machine, choosing its labels, then start it:

    gitea-runner register --no-interactive --instance https://oak.space \
      --token <registration-token> --name build-box --labels linux:docker://node:20-bookworm
    gitea-runner daemon

It appears under Settings → Runners as online within a few seconds. Registration writes the runner’s own credentials to a .runner file next to where you ran it; keep that file private.

Labels #

A workflow job says where it runs with runs-on; a runner takes a job only if it carries every label listed there. Each label also tells the runner how to run that job:

LabelRuns jobs
linux:docker://node:20-bookwormIn a fresh container from that image, one per job. The isolated choice.
macos:hostDirectly on the machine, in a scratch directory, as the user running gitea-runner.

A runner can carry several, for example --labels macos:host,arm64:host. Label names are yours to choose — linux, gpu, big-disk, oak-ci — as long as workflows and runners agree.

Configure it #

For anything beyond labels, generate a config file and start the daemon with it:

gitea-runner config generate > config.yaml
gitea-runner daemon --config config.yaml

The settings you’re most likely to change:

runner:
  capacity: 2            # jobs this machine runs at once
  labels:                # replaces --labels once set here
    - "linux:docker://node:20-bookworm"
  timeout: 3h            # hard cap per job, on top of the workflow's timeout-minutes
cache:
  enabled: true          # the built-in server behind actions/cache, local to this machine
container:
  network: bridge
host:
  workdir_parent: /var/lib/gitea-runner/work

Keep it running #

On Linux, a systemd unit:

# /etc/systemd/system/gitea-runner.service
[Unit]
Description=Oak CI runner
After=network-online.target docker.service

[Service]
User=runner
WorkingDirectory=/var/lib/gitea-runner
ExecStart=/usr/local/bin/gitea-runner daemon --config /var/lib/gitea-runner/config.yaml
Restart=always

[Install]
WantedBy=multi-user.target

On macOS, a launchd agent (~/Library/LaunchAgents/space.oak.runner.plist) that runs the same command with KeepAlive set, loaded with launchctl load. Either way, run the daemon from the directory holding its .runner file.

Docker on a Mac #

Container labels need a Docker daemon. On macOS, colima is the lightest:

brew install colima docker
colima start --cpu 6 --memory 8 --disk 80

The runner itself stays on the Mac, and its jobs run in Linux containers inside colima’s VM. Two settings make that work:

  1. Point the runner at colima’s socket with DOCKER_HOST when you start it.
  2. Don’t mount that socket into jobs. By default the runner mounts the Docker socket into every job container, and colima’s socket path exists on the Mac but not inside the VM, so every job fails with error while creating mount source path. Set docker_host: "-" under container: in config.yaml.
gitea-runner config generate > config.yaml
sed -i '' 's|^  #docker_host: ""|  docker_host: "-"|' config.yaml
DOCKER_HOST=unix://$HOME/.colima/default/docker.sock gitea-runner daemon --config config.yaml

Register with the same --config config.yaml. (Docker Desktop doesn’t need either setting.)

JavaScript actions #

actions/checkout, actions/cache, and most marketplace actions are JavaScript. The runner runs them with node from the job’s environment:

  • Container jobs need node in the image (the node:* images, and Oak’s own CI image, have it).
  • Host jobs need node on the machine’s PATH. Bun works in its place: ln -s "$(command -v bun)" /usr/local/bin/node.

Oak’s own CI image #

oakspace’s CI runs on runners carrying the oak-ci label, served by an image built from this repo:

docker build -t oak-ci:latest infra/ci-runner
gitea-runner register ... --labels oak-ci:docker://oak-ci:latest

It has Rust (the toolchain the repo pins, with rustfmt, clippy, cargo-nextest), Bun standing in for Node, PostgreSQL, and the C toolchain. Use it as a starting point for your own.

Security #

  • A runner runs code from anyone who can push. Every repo in the organization with CI on can send jobs to every runner with matching labels, and a job can read the repo’s CI secrets. Treat a runner like any machine that builds untrusted pull requests: prefer container labels, don’t register a machine whose own files or credentials matter in host mode, and keep separate runners (and labels) for separate trust levels.
  • Runners belong to one organization. They only ever receive that organization’s jobs, and each job only gets a token for its own repo, valid while the job runs.
  • Credentials are stored hashed. Remove a runner under Settings → Runners and its credentials stop working at once; reset the registration token if it leaked.
  • Environment runners. An environment sends its jobs only to runners bound to it, which the repo’s organization owners and admins choose. A bound runner takes no ordinary CI at all, so code from an ordinary branch push never runs on the machine that receives the environment’s secrets. Give an environment its own runner (its own machine, ideally) rather than binding the one your everyday CI uses.
  • Network. Runners make outbound HTTPS requests to oak.space, and to github.com to fetch uses: actions ( runner.github_mirror in the config points elsewhere).

Status and failure modes #

You seeMeaning
Runner onlineIt polled within the last minute and is idle.
Runner running a jobBusy; the job is linked on the settings page.
Runner offlineNot heard from in a minute — stopped, asleep, or off the network.
Job “waiting for a runner with linux, x64”No online runner carries all those labels. If none in the organization does, the run page says so.
Job failed: “The runner stopped reporting on this job.”Its runner went silent for 10 minutes mid-job (killed, rebooted, removed). Re-run it.
Job cancelled: “No runner picked this job up in time.”Nothing took it for 24 hours.
The runner logs “unregistered” and exitsIt was removed, or its .runner file belongs to another server. Register it again.

Something here wrong or missing? Run oak feedback -m "…" or email [email protected].

On this page