grove · deployment

Deployment

Posture: loopback-only, unauthenticated, guarded

The API is unauthenticated. Four compensating controls stand in for served-mode auth and retire together when it lands (mechanics: api.html § Guards):

  1. The bind gate. GROVE_BIND accepts a literal ip:port and only a loopback address. A hostname is refused rather than resolved, there is no override, and the check runs both in Config::new and again at Daemon::bind, so a hand-built config cannot slip past it.
  2. The host guard. Every request — reads and the event stream included — must carry a Host of localhost, 127.0.0.1, ::1 or the bind address, any port.
  3. The readiness gate. While draining or degraded, every /api path but /api/health and /api/daemon/shutdown answers 503.
  4. The mutation guard. A state-changing request must carry no Origin (every non-browser client) or one whose host is localhost, 127.0.0.1 or ::1 — a fixed list, never the request's own Host.

Residual until auth: another process on a loopback port can present a loopback origin, and any local user who can reach the port can drive the API. Putting grove on a LAN is another service's job.

The CLI's client is looser than the daemon: it accepts a hostname in GROVE_BIND, because it only has to reach whatever is listening — though the host guard answers only localhost among names, so any other alias is refused with 403 — and it builds its HTTP client with no_proxy so an HTTP_PROXY in the operator's environment cannot sit between it and a daemon on its own loopback address.

Reactivation is a cold boot

The daemon may be killed at any moment and restarted with only the filesystem intact:

  • desired state is manifest.toml, actual state is git on disk, and there is no database;
  • engine status, the pool count and the log ring are caches, re-derived or simply empty on the next boot;
  • an abandoned clone is re-derived from disk — a bare with no trunk checkout is exactly the half-realized state reconcile_one finishes;
  • roots::adopt at boot re-declares any on-disk bare that lost its manifest entry.

A substrate may stop, snapshot, move and restart the process freely; SIGTERM, SIGINT and SIGHUP each drain and exit 0. The bounded drain (architecture.html § Drain) lets in-flight git work land; it is not a precondition.

What the substrate must provide

needwhy
a Unix host — Linux or macOSgrove-ops uses openat/renameat/symlinkat through rustix; there is no Windows path
git on PATHworktree, status, prune, fetch and remote reads shell out to git (grove_ops::git::git_command, which pins LC_ALL=C and scrubs git's local-repo environment). The bare clone itself goes through gix in-process
a writable $GROVE_HOME — the workspacedefault ~/.grove; holds manifest.toml and its advisory manifest.toml.lock (manifest read-modify-write), every checkout under code/<slug>/, everything grove owns for each root under roots/<slug>/ (the bare, the warm pool, the in-flight-clone marker), and the daemon's grove.lock, grove.pid and serve.log (with one rotated serve.log.1, and the server agent's stderr in serve.err). No install lives here
a filesystem with symlinksshares in the workspace
outbound HTTPS/SSH to the git remotesclone and fetch
loopback networkingthe API

No database, no message broker, no second runtime. One executable.

Releases are built for aarch64-apple-darwin only and installed by grove setup (install and upgrade); elsewhere, build from source.

Configuration

variabledefaulteffect
GROVE_HOME~/.grovethe workspace grove realizes — manifest.toml, code/ (checkouts), roots/ (bares, pools, clone markers), grove.{lock,pid}, serve.log — resolved once, in grove_ops::home, for the CLI, the launcher and the daemon alike
GROVE_BIND127.0.0.1:7777where the daemon listens (daemon: literal loopback only)
GROVE_LOGinfoEnvFilter directive for what the process writes to serve.log and stderr (ANSI colour on stderr only, and only when it is a terminal)
GROVE_LOG_RINGinfothe level at which lines enter the ring GET /api/events streams
GROVE_MANIFEST_FS_WATCHonthe opportunistic manifest.toml filesystem watch
GROVE_CLONE_LIMIT4how many roots may hold a clone at once
GROVE_CLONE_TIMEOUT_SECS3600clone budget; 0 disables
GROVE_FETCH_TIMEOUT_SECS600fetch budget; 0 disables
GROVE_OTLP_TRACES_ENDPOINT—the full URL of the OTLP/HTTP collector, JSON body, the span exporter posts to (floodgate: http://127.0.0.1:1709/api/span). Required: there is no default destination, so GROVE_TELEMETRY without it stays a no-op. grove setup writes both variables into the server agent's plist when its own shell sets them, and a bare grove setup removes them
GROVE_TELEMETRYoffopts grove serve's OpenTelemetry span exporter in (architecture.html § Telemetry)

An unparseable GROVE_BIND is a loud error in both the daemon and ServerControl, never a silent default — otherwise on/off would target one address while the API client talked to another.

The two are independent, so they are cross-checked. GET /api/health carries the home the daemon realizes, and the CLI treats a daemon serving a different home as absent: this home has no realizer, so it realizes in-process against the home it was pointed at. Setting GROVE_HOME alone — a second home, a sandbox, a script — leaves GROVE_BIND on its default, which is how a client scoped to one home reaches another's daemon.

Running it

grove serve    # the launcher contract: run the daemon in this process, in the foreground
grove on       # start it detached; it logs to $GROVE_HOME/serve.log
grove off      # drain over the API, then SIGTERM → SIGKILL if it will not go; launchd's agent: bootout
grove reboot   # off, then on; launchd's agent: kickstart -k, or a plist reload under a managed launch constraint
grove ok       # is it healthy?

grove serve is the published launcher string: grove on spawns <binary> serve, and any supervisor unit should spell it the same way (serve_is_the_launcher_subcommand pins it). grove on launches the running executable itself, and hands the child the resolved GROVE_BIND and GROVE_HOME so it realizes the manifest the operator is looking at.

Under a supervisor, run grove serve in the foreground and let the supervisor own restarts: the process ends by returning from serve, never by calling exit. On macOS grove setup writes that supervisor, the launchd agent dev.gigantic.grove.

Two daemons are kept off one home by grove on, not by grove serve: on serializes its liveness-check → spawn → pid-write under an exclusive flock on $GROVE_HOME/grove.lock (opened O_CLOEXEC, so the launched daemon does not inherit and hold it), refuses when a pid file names a live process, and refuses when the bind is already held with no pid file rather than adopting a stranger, whose 200 could answer grove's readiness poll. A bare grove serve takes no such lock and simply fails to bind.

Not here

  • Auth / served mode — the loopback posture above stands until it lands.
  • UI — a dashboard reads GET /api/roots and GET /api/events and mutates only through the CLI or the API. This repo ships no UI.
  • A remote or multi-tenant deployment — grove realizes one home on one host.