Skip to content
stage

Multiple machines

Pick this setup when your harnesses run on more than one machine, or when Stage should live on an always-on host (a VM, a home server, a Kubernetes cluster) while the work happens on your laptops. One main server keeps the database, the backlog, journals, schedules and the UI. Each laptop or desktop joins it as a worker: it runs that machine's T3, OpenCode, Claude Code and Codex connections, keeps their credentials, and does the machine-local work such as Git checkouts.

                 +-------------------------------+
  Browser ---->  | HTTPS proxy                   |
                 +---------------+---------------+
                                 |
                         +-------v-------+
                         |  Main server  |  database, UI, /api, /mcp
                         +-------^-------+
                                 |  workers dial out
                 +---------------+---------------+
                 |                               |
         +-------+--------+              +-------+--------+
         | Worker: laptop |              | Worker: desktop|
         | T3, OpenCode   |              | T3, OpenCode   |
         +----------------+              +----------------+

A worker always dials out to the main server, so laptops need no open ports and can sleep or change networks. An offline worker is an offline harness: its tasks keep their state, and launches wait until it is back. Settings > Connections lists every machine with its connections. Concepts: Machines.

Main server

  • Run it as a self-hosted server, in Docker, or on Kubernetes. The bundled Compose file publishes a personal server on host loopback. Follow shared container setup when enabling shared access.
  • Set STAGE_PUBLIC_URL to the URL users and workers reach. Pairing links use it and workers dial it. A trusted personal LAN can use its private HTTP address. Shared access uses HTTPS.
  • One server per data dir, on a local disk.
  • The database is SQLite in the data dir by default. A main server run from the Docker image can use Postgres instead.
  • The Docker image never runs harnesses as local processes. T3 and OpenCode on your workers do the work.
  • Workers and the main server need the same API version. Update them together.

Auth proxy

When a personal server needs access from outside its trusted network, use an authenticating HTTPS proxy. The proxy protects the UI, /api and /mcp, including pairing link creation. Let only /api/worker/* use its pairing code or machine token without proxy user authentication. Shared Stage handles human sign-in itself and requires a private upstream. Security reference

  • Preserve Host, Origin, cookies and Authorization headers. The worker uses the same URL, with its machine credential, independently of human sign-in.
  • Disable response buffering and keep idle connections open past 15 seconds. The worker channel and notifications use long-lived streams. Reverse proxy and SSE
  • Accept request bodies of at least 32 MiB for worker channel messages.

Add a worker

Install

On the machine that runs harnesses:

curl -fsSL https://raw.githubusercontent.com/flexdinesh/stage/main/scripts/install.sh | sh -s -- --headless

In Settings > Connections, click Add machine, or run stage machine pair --label NAME where the CLI reaches the main server. For a shared server, sign in first and pass --human to the CLI. The command shows a one-time link, valid for 10 minutes, and the command to run. CLI sign-in

Join

stage worker join 'https://stage.example.com/join#…'

This saves the main server's URL and a revocable machine token on this machine. A plain http:// link works for a LAN or loopback main server.

Start the worker service

stage worker service start     # waits until the worker runs
stage worker service enable    # optional: start at login

Settings > Connections shows the machine online within seconds.

Set up harnesses

In Settings > Connections, use Add connection on the new machine to pair T3, connect OpenCode, Claude Code or Codex there. The setup runs on that machine through its worker. Credentials stay on the machine; the main server keeps only the connection and its status (Connections reference).

Claude Code and Codex run as processes on the machine, with its own claude or codex and login there (Codex: codex login; Stage starts its daemon when it is down and never stops it). The worker service allows that. A worker started in a terminal does only with stage worker run --local-harnesses; otherwise Add connection lists them as unavailable and says so. A worker on an older Stage than the main server lists a harness it does not set up yet as unavailable: update Stage on that machine. A task's Copy resume command names the machine to run it on.

A machine runs either its own Stage server or a worker, not both. The worker service reads worker.env, next to service.env (Configuration reference).

Join from the desktop app

The desktop app does not offer joining in its UI today. To make a desktop install a worker, quit the app, remove this machine's server service (its data stays), then follow the CLI steps above (skip the install) and reopen the app:

stage service uninstall

While joined, the app shows a screen, "This machine is a worker of" the main server, with the worker's state (online, offline, needs update, removed, failed) and Leave and use this machine. Leaving removes the machine on the main server and brings this machine's server back. If the main server can't be reached, you can forget it on this machine only. Use the main server's UI in a browser for everything else.

Agents on a worker

Agents on a worker's machine use Stage as usual: the stage CLI, stage mcp and HTTP MCP. The worker serves a local agent gateway that forwards /api and /mcp to the main server with its machine token, so agents need no credentials or proxy access. The main server records which machine each agent write came from.

  • By default the gateway listens on this install's private socket, which the CLI and stage mcp find by themselves.

  • For HTTP MCP clients, add a loopback TCP address in worker.env, then stage worker service restart:

    STAGE_WORKER_LISTEN=unix,127.0.0.1:7381

    This TCP option is for personal mode. Shared access requires the owner-private default worker socket. Anyone who reaches a personal TCP gateway has agent access to the main server.

  • The gateway cannot manage machines or change any machine's harness setup (403). If the main server is unreachable, it answers 502.

Setting up agents: Agents that queue work.

Kubernetes

A minimal personal example lives in examples/kubernetes: a Deployment, a ClusterIP Service and a PersistentVolumeClaim for stage.db. Build the image from the release your workers run, push it to your registry and put your auth proxy in front of the Service. For shared access, use a proxy sidecar that can reach Stage on loopback and expose only the proxy through the Service.

The example uses SQLite. On Postgres, set STAGE_DATABASE_URL in the Deployment; the volume and its backup notes below then no longer apply.

  • Exactly one replica, with strategy: Recreate. One server owns one data dir, and SQLite has one writer; a second pod on the volume exits at startup. Do not autoscale it.
  • A local volume, never NFS: use a block-backed storage class (a cloud disk, local-path, Longhorn, Ceph RBD), ReadWriteOnce. File locks and SQLite locking are unreliable on network filesystems.
  • Graceful stop: terminationGracePeriodSeconds: 120 covers the server's 100s drain.
  • Probes on /api/health, which answers 200 while the server and its database work, whatever harnesses or workers do.
  • Back up the volume. Before a migration the server also copies stage.db into backups/ on it.

Postgres

A main server run from the Docker image can keep its data in Postgres instead of SQLite: set STAGE_DATABASE_URL=postgres://…. Only the image supports it; the desktop app and the installed CLI and service always use SQLite. Configuration details: Postgres.

examples/postgres runs Stage and Postgres in one compose project. It builds the image, starts Stage once Postgres is healthy, keeps the database in a named volume, and publishes port 7380 on the host's loopback:

cd examples/postgres
echo 'STAGE_PG_PASSWORD=<url-safe password>' > .env
docker compose up -d --build

/api/health and stage status then report the engine as postgres. Put your auth proxy in front, as for any main server.

  • Still one server: it holds a lock on the database for its lifetime, and a second server on the same database exits at startup. Run one replica.
  • Back up the database yourself with pg_dump or your provider's snapshots, ideally before every update. The server takes no backup; it logs a warning before it migrates.
  • Stage data dir: on Postgres it holds process locks, sockets and any pending private setup output. Postgres holds the durable data.
  • Moving an existing stage.db: the example starts with an empty database. To bring SQLite data over, stop the server and run stage db copy --from <data dir>/stage.db --to <postgres url> from the image: it copies every table into the empty database and verifies it, and leaves stage.db untouched so you can switch back. Steps: cutover and rollback.

Remove and update

  • Remove a machine in Settings > Connections (or stage machine rm ID). That revokes its token at once; its worker stops, and stage worker status says it was revoked. Its connections become history; its tasks stay. From the worker itself, run stage worker service uninstall, then stage worker leave, which removes the machine on the main server and deletes the local config.
  • Update with stage update on each machine. It restarts a running worker service and rolls back if the new one does not start. Update the main server (its image, or stage update on its host) at the same time, since workers need the same API version.

Every stage worker and stage machine command: CLI reference.

Next steps