outerlayer runner init sets the service up on the
machine where you run it. See Set up your first host.
This page is for the person who operates that runner afterward.
The runner keeps its files beside its config file. Where that file is depends
on the account:
The commands on this page use the paths for an account of its own. On your
own account, add
--config ~/.outerlayer-runner/config.json to each
outerlayer runner command. Also use ~/.outerlayer-runner/ in place of
~/.outerlayer/ in each runner path.
What the service sets
To set the service up again, run:/etc/systemd/system/outerlayer-runner.service, then enables and starts it.
It asks for sudo, and names each sudo command before it runs. The unit
runs as the account that ran the command. Pass --user <account> to name
another.
The command refuses on a Linux host without systemd, and for hooks that are
your own executables. For those hosts,
--print writes the unit to standard
output and sets up nothing, so you can edit it.
A stop of the service waits up to runner.timeLimitMinutes plus ten minutes
for running builds. Every flag is in
outerlayer runner install.
The files the service reads
The service reads two files beside the config file. Only the runner’s account can read them.claude.envholds Claude’s credential:CLAUDE_CODE_OAUTH_TOKEN=<token>orANTHROPIC_API_KEY=<key>. Without a credential, the runner claims nothing.runner.envholds every secret that a destination reads and every value thatbuild.variablespasses in.
sudo systemctl restart outerlayer-runner.
On systemd 247 or later, no process that the runner starts inherits the
Claude credential. On older systemd it stays in the service’s environment,
and the install prints a line that says so. Run systemctl --version to see
your version.
Replace the Claude credential
- Create a new token with
claude setup-token, or use a new Anthropic API key. - Write one line in
claude.env, in place of the old line:CLAUDE_CODE_OAUTH_TOKEN=<token>orANTHROPIC_API_KEY=<key>. - Restart the service with
sudo systemctl restart outerlayer-runner. Start and stop the runner says what a restart does to running builds.
Keep the host awake
A build fails when its host sleeps. A sleeping host stops the runner, so the runner stops renewing the build’s claim, and the claim runs out.
On a Mac,
caffeinate changes no energy setting, and it ends with the runner.
It cannot stop a sleep that you start, or a laptop that sleeps when you close
its lid. To see it while a build runs, run pmset -g assertions. To turn it
off, set runner.keepAwake to false in the config file.
Re-run the service
The runner reads the config file again on every poll, so most edits need nothing else. Runouterlayer runner install --service again after a change
to one of these:
runner.timeLimitMinutesrunner.concurrency, withbuiltin:vmhooksrunner.build.imageBuild- the hooks
- the config file’s path, or the account
--replace to replace it.
Restart the service after you add its account to a group, such as kvm. The
service reads the account’s groups only when it starts.
The account the runner runs as
To run the runner under an account of its own:- Create the account with your system’s tools.
- Install Node.js 22.15 or later where the account can run it.
- Log in as the account, and install the CLI:
npm install -g @outerlayer/cli. - Create a runner key with the Runner preset, as Give the runner its key shows.
- Save the key with
outerlayer login. - Follow Set up your first host from
Give the runner Claude’s credential,
or from Build with Codex for a runner
that builds only with Codex. Leave out
--configin each command.
outerlayer runner install --service --user <account>. See
Several accounts on one machine.
The runner never answers a prompt. A build that prompts waits until the idle
limit ends it with the outcome idle. So under the service’s account:
- Built-in hooks use only the credentials in the files beside the config
file: the agent’s own file (
claude.env,opencode.envorcodex.env) andrunner.env. They do not use aclaudeorcodexlogin made in a terminal. - Builds in containers and microVMs need no git login. They use the GitHub App.
- Hooks of your own need a git login that fetches with no prompt. Use a
deploy key, a credential helper with a stored token, or an SSH agent that
the service can reach.
outerlayer runner imageon a private repository needs one too. - With hooks of your own, the agent must already be logged in under this account.
PATH.
Memory limits
Every build has a memory limit of its own,runner.build.memory, and the
runner never runs more than runner.concurrency builds. So the builds
together use at most concurrency times build.memory.
concurrency times
build.memory with the memory the runner can use, less 2 GiB. That memory is
the host’s on Linux, the VM’s on a Mac and the distribution’s on WSL2.
With the defaults (build.memory of 8g, concurrency of 1), the machine
needs 10 GiB. A runner whose builds do not fit claims nothing, and its entry
in the factory says why.
At the limit:
- A container build, and each of the runner’s image builds, is limited to
build.memory. - A microVM build slows above
build.memoryplus 256 MiB. Abovebuild.memoryplus 1 GiB, the kernel kills the microVM. - A killed build ends with the outcome
failed, and its reason says that it ran out of memory. The other builds and the runner carry on. See When a build runs out of memory.
outerlayer doctor warns.
Disk fit
A build’s disk can grow torunner.build.disk, 40g by default. Before it
claims work, the runner counts how many builds of that size fit on the host.
It runs no more builds than fit, and no more than runner.concurrency.
The count uses these figures:
- The free space on the file system. For
builtin:vm, that is the file system of the runner’s folder. Forbuiltin:container, it is the file system that holds Docker’s volumes. - The space one build can hold:
build.disk, plus the build’s root disk forbuiltin:vm. - For
builtin:vm, room for each repository’s image-build cache to grow torunner.build.cacheDisk,40gby default.
- Lower
runner.build.diskorrunner.build.cacheDisk. - Give the host more disk.
- In the runner image, set
OUTERLAYER_CONCURRENCYin the env file and recreate the container.
outerlayer doctor reports the same count as its Build disk fit check.
It warns when fewer than runner.concurrency builds fit, and fails when none
fit.
The count assumes that a build uses its whole build.disk. If your builds
use much less, lower build.disk. For each microVM build, the runner log
has a build disk peak line with the most disk the build used.
This check differs from minFreeDisk, in Housekeeping.
minFreeDisk holds new work but does not protect builds that already run.
Image builds
The runner builds a repository’s build image before the repository’s first build. It builds the image again when the recipe or the CLI changes. So the first build of a repository is slow. Where the image builds depends on the hooks:
What an image build can reach is in
What an image build reaches.
For the builder microVM:
- The cache disk needs about twice the image’s size. The universal image
needs about 30 GB, so the default of
40gholds it. - A change to
runner.build.cacheDiskgives the next image build a new, empty cache disk. - To pull from a private registry on your own network, set
runner.build.imageBuildtohost.
- Docker’s Buildx plugin, version 0.18 or later. It is
docker-buildx-pluginin Docker’s apt repository anddocker-buildxin Ubuntu’s own packages. - Access to Docker Hub, to pull the BuildKit image once.
- A proxy, if any, that the builder can reach. The runner passes its own
HTTP_PROXY,HTTPS_PROXYandNO_PROXYto the builder. The builder cannot reach a proxy on the host’s loopback address. A password in a proxy address shows in the host’s process list, so use a proxy that needs none.
outerlayer doctor
fails its “Image build limit” check. See
When the Image build limit check fails.
On such a host, a change to runner.build.memory replaces the runner’s
builder, which clears its cache. An image build that reaches the memory limit ends failed at
provision. See
When an image build runs out of memory.
The outerlayer command
For the runner of the default config,~/.outerlayer/config.json,
outerlayer runner install writes ~/.local/bin/outerlayer. It runs the CLI
version that the runner runs, also after the runner updates itself. So
outerlayer runner status, doctor and logs in a shell always match the
runner.
A runner with another config, such as ~/.outerlayer-runner/config.json on
your own account, does not write the command. Your own outerlayer stays
first on PATH. Give that runner’s commands its --config.
The runner never edits a shell startup file. When ~/.local/bin is not on
PATH, or another outerlayer comes first, the command prints the line to
add:
outerlayer doctor shows the same as its “outerlayer on PATH” check. The
command does not change a file at that path that the runner did not write.
Run outerlayer runner install --replace to replace it.
Start and stop the runner
A stop or restart of the service makes the runner wait for its running
builds. A build keeps running without its runner in these cases:
- A container build keeps running when its runner restarts for an update, or crashes.
- A microVM build keeps running through a service stop, a restart, an update and a crash, when it can outlive its runner.
- A sandbox build keeps running at the provider when its runner crashes, or restarts for an update to a version that says it adopts sandbox builds.
Let a restart through
A runner that waits for its running builds can hold a restart for hours. To let the restart through, stop the build that the runner waits on.- Find the build. The item page says
<runner> is draining.GET /v1/hostsand the MCP toollist_hostsshow a draining runner and the items it waits on. - Stop it. On the item page, select Stop build and confirm. Or run
outerlayer work stop --item <n>.
stopped.
The restart goes ahead when the last build has ended.
The stopped build’s request is used up, so the item is not built again until
someone asks for another build. See
outerlayer work stop.
A microVM build outlives its runner
A microVM build keeps running while its runner restarts only when all of these are true:- The microVM helper runs the build.
- The host runs systemd 254 or later.
- The service’s unit came from a current release. Run
outerlayer runner install --service --replaceto write one. - The runner started under that unit. After you replace the unit, restart the service once, while no build runs.
- The unit has room for the build’s sockets. The unit is sized from
runner.concurrency, so runouterlayer runner install --serviceagain after you raise it.
outerlayer doctor warns about the first four on its
MicroVM jailer line. As such a build starts, the runner log says
“this build ends with its runner” and gives the reason.
A microVM build that stopped while no runner managed it ends interrupted.
A reboot of the host is one example.
The host key
A runner key works only from the host that first used it. On its first run, the runner makes a host key atrunner/host-key.pem beside its config file,
readable only by its account. The private half never leaves the machine.
The runner’s first claim binds the host key to the runner key, and the
organization audit log records it. From then on, OuterLayer refuses that
runner key unless the host key signed the request. So a leaked runner key is
useless without its host key.
Keep the host’s clock in sync. Each signature must be within five minutes of
OuterLayer’s clock. When a signature is refused, see
When the gateway refuses a signature.
Settings → API keys shows each bound key’s host key fingerprint and
when it was bound. outerlayer doctor says whether the runner key is bound
to this host.
Moving a runner to a new host
To move a runner key to a new machine, or after you deletehost-key.pem:
- Ask a member who may update API keys to open Settings → API keys and choose Clear host key on the runner key.
- Start the runner on the new host at once. Its first claim binds the new host key, and anyone else who holds the key could bind it first.
runner_key_signature_invalid, and the runner on the old host keeps
working. The organization audit log records the change as
runner_key_binding_cleared.
Several factories, one machine
One config file is one factory. To serve two factories from one host, run two runners. Give each runner these:- A config file in a directory of its own, such as
/etc/outerlayer/acme/config.json. The runner keeps its host key and its builds inrunner/beside the config file. - A runner key of its own. Each directory has its own host key, so a key that the first runner bound is refused from the second.
- A name of its own, in
runner.name. - A unit of its own. Pass
--unit-name <name>and--config <path>torunner init,runner install --serviceandrunner uninstall --service.
concurrency and build.memory together, or
give each runner a limit.
Hook scripts that the runners share must read OUTERLAYER_URL and
OUTERLAYER_APP_ID, not assume one factory.
outerlayer runner check, runner status and doctor report on the runner
whose config file you give them.
Several accounts on one machine
To serve customers that must not reach each other, give each runner its own Linux account. As an administrator, run this for each one:- Build users. A build of one runner never runs as the user of another runner’s build.
- Files. Each runner’s config file,
claude.envand host key are readable by its account only. - Docker. A runner that needs no Docker does not need the
dockergroup, which is equal to root on the machine.
docker group on a machine that other customers
share.
Each runner’s disk check is exact only when each account has a file system
of its own.
A runner that needs no Docker
A runner needs no Docker on the host when both of these are true:- Its hooks are
builtin:vm. runner.build.imageBuildis nothost.
mke2fs, which is in the e2fsprogs package.
outerlayer runner init, runner check and doctor accept a machine with
no Docker.
Limit the memory and CPU of a runner’s builds
To keep all of one runner’s builds within a memory limit and a CPU limit, pass the limits when you install the service:concurrency times build.memory with that memory
limit, not with the machine’s memory. The limit covers builds only, so leave
the machine the memory that its own services need. The options need
builtin:vm hooks.
Keep the runner up to date
A service runner updates itself to the named version. It never moves to a lower version. It runs a new version only after it checks the package. See How a runner updates itself.
A runner that was not installed with
runner install cannot update itself.
It logs that it cannot, and it keeps taking work. Run
outerlayer runner install --service to fix it. If the command says that
the unit differs, run it again with --replace.
The support window
OuterLayer refuses claims from a runner that is too far behind. A runner may run a version for 30 days after OuterLayer names a newer one. Those 30 days are the support window. Two cases have other dates:- A raised minimum version. OuterLayer raises the minimum when an older runner has a known fault. The new minimum takes effect 7 days later. An urgent minimum takes effect at once, with no notice.
- A factory that holds its runners. In a factory set to Paused or Hold at a version, only the minimum version applies.
426 with the code runner_version_unsupported.
A runner that updates itself stays inside the window. For any other runner,
you learn that an update is due in these places:
- Email. The factory’s owners and admins get two emails about a runner: one 7 days before OuterLayer refuses it, and one when it does.
- The factory’s Settings → Runners page. It lists each runner with its version and status. For a runner that is behind, it shows the date OuterLayer starts to refuse it and the version to update to.
- The Work page. An item that only a refused runner takes reads Not picked up, with the caption “runner needs an update”.
When a build carries on through an update
A service runner restarts for an update at once when every running build carries on through the restart. Start and stop the runner says which builds do. Otherwise the runner keeps taking work, and it updates the first time no build runs. A sandbox build carries on only when the new version says it adopts sandbox builds. The runner asks the new version before it restarts. A version that gives no answer counts as one that does not adopt them. The runner then waits, andouterlayer runner status names the build with the reason is a sandbox build, which the new version does not say it adopts.
When the runner holds work for an update
The runner stops taking new work for an update in two cases only:- OuterLayer refuses its claims because its version is too old.
- The update waited longer than
runner.update.maxWaitHours, 6 hours by default.
outerlayer runner status
shows the builds that an update waits for.
Update the microVM helper
The runner cannot update the microVM helper itself, because the helper needs root. When the runner’s log or theMicroVM jailer line of
outerlayer doctor says that the helper needs reinstalling, run:
Upgrade by hand
A runner with updates off, or one that cannot update itself, is upgraded by hand. The commands are in Update a runner. On a service runner:- Do not restart the service yourself. The runner sees the new version on its next poll. It restarts when its running builds allow it, and it takes no new work while it waits.
- A version that fails its checks at its first start is rolled back. The
runner goes back to the previous version and records
rolled_back. - An older CLI is refused.
runner installinstalls a CLI older than the runner’s version only with--allow-downgrade.
outerlayer runner start does not restart
itself. Run outerlayer runner stop, then outerlayer runner start.
Pausing or holding updates for a factory
An owner or admin can stop or limit updates on every runner of a factory at once. Open the factory’s Settings → Runners page and change Runner updates:- Automatic, the default: runners update to the named version.
- Paused: no runner updates.
- Hold at a version: runners below that version update to it, and none moves past it. The version is no higher than the named version.
runner_updates on
PATCH /v1/apps/{appId}, with the values follow, paused and pinned.
See the API reference.
Housekeeping
A runner with built-in hooks removes what its own builds leave behind, so it needs no cleanup script. It does this when it starts and then once an hour. Each removal is one line in the runner log. The runner removes:- Finished builds. Job directories and
kept sessions go after
jobsKeepDays, 30 days by default. - Containers, volumes and images of its own builds that no unfinished build uses.
- The cache of its own image builder, down to
buildCacheMax,20gby default. - Disks kept for work items, after
workspaceKeepDays, 7 days by default. AboveworkspaceMax,40gby default, the oldest go first. See What an agent job starts from. - Saved states that are 7 days old. Above
savedStateMax,20gby default, the oldest go first. See The saved state.
docker builder prune.
A runner whose hooks are its own executables gets no cleanup. Its hooks own
what they create.
Free disk
Before it claims work, every runner checks the free space on the file system that holds its folder. BelowminFreeDisk it claims nothing, and it logs
why once. The default is the value of runner.build.disk.
Before the runner holds off, it removes its oldest kept disks, and then its
oldest saved states. It claims again when there is room, with no restart.
See When the runner holds off for disk.
outerlayer runner status shows when housekeeping last ran and what it
freed. outerlayer doctor warns when free disk is below the minimum.
Set these keys under runner.housekeeping. Each one is in
The config file.
Uninstall the runner
On a Mac, follow Remove the runner instead.-
Stop the service and remove its unit. To end running builds without a
wait, run
outerlayer runner stop --nowfirst.For a second runner, add its--unit-nameand--config. On Windows, see Remove the runner for the scheduled task. -
Read the label and the builder name of the runner’s Docker objects. Skip
steps 2 and 3 on a machine with no Docker.
The file holds a
labeland abuilder. If the file is missing,docker buildx lslists the builder, namedouterlayer-and the label. -
Remove the images, volumes and image builder of this runner. Docker
objects of another runner on the machine stay.
-
As the runner’s account, delete the runner’s files:
- On your own account:
~/.outerlayer-runner/. Do not delete~/.outerlayer/config.json, because it holds your own login. - Under an account of its own:
runner/,runner.envandclaude.envin~/.outerlayer/. Deleteconfig.jsonthere too, or only itsrunnerandapiKeyentries. ~/.local/bin/outerlayer, if the runner wrote it.~/.outerlayer/cli, ifouterlayer initmade it.
- On your own account:
-
Run
npm uninstall -g @outerlayer/cli, if nothing else uses it. - Delete the runner key in Settings → API keys. OuterLayer refuses the key within about five minutes.