Skip to content
Fuse
Esc
↑↓navigate↵open⌘Jpreview
On this page

Deploying the orchestrator

Running the control plane as a long-lived service

For anything past local dev, run the orchestrator as a service rather than a foreground process.

Tokens and ports

Two things cause most bring-up confusion: which token goes where, and which port is which service. State both up front.

There are four distinct tokens, travelling in different directions:

Token Set on Used by Flag / env
Orchestrator bearer Orchestrator you → orchestrator ORCH_AUTH_TOKEN / fuse connect --token
Host agent token Host agent (fc-agent) orchestrator → agent fuse host register --token (the agent’s FC_AGENT_TOKEN)
Host agent token Host agent (qemu-agent) orchestrator → agent fuse host register --token (the agent’s QEMU_AGENT_TOKEN)
API key Orchestrator apps → orchestrator fuse apikeys create

Both host agents take a token the same way, only the env var naming differs per backend, so a GPU host registers with $QEMU_AGENT_TOKEN where a Firecracker host registers with $FC_AGENT_TOKEN.

The single most common setup mistake is passing the host agent token to fuse connect, or the orchestrator token to fuse host register. They are not interchangeable. fuse connect and fuse host register both probe with the token you give them and fail early with a message naming the layer that rejected it, rather than surfacing an opaque 401 one command later.

Default ports:

Port Service
8080 Orchestrator (control plane API)
8090 Firecracker host agent (fc-agent)
8091 GPU/QEMU host agent (qemu-agent)
19551-<19550 + max VMs> Per-VM guest-agent DNAT range, Firecracker hosts (fc-agent)
19651-19899 Per-VM guest-agent DNAT range, GPU/QEMU hosts (qemu-agent)

The two DNAT ranges differ because each agent has its own FUSE_HOST_PORT_BASE default, 19550 for fc-agent and 19650 for qemu-agent, and each allocates one port per VM slot, lowest free first. qemu-agent slots run from 1 to 249. fc-agent slots run from 1 up to the start of the host’s ephemeral port range (13217 with the defaults), so open as far as the most VMs the host runs (19551-19799 covers 249). Open the range that matches the backend the host actually runs, rather than assuming one range covers the fleet.

Configuration

Env var Flag Default Purpose
ORCH_LISTEN --listen :8080 API listen address.
--write-timeout 60s Max time to write a response. Mutating calls wait for their operation up to 10s less than this (at least 1s) before answering 202 with an operation id; see Long operations and retries.
FIRECRACKER_BASE_URL --firecracker-url empty → stub Firecracker host agent URL.
FIRECRACKER_TOKEN --firecracker-token Bearer token for the host agent.
DATABASE_URL --database-url empty → in-memory Postgres state store connection string.
TOKEN_ENCRYPTION_KEY Required. Hex-encoded 32-byte AES key (openssl rand -hex 32) for per-VM token encryption at rest; it also seals the create, fork and webhook inputs restate journals. The orchestrator refuses to start without it.
AGENT_DOWNLOAD_URL URL to fetch the guest agent binary at boot (alternative to baking it in).
ORCH_TLS_CERT / ORCH_TLS_KEY --tls-cert / --tls-key Serve the API over TLS. Setting only one fails at startup.
ORCH_SECURE_COOKIES --secure-cookies empty → derived from TLS Force the Secure flag on session cookies. Set to true when a proxy terminates TLS. See Security hardening.
ORCH_REQUIRE_AUTH false Fail-closed strict mode: refuses to boot unless ORCH_AUTH_TOKEN and DATABASE_URL are both set (TOKEN_ENCRYPTION_KEY is required either way).
ORCH_AUTH_TOKEN --auth-token empty → no auth Static bearer/master token. See Authentication.
ORCH_ALLOWED_CIDRS --allowed-cidrs empty → open Comma-separated CIDR allowlist.
ORCH_SHUTDOWN_TIMEOUT_SECONDS --shutdown-timeout 30 Graceful shutdown ceiling.
ORCH_DRAINING_TIMEOUT_SECONDS --draining-timeout 330 (5m30s) Destroy an environment left draining this long with no DELETE. See The reconcile loop.
ORCH_ARTIFACT_PULL_TIMEOUT_SECONDS --artifact-pull-timeout 0 Bound on one attempt at a host-to-host artifact copy: the timeout of the Artifacts move’s pull step, not the request’s. 0 leaves only the host agent client’s own timeout.
ORCH_VM_PREFIX --vm-prefix fuse- Prefix applied to generated VM names.
FUSE_RESTATE_MODE self self or cloud (empty means self). self uses a restate-server you run next to the orchestrator; cloud uses a Restate Cloud environment, see Restate Cloud. off was removed: the orchestrator refuses to start with it.
FUSE_RESTATE_INGRESS_URL Restate ingress URL, always required. http://127.0.0.1:18080 with ops/restate/compose.yaml.
ORCH_RESTATE_STARTUP_TIMEOUT_SECONDS --restate-startup-timeout 120 How long startup waits for restate ingress to answer and for this orchestrator’s deployment to be registered before it exits. The API does not open until both hold.
FUSE_RESTATE_API_KEY / FUSE_RESTATE_IDENTITY_KEY Mode cloud only: the Cloud API key and the publickeyv1_... signing key. Other cloud settings are on Restate Cloud.
ORCH_RESTATE_LISTEN 127.0.0.1:9080 Restate handler endpoint (h2c). Only restate-server, or the TLS proxy in front of it in cloud public mode, should reach it.
FUSE_RESTATE_RETRY_<SERVICE>_INITIAL_INTERVAL / _MAX_INTERVAL / _MAX_ATTEMPTS 500ms / 30s / 10 Invocation retry policy per restate service; <SERVICE> is ENVIRONMENT, HOST, ARTIFACTS, ARTIFACTPIN, WEBHOOKS, INTERVENTION or IMAGES. The ARTIFACTS policy also bounds the retries of an artifact move’s pull; the ENVIRONMENT policy bounds the host steps of a destroy, snapshot, restore or token rotation upload (a rotation’s state store write retries without bound), and the retries of a snapshot gc deletion. The WEBHOOKS policy only covers restate failing to run one delivery attempt; a receiver that is down is retried on its own 24-hour schedule (see webhooks). The INTERVENTION policy covers restate failing to deliver an approved hitl action’s run or a deadline timer; the run’s own state store writes retry without bound. The IMAGES policy bounds the retries of an image convert’s status polls; the convert call itself is not retried, so a refusal is the API’s answer at once.

With FIRECRACKER_BASE_URL unset, the orchestrator runs the in-memory stub provider (fine for local dev, not for production). With DATABASE_URL unset, state is in-memory and does not survive a restart.

Restate

Restate is required. Every operation runs on it: creates, destroys, forks, migrates, artifact moves, snapshots, restores, the checkpoint chain, snapshot gc, token rotation, drain and expiry, hitl approved runs, deadlines and webhook deliveries, image converts and builds. To run it next to the orchestrator:

docker compose -f ops/restate/compose.yaml up -d
FUSE_RESTATE_MODE=self FUSE_RESTATE_INGRESS_URL=http://127.0.0.1:18080 orchestrator &
ops/restate/register.sh   # after the handler endpoint is up, and again after every orchestrator upgrade

The compose file uses host networking and binds every restate port to loopback: ingress 18080 (restate’s default 8080 is the orchestrator), admin 9070, node 5122. The admin port has no auth, so keep it off the network. To use Restate Cloud instead, see Restate Cloud. At startup the orchestrator serves its handler endpoint, then waits up to --restate-startup-timeout for ingress to answer and for a ping to reach the Environment object (its deployment registered) before the API opens; on timeout it exits saying whether restate was unreachable or reachable with no deployment registered. Once running, with restate down, /ready stays 200 with status: degraded and the restate check set to the error: reads, exec, files and streams do not need restate.

A create runs as Environment/{vm_id}/Create, one journaled step each for begin, place, artifact, ingress, boot, egress, upload, startup, agent and running. An orchestrator restart mid-create resumes at the first unfinished step. A step that fails for good (an unschedulable spec, a startup script that exits non-zero, a step out of retries) rolls the create back: proxy egress released, ingress unpublished, the task failed, and the VM destroyed through Environment/{vm_id}/Destroy. The create’s inputs (spec, manifest, secrets, startup script, gateway token, files) are sealed under TOKEN_ENCRYPTION_KEY before they reach the journal.

A fork runs as Environment/{new_vm_id}/Fork, keyed by the fork’s own VM id: begin, a provisioning placeholder row, the seed snapshot (a call to the source’s Environment/{vm_id}/Snapshot, so only the snapshot waits behind the source’s other operations), place, artifact (for an off-host fork), create, ingress, credentials, upload, start agent, running, task and lineage. An orchestrator restart mid-fork resumes at the first unfinished step. A step that fails for good before running rolls the fork back: ingress unpublished, the placeholder dropped, the new VM destroyed through Environment/{new_vm_id}/Destroy (reason fork_rollback) and a seed snapshot the fork took deleted. Its inputs are sealed like a create’s.

Host register, cordon, uncordon and remove on restate run on the Host/{host_id} object, so the operations on one host run one at a time and each store write is a retried step. A remove takes the host out of the scheduler in one step and deletes its row in the next, so a database failure retries the delete instead of reporting the host missing. Registration carries the host’s record with its agent token encrypted under TOKEN_ENCRYPTION_KEY; without that key registration stays in process, so the token never reaches the journal in the clear.

Postgres is the source of truth

Fuse doesn’t ship any backup or disaster-recovery tooling of its own, no pg_dump wrapper, no export/import command, no point-in-time-recovery integration. Everything durable (environment records, snapshot metadata, API keys, host registrations) lives in the migrations under internal/orchestrator/migrations/, applied automatically at boot. Treat this Postgres database the same way you’d treat any other production database: standard backup practices apply (pg_dump/pg_restore, WAL archiving, a managed Postgres provider’s automated snapshots, whatever your organization already uses elsewhere). This is general Postgres operational guidance, not something specific to Fuse, there’s no Fuse-side hook or lifecycle event tied to it.

Snapshot restore (fuse snapshot restore, see Snapshots) is an entirely different, VM-level concept, restoring a Firecracker microVM’s disk from a checkpoint. It has no relationship to Postgres backup and doesn’t substitute for one.

Quickest path: co-locate with a Firecracker host

The simplest topology co-locates the orchestrator on a Firecracker host and talks to fc-agent over loopback. The host toolchain installs both as systemd services:

cd host-agent/firecracker
./scripts/fc-install.sh                     # firecracker + kernel + rootfs
./scripts/fc-agent.sh install-service       # host agent (systemd, :8090)
./scripts/fc-agent.sh install-orchestrator  # orchestrator (systemd, :8080), co-located
sudoedit /etc/default/orchestrator  # set DATABASE_URL (postgres)
sudo systemctl start orchestrator

install-orchestrator resolves the orchestrator binary (from ORCH_BIN_SRC=/path, a local ./orchestrator, an existing /usr/local/bin/orchestrator, or the latest GitHub release), writes /etc/default/orchestrator prefilled with FIRECRACKER_BASE_URL=http://127.0.0.1:8090, this host’s FIRECRACKER_TOKEN, and freshly generated ORCH_AUTH_TOKEN + TOKEN_ENCRYPTION_KEY (never overwriting an existing file), then installs orchestrator.service ordered after fc-agent.service. It also sets up restate: it adds FUSE_RESTATE_MODE=self, FUSE_RESTATE_INGRESS_URL and ORCH_RESTATE_LISTEN to the env file (and a TOKEN_ENCRYPTION_KEY to an existing file that has none), installs and starts restate-server.service (docker), or reuses a restate already answering on 127.0.0.1, and registers the orchestrator’s handler endpoint from the unit’s ExecStartPost on every start.

Auth is on by default: the orchestrator refuses to boot until you supply a Postgres DATABASE_URL. The installer leaves that as a placeholder and does not start the service until you fill it in; the schema is created automatically on first boot.

It then prints the FUSE_BASE_URL and FUSE_TOKEN values for connecting a dashboard, if you’re running one. FUSE_TOKEN must match the orchestrator’s ORCH_AUTH_TOKEN. Open 8080/tcp (or terminate TLS at a reverse proxy and point clients there). Remove the service with ./scripts/fc-agent.sh uninstall-orchestrator.

One script: dedicated control-plane host

For a host that runs only the control plane (no co-located agent), use the standalone installer instead:

sudo ./ops/install-orchestrator.sh

It installs the orchestrator binary (from ORCH_BIN_SRC=/path, a local ./orchestrator, or the latest GitHub release), writes /etc/fuse/orchestrator.env with a freshly generated ORCH_AUTH_TOKEN and TOKEN_ENCRYPTION_KEY (never overwriting an existing file), runs restate-server beside it (mode self, the default, needs docker; see the restate runbook), installs and starts fuse-orchestrator.service, registers its restate endpoint, and prints the exact fuse connect line to run from your laptop:

orchestrator installed and listening on :8080

  fuse connect http://<this-host>:8080 --token <generated> --master

When the binary comes from a GitHub release, the installer downloads checksums.txt for that exact tag and verifies the archive’s SHA-256 before extracting or installing anything. host-agent/firecracker/scripts/fc-update.sh and fc-agent.sh install-orchestrator do the same for every asset they fetch. A missing checksums.txt, a missing entry for the asset, or a mismatch aborts the install, leaving the existing binary in place and the service unrestarted.

The default posture is a single-node, in-memory store with auth on, so it starts immediately (with a warning that the in-memory store forgets VMs on restart while restate keeps running what it held for them). For a durable deploy, set DATABASE_URL in /etc/fuse/orchestrator.env, uncomment ORCH_REQUIRE_AUTH=true, and restart. This is a different unit (fuse-orchestrator.service, config in /etc/fuse/) from the co-located install-orchestrator path above (orchestrator.service, config in /etc/default/orchestrator); use one or the other per host, not both.

Running the orchestrator standalone

To run one control plane scheduling across many hosts instead of co-locating, skip install-orchestrator and point FIRECRACKER_BASE_URL at each host’s agent URL, then register the rest via fuse host register (see Hosts). Topology is just one env var: loopback co-locates, a remote URL doesn’t.

Build and run directly

go build -o bin/orchestrator ./orchestrator
export FIRECRACKER_BASE_URL=http://<host>:<port>
export FIRECRACKER_TOKEN=<token>
export TOKEN_ENCRYPTION_KEY=<hex-encoded 32-byte AES key>
export FUSE_RESTATE_INGRESS_URL=http://127.0.0.1:18080   # restate-server, see Restate above
export ORCH_AUTH_TOKEN=<token>
export DATABASE_URL=postgres://...
./bin/orchestrator

Was this page helpful?