Skip to content

Outposts

Partial

An outpost is a collection process placed near the fleet that runs tasks and commands over endpoints and reports back. It is the same omniglass binary in its outpost run mode. It pulls its worklist from the server, runs the work on the spot, parses what it reads at the edge, and ships the results over the bus. To operate outposts, see the operator collection guide; what an outpost runs is described by collection, and what it reports of its own health by self-monitoring.

An outpost follows the identity triad. Its id is the immutable key every reference stores (endpoint.outpost_id). Its name is its fleet address: the token in every bus subject it uses and its enrollment identity, so it has no :rename (moving it would move a live subject) and the PATCH /outposts/{name} body carries no name. Its label is the friendly string.

Its optional location is descriptive, not a scope: an outpost serves the whole fleet, and the location clears if that location is deleted. The create and update still resolve the location within the caller’s own location:read scope, so a location outside it is refused as absent (ADR-0089).

An outpost is a taggable owner: tags whose applies_to includes outpost bind to it directly, with no cascade. Creating an outpost (outpost:create) does not enroll it; enrolling is a separate act (outpost:enroll, below). Decommissioning (DELETE /outposts/{name}, outpost:delete) deletes the outpost and cascades its endpoints, their derived tasks, its tags, its self-logs, its platform component and its credential; the telemetry it collected from components is untouched.

An outpost acts only for itself. Its bus credential is permitted only its own subjects, and the ingest consumer confines what it lands to the tasks placed on it: a batch group for another outpost’s task is dropped, warned about once per outpost per minute and counted on the outpost’s orphaned_batches and last_orphaned_at.

omniglass outpost run --simulate runs the simulator in the outpost’s own process: every component placed on the outpost whose product a profile simulates is served on its own 127.60.0.x loopback address, and the outpost collects from it as it would from hardware. The simulator holds the outpost’s identity, so there is no second enrollment (ADR-0142). --impairments, --port-offset and --poll belong to the simulator and are refused without --simulate; --impairments needs NET_ADMIN. The lab runs its outpost this way.

The worklist is everything placed on the outpost, resolved by the server: each task with its driver function baked (its request, schedule and emits, each emit’s lane fixed at attach), its driver’s session block and ladder, its inputs, and the secrets that cascade onto its component (ADR-0135). The outpost never sees a driver spec, and keeps no endpoint config apart from its last worklist.

A reply travels grouped by endpoint: an endpoint’s fields (params, ladder, learned pin, last rejection, connection fingerprint) ride once however many tasks run over it, and the task specs, session blocks and credentials tasks share ride once in dictionaries a task names by index (ADR-1583). The reply also carries a config_generation, the newest updated_at among the outpost’s endpoints, which moves at operator pace, never at telemetry pace.

The pull runs on its own goroutine and interval, apart from the heartbeat (--worklist-every, 30 s by default, each wait jittered within 10%), over request-reply on og.v1.worklist.<outpost>. A pull that fails never stops the outpost (ADR-1577):

  • Retried, never fatal. Every pull, the first included, retries on a jittered backoff from 1 s to a 30 s cap, each failure logged at WARN. After the first success a failed pull keeps the last good worklist, every task and session of it. Before it, the outpost still heartbeats and reports itself, so an outpost refused from the start reads as up with its pulls refused (ADR-1882).
  • Counted, so a stale worklist reads as loss. Keeping the last worklist hides the failure, so the outpost reports worklist-pull-loss-ratio every report window, and the seeded worklist-stale rule warns when it holds at 1 (self-monitoring).
  • Failed whole by the server. A worklist the server cannot read in full, or one still over the bus’s max_payload once compressed, is answered with an Omniglass-Error header and no body. A database blip never reaches the outpost as a short worklist, which would tear down the sessions of the tasks it dropped.
  • Compressed past 64 KB. A larger reply is gzipped and marked Content-Encoding: gzip.
  • Served from a bounded pool. The outpost states its wait in an Omniglass-Timeout header. The server stamps each pull’s arrival, queues it (up to 256) and answers it from a pool of workers (8 by default, held under the database pool’s size). A pull past its deadline is dropped unread, one whose deadline passes mid-build is abandoned, and one that meets a full queue is refused at once as busy, so the outpost backs off rather than waiting out its budget.

The worklist grows only when an operator changes what the outpost runs or the outpost learns something: a key pinned on first use or an endpoint’s last rejection, each riding once on its endpoint’s entry.

A scheduled pull alone leaves an edit waiting up to one interval. Instead, the commit of any write that changes an outpost’s worklist nudges that outpost, and it pulls at once (ADR-1945):

  • The write announces, in its transaction. It issues a Postgres NOTIFY naming each outpost it touched, which Postgres delivers only on commit, once per outpost. The writers are an endpoint’s create, edit, :retry or delete (an edit that moves an endpoint names both outposts); a driver change to its spec; a secret’s create, delete or field edit (the outposts of every endpoint whose inputs name it and whose component it covers); a path dependency added or removed; a component rename or move; a location moved to a new parent; and a change to collection.report_seconds, which every worklist carries. A label-only edit nudges nothing.
  • The server forwards it. The bus holds one listening database connection, outside the pool, and publishes an empty message on og.v1.worklist-changed.<outpost>. A dropped listener reconnects on a backoff; a change committed while it is down reaches its outpost on the next scheduled pull.
  • The outpost coalesces. It subscribes before its first pull, folds a burst into one more pull, and pulls at most once every 200 ms. A backing-off pull is not cut short.

The nudge carries nothing, so a lost one costs only the wait for the next scheduled pull: --worklist-every is how stale an outpost can be at worst, and the nudge is how fresh it is when nothing is lost. Once a worklist lands, the outpost reconciles its held sessions and hands the new tasks to its dispatcher at once, so a declared change is running within a second, with no restart and nothing to apply. On the server, an endpoint edit or a driver spec change re-derives the affected tasks in the same transaction, and a session whose connection fingerprint moved is recycled on the pull that carries it.

The edge is outbound-only: an outpost often sits behind NAT, so the server never dials it. An outpost is one authenticated client of the server’s in-process NATS server, and every flow rides a subject carrying its own name, which its credential alone is permitted:

SubjectShapeWhat
og.v1.worklist.<outpost>request-replythe worklist pull
og.v1.worklist-changed.<outpost>server to outpostthe change nudge
og.v1.heartbeat.<outpost>outpost to serverliveness; the server stamps last_heartbeat_at
og.v1.telemetry.<outpost>JetStream publishtelemetry batches, below
og.v1.command.<outpost>request-replythe command queue pull
og.v1.commandstatus.<outpost>outpost to servera command’s outcome
og.v1.run.<outpost>server to outpost, request-replyan on-demand run, below

The credential is a shared secret: the enrollment token is exchanged for the outpost’s bus password. The decentralized nkey and JWT model is deferred (ADR-0036).

Commands: a durable server queue, a stateless edge

Section titled “Commands: a durable server queue, a stateless edge”

A command is issued server-side and queued in the database; the edge holds nothing durable. The outpost pulls its pending commands, rendered for it over the driver’s binding, on its heartbeat, actuates them one at a time through each endpoint’s lane, and reports each outcome. The pull itself marks a command dispatched, and one never reported is redelivered or expires, so a restarted outpost loses nothing (ADR-0136, queue health).

The outpost publishes at-least-once and the platform lands each batch once (ADR-0453, ADR-0311).

  • One spool. Every telemetry publish (a task’s samples, a collection failure, a session transition, the self-logs) goes through one spool. A task’s result joins as a group, and the spool coalesces pending groups into one batch: it flushes after a second, or sooner when the next group would pass the batch’s 512 KiB budget. A session’s pushed samples flush at once.
  • Fixed at the flush. The flush marshals the batch once and mints its Nats-Msg-Id (a UUIDv7), so every retry ships the same bytes under the same id. A batch counts as sent only once the stream acks it.
  • In order, never blocking. One shipper keeps up to 32 batches in flight with the stream, in order, so no caller waits on the stream. A batch not acked stays at the spool’s head and ships on the next tick under the same id. A duplicate inside the stream’s five-minute window is stored once, and past it the server’s batch receipt keeps it from landing twice (messaging). The connection buffers nothing across a reconnect and reconnects without limit, so order holds, which the property lane’s transition guard depends on.
  • Bounded, and told. The spool is memory, capped at 10,000 batches, 16 MiB or 12 hours. Past a cap it drops the oldest batch not in flight, says so once when it starts and once with the count when it drains, and makes the next tick resend current state (each held session’s state and auth result, each listener’s faults), so the server never keeps showing a session up that went down meanwhile. The 12-hour cap sits inside the receipt’s 24-hour horizon. A batch the bus can never take (over its payload limit) is dropped and told rather than blocking every batch behind it.

Every batch carries a delivery ledger: the spool’s boot id, a dense seq, the items of each kind it carries and the items minted before it, and the highest seq below which nothing is still queued. A batch that never lands leaves a hole the server counts by kind. The ledger also carries the outpost’s own losses: a drop at a cap or a bus refusal as a run of seqs with its cause, and items lost before any batch carried them (self-log lines the bounded buffer dropped, a group that failed to encode) as running totals. So the read can tell the outpost hop from the ingest hop (the loss ratio).

The server can ask an outpost to run work now on og.v1.run.<outpost>, a request the outpost answers once (ADR-1163). Nothing is queued: an outpost not connected is an answer (the API’s 503), one that does not answer in the run’s budget another (504), and a run past the operator queue’s cap is refused at once (429).

  • A preview stores nothing and touches no held session; its excerpt is scrubbed of the credential. It takes the lane of the endpoint its transport and target name, or runs off-lane when it names none.
  • A run now takes its endpoint’s lane ahead of the scheduled work, borrows the endpoint’s session, honors its gate, and publishes exactly as a scheduled run would; the schedule is untouched.

The server resolves an endpoint’s secrets down the cascade into the worklist, so device secrets travel to the outpost, confined to the components placed on it. The outpost holds them in memory only and never writes them; a rotated secret moves the connection fingerprint and recycles the session (ADR-0158).

An outpost is created server-side first. Pressing Enroll mints a per-outpost enrollment token (POST /outposts/{name}:enroll), and the outpost claims its identity on first connect (POST /outposts:claim), exchanging the token for its bus credential.

A listener runs where its transport puts it (ADR-1024). A webhook is received by the server, which a cloud sender reaches over public HTTPS and an outpost behind NAT cannot, so a webhook endpoint takes no outpost and its URL is the server’s (/api/v1/webhooks/<token>). The pushes that should not cross a WAN (syslog, SNMP traps, tcp and udp on a shared port) are received by an outpost beside the gear.

Load distribution across a site’s outposts

Section titled “Load distribution across a site’s outposts”

Today an endpoint runs on the outpost its outpost_id names, set by hand. A site with two outposts splits its components only as an operator splits them, and a lost outpost’s endpoints wait for someone to re-point them.

A task runs in one of two modes, poll (on its schedule) or listen (claiming what its endpoint’s held session or socket delivers); a held connection is a property of the endpoint’s transport, not a third mode (collection). Either way the outpost locates and transforms each emit at the edge and lands a collection-failed event for anything that does not parse.

Each kind of work runs on its own timer and its own bounded pool, so a slow device holds only its own endpoint’s lane, never the heartbeat or another endpoint’s work (ADR-1637):

KindWhen it runsWhere it runs
heartbeat--heartbeat, 30 s by defaultpublishes liveness, pulls commands, ships the spool, takes the dispatcher’s window
worklist pull--worklist-every, or at once on a nudgethe pull goroutine
polls and probeseach task’s own interval, from the dispatcherthe lane pool, through the endpoint’s lane
commandspulled on the heartbeatone at a time, each through its endpoint’s lane
held sessionswhile the worklist holds them, reconciled the moment it landsone supervised goroutine each
housekeepingthe shorter of the report window and the heartbeatunclaimed lines, push counts, the collection report

An endpoint whose worklist carries a standing listen task, or a poll over a transport or driver that needs a held connection, gets a session: one connection held across ticks, keyed by the endpoint, that its polls and commands borrow instead of dialing per run. Its machine (establish, authenticate, operate, recover, teardown), its states and its backoff are on collection; auth and rejection, and the gate a refusal closes, are there too (auth and rejection). There is no session table: each transition lands as the session-state property on the endpoint’s component, with session-reason and an outpost self-log (ADR-0150).

How the outpost runs its sessions (ADR-1636):

  • Reconcile on arrival. A worklist reconciles the held sessions and datagram sockets the moment it lands: added, removed, re-addressed or re-keyed endpoints are started, torn down or recycled then. A timed reconcile at the heartbeat interval is the safety net. Every reconcile runs on the outpost’s one run-loop goroutine, the session maps’ one writer.
  • Supervised. Every session goroutine runs under a recover. A panic is logged with its stack, counted, and becomes that session’s ordinary failure (recovering, reason panic: <value>), so a panic on one device’s bytes costs that one session, never the outpost.
  • Bounded establish. First dials and handshakes share outpost-wide slots (--session-dials, 16 by default), so an outpost restarting with hundreds of held endpoints opens them a few at a time. A redial takes no slot, so endpoints that never answer cannot hold up a healthy session’s recovery.
  • Housekeeping on its own clock. Unclaimed lines and push counts are taken on a grid at the report window, so a late pass never stretches the window that follows.

A tls endpoint keeps one public key pin, shared by its session and its probe and carried across recycles: trusted on first use and published as tls-certificate, replaced by a pin the worklist delivers, forgotten when the worklist withdraws it (the ssh host key likewise) (tls).

One reader per held connection routes every inbound message: listeners first, then the exchange in flight by its declared reply shape (or, with none declared, the first unclaimed message), then unclaimed, counted once a report window as the endpoint’s push-unclaimed-count (ADR-0151, listeners over a held session). A websocket exchange is matched by an id the outpost mints into it instead.

Every discrete request an outpost makes rides its endpoint’s lane on one bounded worker pool (ADR-1249). A lane is the unit of exclusion: one request in flight per endpoint, while two endpoints, of one component or of fifty, run side by side.

  • Discrete work rides the lane: scheduled polls and probes, and an operator’s commands, run nows and previews. Operator work waits ahead of the scheduled work on the same lane; nothing is preempted.
  • Standing receivers (listen tasks) never take a lane: a listen task is what holds the session the lane’s polls borrow.
  • Each job asks the gate as it is taken. A job consults the endpoint’s gate first, so work queued behind a request that closed it sends nothing: a command fails naming the reason, a run now or preview answers 409, and a scheduled poll is held and counted. Where several reasons hold, the most causal answers: upstream, then disrupted, then refused, then unreachable.
  • Overload is counted, never queued without bound. A due whose last run is still in flight is skipped and counted. Operator work across every lane is capped at 64: past it a run now or preview answers 429, and the outpost counts offers against refusals in its window.

The outpost’s queues are not durable: on reconnect it re-pulls its worklist and commands and ships its spool, each batch landing once by its receipt.

With --lane-workers auto, the default, an outpost sizes its pool from the CPU and memory it may use (ADR-1869). The CPU count alone is the wrong measure, because a run spends most of its time waiting on its device. The outpost reads its limits from its cgroup (cpu.max, memory.max, the tightest up the tree) and its host (GOMAXPROCS, MemTotal), takes the tighter of each, and then the tighter of two bounds:

  • CPU: half the CPUs times a run’s whole time over its CPU time; at 4.4 ms of CPU waiting 200 ms, about 23 lanes a CPU.
  • Memory: a quarter of the memory, at 1 MiB a lane.

The result is clamped to 4 to 256; a number sets the pool outright (--lane-workers, or OMNIGLASS_LANE_WORKERS). The outpost logs the count and the limits it read at boot, and reports it as lane-worker-count beside worker-busy-fraction. A cgroup v1 memory limit is not read. The lab caps each outpost container at one CPU, so a scale run’s parallelism is one known figure rather than the host’s.

Every endpoint with a host address gets reachability for free: the outpost’s probe runs the endpoint’s ladder on its own interval (--probe-every, 30 s by default; keep it under the console’s 150 s staleness window). Its rungs and their samples are on collection: the ping is informational and shared once per host per probe slot, the transport rung (a connect, a handshake, or for udp and snmp a request answered) is the gate, and the session rung is the login. The endpoint’s endpoint-reachable is their AND.

The probe feeds the endpoint’s gate, which holds a set of reasons and is open only when the set is empty (ADR-1650):

ReasonAdded byReleased by
refuseda terminal refusal on a runga fingerprint change, an operator’s :retry, or the rung passing
unreachabletwo consecutive down probe readingsthe next up reading
disrupteda disruptive command, before it is sent, on every endpoint of its hold setafter the quiet period, each endpoint’s first up reading from a probe begun after it; the hold backstop releases the rest
upstreama closed gate on a component the endpoint is reached throughthe upstream opening, then the endpoint’s own first up reading
  • Unreachable. One lost probe never stops collection, and a rung down only because a refusal holds it does not count. While it holds, a due poll is held: nothing sent, no failure and no backoff booked, counted as poll-held-count, since a poll the outpost chose not to send is not a lost sample. Held sessions and listeners are not gated by it; their own reconnect handles a gone device.
  • Disrupted. A disruptive command arrives with its hold set, and the outpost closes each of those gates before it sends. For the type’s quiet period nothing runs against them; then each reopens on its own first up reading, and the type’s hold_seconds backstop reopens the rest, counted as hold-expiry-count, so a device that never came back is seen (ADR-1651).
  • Upstream. A component reached through another (a path dependency edge) is held while any endpoint of its upstream has a closed gate, so a gateway going down raises one root cause, not a storm behind it. The reason names the root of the closure, derived by one pure function whenever any reason set moves, and a path cycle never holds itself up. An out-of-band endpoint is never held (ADR-1652).

The gate is published as endpoint-rejection and carried back on the worklist, so a restarted outpost adopts a refusal and an upstream hold rather than retrying against an unchanged fingerprint; it does not adopt unreachable or disrupted, which the probe re-earns.

The outpost ships a TelemetryBatch (generated from proto/og/v1/telemetry.proto) on its own telemetry subject: a task group per task it ran (the task, its observed time, and its metric, property, event and log lanes), the outpost’s own self-log lines, and its outpost-self block. The outpost stamps no component identity: the server binds each group’s owner from its task’s endpoint and lands it under the outpost’s confinement. Batches are held and retried until the stream acks them (delivery).

Scheduling, concurrency, and self-observability

Section titled “Scheduling, concurrency, and self-observability”

Each poll and probe runs on its own interval, from a dispatcher with a timer of its own, not on the heartbeat. Every task sits once in a due-time heap; the dispatcher sleeps until the earliest due, hands it to its endpoint’s lane, and books its next due (ADR-1634). A driver poll’s interval is its schedule.every (the heartbeat interval when it declares none); a probe’s is --probe-every.

  • A stable phase. A task’s dues fall on a grid of its own, offset by a hash of its id, so a restarted outpost lands each task on the same slots and a fleet of tasks with one interval spreads across it rather than firing together. A task new to the worklist, or whose connection fingerprint moved, runs at once.
  • Skip, not burst. A task still in flight at its next due is skipped and counted, never queued behind itself, and a late pass runs a task once and books the next slot ahead of now.
  • Outcomes book on the grid. A failed fetch retries on a backoff that doubles from a second up to the interval (a device’s Retry-After is a floor); a terminal refusal waits its interval unless its session comes back up; a poll its gate holds is counted held and runs the moment the gate opens.

What the outpost reports of its schedule: per endpoint, poll-due-count and poll-skipped-count each report window (skipped over due is the endpoint’s schedule loss); and of itself, the longest pass, the dues that met their run in flight, the worst lateness and gap excess, and the pool’s busy share, as platform metrics (self-monitoring). The window’s high-water marks (worker-busy-count, dispatch-queue-depth) are said in a dispatch window self-log line, only for a window that skipped a due or refused an operator’s request, so an outpost keeping its schedule logs nothing.