Skip to main content

Private beta: Request private beta access

zenitya

Running tools on your network

Run a project's tool calls on your own Linux machine so they reach your VPC, VPN or internal services.

View as markdown

By default a project's tools run in Zenitya's cloud, where they can reach the internet but nothing private. A runner is one Linux machine on your own network that runs a project's tool calls instead, so its tools can reach a database in your VPC, a service behind your VPN or an API on your office network. Builds still run on Zenitya, and agents call the tools exactly as before.

The machine is in charge. Its own policy file decides which projects it runs, what their calls may reach and which local secrets they get. Zenitya can only send calls that policy accepts, and cannot change it.

What you need

  • A Linux machine, amd64 or arm64, with systemd, nftables (nft) and cgroup v2. A small VM is enough. It needs no public address and no open ports: it connects out over HTTPS to api.zenitya.com, and to zenitya.dev for releases.
  • Root on the machine, and an owner or admin role in the organization.
  • curl, ssh-keygen (OpenSSH 8.1 or newer), sha256sum, tar and flock for the installer.

One runner is one machine. A second machine is a second runner with its own identity; there are no pools.

Create and enroll a runner

In the app, open Runners and choose Create runner, named after the network it serves, such as production-vpc. It shows the install command with a single-use enrollment token, valid for 15 minutes. Run it as root on the machine:

shell
curl -fsSL https://zenitya.dev/runner/install.sh | sudo sh -s -- --token zrt_…

The installer checks the release's signature and every file, installs the runner under /usr/lib/zenitya-runner, generates the machine's key (it never leaves the machine), enrolls it and starts the zenitya-runner service. Check it:

shell
sudo zenitya-runner status

The runner page now shows it online, with the machine, its release and the public address it connects from.

To install a given release, or install now and enroll later:

shell
curl -fsSL https://zenitya.dev/runner/install.sh | sudo sh -s -- --token zrt_… --version 0.4.0
curl -fsSL https://zenitya.dev/runner/install.sh | sudo sh
sudo zenitya-runner enroll --token zrt_…

Run without a token on a machine that already has the runner, the install command updates it: the service switches to the new release once its running calls end.

Write its policy

The policy is /etc/zenitya-runner/config.yaml, owned by root. The installer writes one that allows nothing. List the projects the runner may run, by project ID (shown on each project's page), and what their calls may reach:

yaml
projects:
  - a7e1d5fb-80aa-412a-8f53-c58a169ee47a # orders
egress:
  - cidr: 10.20.0.0/16 # the database subnet
    ports: [5432]
  - host: billing.internal.example.com
    ports: [443]
secrets:
  PG_PASSWORD: { env: PG_PASSWORD }
  BILLING_TOKEN:
    { file: /etc/zenitya-runner/billing-token, projects: [a7e1d5fb-80aa-412a-8f53-c58a169ee47a] }
limits:
  concurrency: 4
  memoryMb: 512
  cpus: 1

The service reads the policy when it starts. Apply a change with restart, which first makes the checks the service makes when it starts (local secrets and file permissions included), so a mistake never stops a working runner, and restarts it once the running calls end:

shell
sudo zenitya-runner restart

Until then, zenitya-runner status and config check say that the service runs an earlier version of the policy.

Every field is in the runner reference.

Move a project to the runner

On the project's page, under Runs on, pick the runner and choose Move. The next call runs on the runner; calls already running finish where they started. Moving does not rebuild anything, and moving back to Zenitya works the same way.

If the runner's policy does not list the project, the page says so, and every call fails with runner_refused until you add the project ID to projects.

What a call can reach

Each call runs in its own gVisor sandbox with its own network, and reaches only what the policy lists:

  • egress rules allow TCP to IPv4 networks (cidr) or host names (host) on the ports they list. Nothing else is reachable, including the internet, unless a rule allows it.
  • Host names resolve through the runner, with the machine's own DNS, so names only your network knows work. A name the policy does not list does not exist for the call.
  • Calls never reach the runner machine itself, other calls, loopback, cloud metadata addresses (169.254.169.254 and the like) or IPv6, whatever the rules say. The one exception is opt-in: Google Cloud credentials.

network.allowEgress in zenitya.json does not apply on a runner: the runner's egress list decides.

Secrets on a runner

A call on a runner gets two kinds of secrets, both as environment variables:

  • Project secrets, set with zya secrets set as usual. Zenitya sends them with each call; the runner keeps them in memory for that call only.
  • Local secrets, listed under secrets in the policy. Their values never leave the machine: Zenitya sees only their names. Use them for credentials that should not be stored outside your network.

A local secret comes from one of two places:

  • env: NAME reads NAME from /etc/zenitya-runner/environment, a root-only file of NAME=value lines, when the service starts. Run sudo zenitya-runner restart after changing it. Variables exported in your shell are not used.
  • file: /path reads the file for each call, so you can rotate it without a restart. The path must be absolute and outside /home, /root, /tmp, /var/tmp and /run/user.

Without projects, a local secret goes to every project the runner runs; with it, only to those. A local secret with the same name as a project secret is a conflict: the call is refused rather than one silently replacing the other. If a tool's logs or error repeat a local secret's value, the runner masks it before the result leaves the machine. Its output and the files it returns are passed on unchanged, so never return a secret in them: files are stored by Zenitya and reach whoever has their link.

Google Cloud credentials

On a Google Cloud VM, a runner can give chosen projects' calls the VM's service account, so their tools use Google's client libraries with Application Default Credentials and no key at all:

yaml
projects:
  - a7e1d5fb-80aa-412a-8f53-c58a169ee47a # ops
gcpCredentials:
  - a7e1d5fb-80aa-412a-8f53-c58a169ee47a
egress:
  - host: logging.googleapis.com
    ports: [443]

For those projects' calls only, the runner answers 169.254.169.254 and metadata.google.internal itself, and passes on to the VM's metadata server just what credentials need: the service account's access token, identity token, email and scopes, and the project ID. Instance and project attributes, such as SSH keys and startup scripts, are not found, and every other call still cannot reach the metadata address at all.

What the credentials can do is what you grant the VM's service account in IAM, such as roles/logging.viewer to read logs, within the VM's access scopes: create it with --scopes=cloud-platform, as Google recommends, and let IAM decide. The API hosts the tools call still need egress rules. Each project in gcpCredentials must also be in projects.

typescript
import { GoogleAuth } from "google-auth-library";

// The VM's service account: the client library finds it, with no key.
const auth = new GoogleAuth({ scopes: "https://www.googleapis.com/auth/logging.read" });
const client = await auth.getClient();
const { data } = await client.request({
  url: "https://logging.googleapis.com/v2/entries:list",
  method: "POST",
  data: {
    resourceNames: [`projects/${await auth.getProjectId()}`],
    filter: 'severity>=ERROR AND timestamp>="2026-11-18T00:00:00Z"',
    pageSize: 20,
  },
});

Updates

The runner keeps itself on the latest release: it checks a few minutes after starting and then every six hours, verifies the release's signature, lets running calls finish and restarts into it. While it restarts, calls fail at once with runner_restarting. To stay on one release:

yaml
updates:
  pin: 0.4.0

sudo zenitya-runner update installs the pinned or latest release now.

Troubleshooting

Start on the machine:

shell
sudo zenitya-runner status          # identity, connection, release
sudo zenitya-runner logs --errors   # what failed, and why
sudo zenitya-runner logs -f         # every connection and call as it happens
What you seeWhat to do
The runner page shows it offlineRun sudo zenitya-runner status. If the service stopped, logs --errors names why; fix it and run sudo zenitya-runner restart.
insecure_permissions when it startsA file only root may change or read is open to others. The message names the file and the chmod or chown that fixes it.
invalid_config when it startszenitya-runner config check lists every problem in the policy. If it passes, an env: secret is missing from /etc/zenitya-runner/environment or a file: secret can't be read.
Calls fail with runner_refusedThe policy does not list the project (add it, then sudo zenitya-runner restart), or a local secret has a project secret's name.
Calls fail with runner_outdatedZenitya sends calls only to a recent enough release, and this one is older; it stays connected but runs nothing. sudo zenitya-runner update now, and raise updates.pin if it holds an older release.
A tool gets ENOTFOUND or a refused connectionThe policy does not allow that host or port. Each call's job event in logs lists the names it looked up and the connections it was refused.
The service stopped as revokedRevoking is permanent: the runner can never enroll or connect again. Create a new runner, run its install command on the machine, list the projects in its policy and move them to it from their pages.
The service stopped as key replacedAnother machine enrolled with this runner's token. To run it on this machine again, choose Enroll again on the runner page and run the install command here; the other machine is then disconnected.
The service stopped as outdatedsudo zenitya-runner update, or raise updates.pin.

To remove the runner from the machine, sudo zenitya-runner uninstall --yes removes its service, key, state and network setup, and keeps your policy. Revoke the runner on its page too, so it can never connect again.