GitHub
Skip to content

Remote hosts

Set up a host that runs your jobs over ssh, with the tools it needs, the config entry, and how the checkout is copied and checked.

A host is a machine that runs jobs for this one. Nothing is installed on it for fleetjobs: this machine sends a small script with each call, and the host runs it with Node.

ToolWhy
ssh, with a key and no password promptEvery call uses BatchMode=yes and a 4-second connect timeout
node, 22.20 or laterRuns the host script
rsyncCopies the checkout in and the files the job wrote back
bwrap (bubblewrap)Runs the job with the mirror mounted at the checkout's own path
git, the package manager and the tools your jobs useThe host installs dependencies and runs the command

Without bwrap, the job still runs, but the mirror sits at a different path than your checkout, so absolute paths in configs and output differ.

This machine needs ssh and rsync too, and Linux with systemd for local scopes.

Add it to ~/.config/fleetjobs/config.json:

{
  "hosts": [{ "name": "build-box", "address": "me@build-box", "slots": 2, "speed": 0.5 }]
}
json

address is what you would pass to ssh. slots is how many jobs the host runs at once, and speed is its speed against this machine, where 1 is as fast. fleetjobs reads the file on every tick, so there is nothing to restart. See the config reference.

Check the host from this machine with ssh me@build-box node --version. Then run a test job: HEAVY_REMOTE=1 heavy sh -c 'echo ok > out.txt'. When the host finishes first, heavy prints the line this runs on build-box on stderr, and out.txt appears here.

  1. Probe. The host reports its free slots and whether it is busy. It is busy under 3 GB of free memory, under 15 GB of free disk, or when CPU pressure is 40% or more while other processes use 25% or more of the CPUs. CPU used by fleetjobs' own jobs is subtracted. A host may change these limits with HEAVY_HOST_MIN_MEM_GB, HEAVY_HOST_MIN_DISK_GB and HEAVY_HOST_MAX_OTHERS in its environment.
  2. Copy. rsync copies the checkout, with uncommitted changes, to ~/overflow/mirror<checkout path> on the host. It leaves out node_modules, .git, .env files, .pem files, and what git ignores, except dist and .nuxt.
  3. Install. The host installs dependencies once per hash of the lockfiles and package manifests, with pnpm install --frozen-lockfile or npm ci.
  4. Run. The job runs under nice and bwrap in a slot of the host, ~/overflow/heavy-slot-<n>, and stops if the connection drops. Output streams back as it comes, and HEAVY_MAX applies.
  5. Copy back. The host lists each file the job wrote with its SHA-256, and rsync copies them to this machine, where fleetjobs checks each one. A copy that fails or does not match turns exit 0 into exit 74.
ExitMeaning
200 to 205, 208, 255The job did not start: the host is busy or has no free slot, the mirror is missing, the install failed, the copy failed, or ssh could not connect. The host rests for a minute and the job goes back to the queue here
206The output shows what the mirror lacks, such as not a git repository. The job runs here, ahead of the queue
124The job passed HEAVY_MAX
74The job passed, but the files it wrote did not come back intact

Any other code is the job's own. What happens to a failing job is in Trust.