TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/deeplethe/forkd/llms.txt
Use this file to discover all available pages before exploring further.
forkd-controller daemon is the long-lived process that owns everything in a production forkd deployment: the on-disk snapshot registry, all active child Firecracker processes, cgroup quota enforcement, the REST API, and the append-only JSON audit log. Clients — the CLI, Python SDK, TypeScript SDK, and MCP server — all talk to it over HTTP/JSON, loopback by default. Running the daemon is recommended for any deployment beyond local development.
Install with systemd
The repository ships a hardened systemd unit atpackaging/systemd/forkd-controller.service. Install it, create the token file, and start the service:
/healthz endpoint is always unauthenticated so that load balancers and Kubernetes probes can reach it without credentials.
Authentication
The daemon uses bearer-token authentication. When--token-file is supplied, every request except /healthz must include a matching Authorization: Bearer header. Without --token-file, the daemon runs unauthenticated — safe only when bound to loopback.
Passing the token in requests
FORKD_TOKEN environment variable:
Token rotation
The token is read once at daemon startup. To rotate:TLS
For any deployment where the daemon binds to a non-loopback address, enable TLS to protect the bearer token and API payloads in transit.aws-lc-rs crypto provider. TLS 1.2 and TLS 1.3 are accepted; legacy cipher suites are not negotiable.
TLS does not automatically enable authentication. Supply
--token-file as well — the two flags are independent.sudo systemctl restart forkd-controller.
Prometheus metrics
Scrape:8889/metrics from your Prometheus instance. No auth is required if the endpoint is loopback-only; with a non-loopback bind, the scrape request must carry the bearer token like any other request.
Stable metric names
| Metric | Type | Description |
|---|---|---|
forkd_build_info | Gauge | Always 1. Labels carry version. Use to detect daemon downtime. |
forkd_snapshots_total | Gauge | Number of registered snapshots in the registry. |
forkd_sandboxes_active | Gauge | Number of live child Firecracker processes. |
Suggested alerts
Audit log
Every request is recorded as a single JSON line in/var/log/forkd/audit.log:
logrotate. The daemon does not yet implement SIGHUP-triggered file re-open — after a rotation, run sudo systemctl restart forkd-controller.
Daemon CLI flags
Theforkd-controller serve subcommand accepts the following flags. Every flag also reads from the corresponding environment variable.
| Flag | Env var | Default | Description |
|---|---|---|---|
--bind | FORKD_BIND | 127.0.0.1:8889 | TCP address the HTTP/HTTPS server listens on. |
--state | FORKD_STATE | /var/lib/forkd/state.json | On-disk JSON registry. Auto-created on first run. |
--snapshot-root | FORKD_SNAPSHOT_ROOT | (daemon default) | Root directory for tagged snapshot subdirs (vmstate + memory.bin). |
--audit-log | FORKD_AUDIT_LOG | /var/log/forkd/audit.log | Append-only JSON audit log path. |
--token-file | FORKD_TOKEN_FILE | (none — unauthenticated) | File containing the bearer token. Required for any non-loopback deployment. |
--tls-cert | FORKD_TLS_CERT | (none — plain HTTP) | PEM-encoded TLS server certificate chain. |
--tls-key | FORKD_TLS_KEY | (none — plain HTTP) | PEM-encoded TLS private key matching --tls-cert. |
--prewarm-scratch-dir | FORKD_PREWARM_SCRATCH_DIR | /dev/shm/forkd-prewarm | Scratch directory for prewarm throwaway snapshots. Use tmpfs. |
--branch-concurrency | FORKD_BRANCH_CONCURRENCY | 4 | Maximum concurrent BRANCH operations. Each writes a full memory.bin (256 MiB – 8 GiB), so this bounds peak transient disk usage. |
SDK environment variables
| Variable | Purpose |
|---|---|
FORKD_URL | Base URL for the controller (e.g. http://127.0.0.1:8889). Read by the Python SDK, TypeScript SDK, and CLI. |
FORKD_TOKEN | Bearer token passed as Authorization: Bearer. Read by all official clients. |
systemd unit hardening
The shipped unit (packaging/systemd/forkd-controller.service) runs with a narrow capability set and systemd hardening options. Key settings:
CAP_NET_ADMIN (tap device creation, per-child netns) and CAP_SYS_ADMIN (cgroup v2 writes). MemoryDenyWriteExecute=false is required because Firecracker JIT-maps guest memory.