Documentation
Getting started
On this page
- Choose a machine
- First run
- Run profiles
- Returned files and results
- Capacity fallback
- Docker, BuildKit and Bazel
- Credentials in CI
- Limits
j / k move between sections.
Docs / Remote runs
Remote runs
Run one command on a Linux machine in your cloud or provider account, on a GitHub-hosted runner, or on a server you already have. Cache, returned files and results work as they do in a local run.
Choose a machine
boringcache run --remote NAME restores cache, runs the command and saves cache on the Linux worker named NAME in .boringcache.toml. The caller runs Linux or macOS; the worker runs Linux on AMD64 or ARM64. An SSH remote uses a server you already have. The other providers start a worker in your account for each run and request its deletion when the run ends. Your provider bills the machine; BoringCache doesn't charge for compute.
| Machine | provider | The caller needs |
|---|---|---|
| Your SSH server | ssh |
Git and OpenSSH. The server needs Linux, root or passwordless sudo, and util-linux with mount and PID namespaces. Use a dedicated server: commands run as root. |
| Namespace | namespace |
NSC_TOKEN, NSC_TOKEN_FILE, or a signed-in nsc. |
| Daytona | daytona |
DAYTONA_API_KEY, a project API key from app.daytona.com. |
| AWS | aws |
AWS CLI v2 and credentials from the AWS CLI credential chain that stay valid until cleanup finishes. Configure an AMI, instance type, subnet and security groups that allow SSH from the caller. |
| Azure | azure |
Azure CLI signed in with az login to a subscription with VM quota. The identity creates and deletes resource groups, creates VM and network resources in them, and uses Run Command. Set ssh-source-cidr to the caller's outbound address range. |
| Avrea | avrea |
AVR_TOKEN, a service or scoped token that can create VMs, and AVR_ORG, its organization ID. |
| Luxor | luxor |
LUXOR_API_KEY, a Luxor Sandbox API key for the workspace. |
| GitHub-hosted runner | github |
Git, gh, and BORINGCACHE_GITHUB_ACTIONS_TOKEN with Actions write access to the repository. Set repository, workflow and ref. The workflow runs one approved profile from a clean checkout of the committed configuration. |
First run
Add the remote to .boringcache.toml, check that the caller can start and reach a worker, preview the run, then run the command. The preview needs no provider credentials and does not connect.
workspace = "my-org/app" [remotes.builder] provider = "ssh" host = "build.example.com" user = "builder"
boringcache doctor --remote builder --connect boringcache run --remote builder --read-only --dry-run --json -- ./script/test boringcache run --remote builder --read-only -- ./script/test
doctor --remote NAME --connect prepares and checks a worker. With a provider that starts workers, it allocates one and deletes it, which the provider may charge for. Add --tool EXECUTABLE for each executable the command needs on the worker. The run sends the Git-tracked files in the working tree, streams the command's output and exits with the command's status.
Run profiles
Keep the command, cache entries, and default remote in one run profile. Use it from your laptop or CI. This example runs a Cargo test script on Avrea or Luxor. For Avrea, set AVR_TOKEN and AVR_ORG on the caller. For Luxor, set LUXOR_API_KEY. Use a workspace-scoped restore token or approved workload identity for the image run.
workspace = "my-org/app" [profiles.test] remote = "avrea" command = ["./script/test"] [profiles.rust-image] image = "docker.io/library/rust:1.85.1-bookworm" [remotes.avrea] provider = "avrea" size = "4-vcpu-8gb" [remotes.luxor] provider = "luxor" cpus = 4 memory-mb = 8192 disk-gb = 20
# Preview the native run on Avrea boringcache run --profile test --read-only --dry-run --json # Use the configured image on Avrea boringcache run --profile test --profile rust-image --read-only # Preview a one-off provider and image boringcache run --profile test --profile rust-image --remote luxor \ --image docker.io/library/rust:bookworm --read-only --dry-run # Use the host tools on Avrea boringcache run --profile test --read-only # Use the host tools on this machine boringcache run --profile test --local --read-only
- Select one profile that sets the command and at most one that selects BuildKit. Put the image in the job profile if the job should use it by default, or select a second profile to add an image for one run.
- Use --remote NAME to replace the default remote, --image IMAGE to replace the configured image, and a command after -- to replace the configured command. Use --local to run on the caller. If an image is selected, --local runs it on the caller's Docker-managed BuildKit builder.
- Run profiles use the host's tools by default. Set command to your project's test script. In this example the script runs cargo test --locked. Make Cargo available on the host for a native run. With the experimental BuildKit executor, the Linux OCI image supplies those tools. Use a native run for --output or --receipt.
- For Rails and PostgreSQL, use an image with Ruby, gems, and PostgreSQL. Have the test script start the database and wait for it before running Rails tests. For Go, use go test ./... or a build script. A native Go build can return a binary with --output dist/app.
- Select cache entries with entries in the job profile. Use --read-only when a run may restore but cannot publish. A trusted run with a save-capable credential can populate the cache with --write.
- To build your own workload image, publish a Dockerfile target with boringcache docker --publish-image, then set image to the published reference. The experimental buildkit setting selects BuildKit with the CLI's pinned Ubuntu 24.04 base. The command runs on every invocation.
- Use a Linux or macOS caller and a Linux AMD64 or ARM64 worker. With CLI 1.50.1 or later, use an existing SSH server or an allocated worker from Namespace, Daytona, AWS, Azure, Avrea, or Luxor.
- Use
--shard I/Nto run one shard and--shards Nto run every shard. Native fan-out uses remote workers. BuildKit fan-out uses one local builder. The command receivesBORINGCACHE_SHARD_NUMBERandBORINGCACHE_SHARD_COUNT. - A
provider = "github"remote dispatches one approved profile to a GitHub-hosted Linux runner. It uses a clean checkout of the committed configuration. A BuildKit profile can run its shards in the same workflow job. - Use docker --remote or buildkit --remote for a container build. Buildx or buildctl stays on the caller and delivers the configured build result.
- Use bazel-reapi --remote to send actions to the worker while Bazel analyzes the project on the caller. Select a Bazel execution platform and toolchain matching the worker.
- Use
--checkout HTTPS_URLwith a native remote to fetch the caller's clean Git commit from a public HTTPS repository on the worker. - Use --dry-run --json to preview without connecting. Use doctor --remote NAME --connect to allocate and check a worker and add --tool for an executable the worker needs.
Returned files and results
--output PATH, oroutputsin the run profile, names a path the command must produce. After the command succeeds, the caller checks the worker's receipt and places the declared outputs in the same paths on the caller. Declare every file a later CI step needs.--receipt PATHwrites a JSON receipt on the caller with the inputs, exit code, durations, cache entries and output digests.--publish-resultsstores the receipt, command logs and declared outputs in one Artifact.--publish-logs, orpublish_logs = truein a run profile, stores up to 16 MiB of combined command output in a text Artifact and needs CLI 1.50.1 or later. Both need Artifact write access.- The run exits with the command's status. If the command succeeds but cleanup of an allocated worker does not finish, the run exits 79 and records the cleanup problem.
Capacity fallback
With CLI 1.50.2 or later, a remote with provider aws, azure, daytona, avrea, luxor or namespace can list up to four fallback-remotes. When the provider reports a capacity, SKU, quota or rate-limit failure and no machine was left allocated, the CLI tries the next remote in order. Define each fallback remote in the same file. Authentication errors, configuration errors and cancellation stop without trying another remote. Fallback applies to run, run --shards, and remote docker, buildkit and bazel-reapi.
[remotes.aws-arm64] provider = "aws" region = "us-east-1" market = "spot" instance-type = "c8g.2xlarge" subnet-id = "subnet-0123456789abcdef0" security-group-ids = ["sg-0123456789abcdef0"] image = "ami-0123456789abcdef0" fallback-remotes = ["aws-arm64-az2", "aws-arm64-ondemand"] [remotes.aws-arm64-az2] provider = "aws" region = "us-east-1" market = "spot" instance-type = "c8g.2xlarge" subnet-id = "subnet-0fedcba9876543210" security-group-ids = ["sg-0123456789abcdef0"] image = "ami-0123456789abcdef0" [remotes.aws-arm64-ondemand] provider = "aws" region = "us-east-1" instance-type = "c8g.2xlarge" subnet-id = "subnet-0123456789abcdef0" security-group-ids = ["sg-0123456789abcdef0"] image = "ami-0123456789abcdef0"
Docker, BuildKit and Bazel on a worker
The same [remotes.NAME] entries work with boringcache docker --remote, boringcache buildkit --remote and boringcache bazel-reapi --remote.
See Docker remote builds
for container builds and
Bazel REAPI remote execution
for remote Bazel actions.
Credentials in CI
- Provider credentials stay on the caller. The worker receives the BoringCache credential selected for the run's cache access and the variables you forward with
--env NAME. Admin tokens are not used on the worker. - For a read-only run, give the CI job
BORINGCACHE_RESTORE_TOKENor workload identity and pass--read-only. Give a save-capable credential only to trusted jobs that publish cache with--write. - AWS: configure AWS credentials in the job before BoringCache runs, for example through your CI provider's OIDC role. The CLI uses the AWS CLI credential chain and does not request a CI token itself.
- Azure: sign the Azure CLI in to the subscription in the job before BoringCache runs.
- Namespace, Daytona, Avrea and Luxor: store the key as a CI secret and expose it to the step as the variable in the table above.
- The CI job waits while the remote command runs, so its runner time still counts.
--shards Nlets one CI job start every shard.
Limits
- Workers run Linux on AMD64 or ARM64. Callers run Linux or macOS.
- There is no interactive terminal session on the worker.
- A native run uses the tools already on the worker. A run with an image gets its tools from the image. BoringCache does not install language toolchains or system packages.
- Services started on the CI runner, such as a database, are not available on the worker. Start them in the command or the image.
- BoringCache does not delete SSH servers. It requests deletion of each allocated worker when the run ends.
Need help or found something unclear? Open an issue or browse the CLI repo.