Run a relay

Run a relay

A relay is loot serve: one process, one data directory, and an allowlist of public keys. It ships in the loot binary you already installed. This page is the reference; for a walkthrough, see Run a host of your own.

Flags

FlagDefaultMeaning
--dir <path>.loot-relayThe data directory, relative to where you run it. Created on first start.
--addr <host:port>127.0.0.1:4000The address to listen on.
--allow <pubkey>none (open)Admits one key to push and to read. Repeat it once per key. Takes the line loot whoami --pubkey prints, or the same key as 64 hex characters.
--allow-grant <pubkey>the --allow listAdmits one key to deliver grants. Given at all, it replaces the default rather than adding to it.

With no --allow at all, the relay is open: any validly signed push is accepted and anyone who can reach it can read what it holds. See Access control and allowlists. An --allow with its key missing refuses to start rather than opening the relay, and --allow=<key> is refused as an unknown flag: write the key as the next argument.

The relay says which posture it started in:

starting loot relay (dir = ./relay, addr = 127.0.0.1:4000) — 1 key(s) allowed to push and to read
  grants: the same 1 key(s) (no --allow-grant given)
  a relay stores and forwards ciphertext — it can never read restricted or embargoed content
  it CAN read internal content: those keys ride along so peers pulling from here get readable files
loot relay listening on 127.0.0.1:4000

Network

The relay speaks plain HTTP. It has no TLS of its own, so keep it on 127.0.0.1 and put a TLS proxy in front of it, as Deploy to a VPS shows. The client speaks HTTPS, so a remote URL can be https://. One request body may be up to 64 MiB; a proxy in front must allow at least that.

The data directory

--dir is the whole relay: every change, object and pending grant lives there. Outside it, loot writes only its local telemetry tally under the config base. Point it at a new or empty directory, or at an existing relay store. Any other directory is refused, a working repo included. What each part holds, and what a copy of it discloses, is on Backups and restore.

The store has no size cap and grows with every push. A relay never forgets a change, so nothing it holds is unreachable; only a burn removes bytes. Watch the disk.

Endpoints

Clients reach these through loot push, pull, clone, grant --relay and pull-grants. Every endpoint but /info is a POST carrying a signed envelope.

EndpointWhat it doesWho may call it
GET /infoVersion, format, both allowlists as hexAnyone, unsigned
/stowAccepts a push--allow keys (anyone when open)
/negotiate, /offer, /fetch, /wants, /havesServe a pull, clone or fetch--allow keys, signed (anyone, unsigned, when open)
/grantDeposits a sealed grantThe grant allowlist
/pull-grants, /grants/peek, /grants/ackRead and acknowledge your own grant mailboxAny signed key, for its own mailbox

A missing or bad signature is 401; a valid signature from an unlisted key is 403, and the message names the key. Forge routes such as /ingest answer 404. loot remote info prints a relay's /info.

Operator commands

These act on a data directory directly, not over the network.

CommandWhat it does
loot count-objects --dir <dir>Measures the store. Read-only.
loot gc --dir <dir> [--dry-run]Sweeps interrupted writes. Expect it to find little else, because a relay never forgets a change.
loot relay reap-grants --dir <dir> --older-than <days> [--apply]Destroys grants nobody collected in that window. Lists them unless --apply. The recipient is never told, and it can't be undone.
loot relay abandon-head --dir <dir> --head <prefix> [--apply]Stops serving a stale head as a second line. Its changes stay on disk. Run --apply with the relay stopped.