>_ rbox

Open source · MIT · Python standard library only

Remote build boxes that survive being reset.

Throw-away build machines get wiped without notice: new host key, new address, no toolchain. rbox hides all three, so a reset costs one automatic restore instead of an afternoon.

Get started View source

# box-a was wiped overnight. The same command still works:
# rbox detects the reset, restores the toolchain, then runs.
$ rbox exec box-a . -- cargo test

# or freeze it now, deliver when the box is back, and disconnect
$ task=$(rbox submit box-a . -- cargo build --release)
$ rbox resume "$task"
$ rbox task "$task" --wait

What a reset breaks, and what rbox does about it

The address changes

A box is declared by name and resolved on every command. An IP never appears in your config or your scripts.

The host key changes

With the default Tailscale SSH transport the tailnet authenticates the machine. A new identity is reported as a reset, not as a known_hosts warning to click through.

The toolchain is gone

Each box lists its packages and tools in one TOML file. rbox ensure restores them idempotently, and work commands run it for you after a reset.

Built for unattended work

Durable tasks

rbox submit freezes the checkout and command locally; rbox resume delivers them once the box is reachable. The box runs the task without the client. Status, logs and declared output files are fetched later by task id.

Never reruns blindly

If a box is lost mid-job, rbox reconnects to the original job and returns its real exit code. When the outcome cannot be known it says so with a dedicated exit code instead of running your command twice.

Incremental sync

Checkouts travel as small Git bundles plus your staged and unstaged edits. Later syncs send only new commits. Submodules follow at their checked-out commit.

Disk that looks after itself

Build targets are shared per repository with a lifetime and a size cap. An hourly loop and admission-time checks reclaim expired work before a build runs out of space.

Nothing to pre-install on the box

The box needs an SSH-capable transport and Python 3.11. rbox streams its own helper scripts over the connection and runs them as an unprivileged build user, with no init system.

Small enough to read

Python standard library only, no build step, no file over 300 lines. Clone it, link one script onto your PATH, and it runs.

Copy to your agent

Using a coding agent? Paste this into it. The agent installs rbox, writes the config with you, and from then on runs builds and tests on your boxes instead of your laptop.

Set up rbox (https://github.com/sunoj/rbox) on this machine and use it for builds and tests.

1. Install: clone the repository, then symlink its bin/rbox into a directory on my PATH
   (for example ~/.local/bin). It needs Python 3.11+ and git; there is nothing to build.
2. Read README.md and docs/configuration.md in the clone before changing anything.
3. Ask me which boxes to use and how each is reached (Tailscale by default; Instabox,
   Simular and Colab are also supported). Write ~/.config/rbox/boxes.toml starting from
   examples/boxes.toml. Never put an IP address or a secret in that file; secrets go in
   separate one-line files with mode 0600.
4. Run `rbox doctor`, then `rbox ensure <box>` for each box and `rbox list`. Show me the
   output and stop if anything fails.

After setup, run heavy commands on a box instead of locally:
- Short work: `rbox exec <box> . -- <command>` streams the log and exits with the job's code.
- Long work: `task=$(rbox submit <box> . -- <command>)`, `rbox resume "$task"`,
  `rbox task "$task" --wait`, then `rbox task-log "$task"`. Keep the task id.
- Exit code 76 means the box was lost and the job's outcome is unknown. Do not rerun the
  command on your own; tell me and ask.
- Use `rbox <command> --help` for options, and never address a box by IP.

Quick start

Needs Python 3.11+ and git on macOS or Linux, plus a Debian, Ubuntu or Arch box. These steps use the default transport: a logged-in tailscale CLI and a box on the same tailnet with Tailscale SSH enabled. Tailscale is optional; see box types for the others.

  1. Install

    $ git clone https://github.com/sunoj/rbox.git
    $ mkdir -p ~/.local/bin
    $ ln -s "$PWD/rbox/bin/rbox" ~/.local/bin/rbox
    $ rbox doctor
  2. Describe a box

    # ~/.config/rbox/boxes.toml
    [[box]]
    name = "box-a"   # the box's Tailscale hostname, never an IP
    packages = ["build-essential", "git", "rsync", "pkg-config", "libssl-dev"]
    tools = { rust = "stable" }
  3. Restore its environment

    $ rbox ensure box-a
    $ rbox list
  4. Run work

    # stream the log and exit with the job's code
    $ rbox exec box-a . -- cargo test
    
    # or submit a durable task and collect it later
    $ task=$(rbox submit box-a . -- cargo build --release)
    $ rbox resume "$task"
    $ rbox task "$task" --wait
    $ rbox task-log "$task"

Box types

Tailscale is the default transport, not a requirement. Each box picks its own.

TransportTrustUse it for
tailscalefullAny Debian, Ubuntu or Arch host on your tailnet. The default.
tailscale + devinfull or lowA Devin session VM, kept awake through the Devin API.
instaboxlowMachines reached with a dedicated SSH identity, no tailnet.
simularlowMachines reached through the vendor CLI with verified streams.
colabfull or lowGoogle Colab runtimes, CPU or a declared GPU.

Low-trust boxes accept only allowlisted repositories and environment names and receive scanned depth-1 snapshots.

Documentation