# Runbook — knowing that a SourceLess node is alive **Audience:** the operator who has to find out at 3am, without being told by a user. **Scope:** one node you operate, and the things outside it that watch it. **Why this page exists.** A production audit stated the gap precisely, and it was correct: > Hermod is wired and polling, and its output lands on `GET /api/alerts` with `GET /health` > beside it. But there is **no `/metrics`, no Prometheus, no OpenTelemetry, no StatsD, no push, > no pager, no deadman**, no `HEALTHCHECK` in the `Dockerfile`, and **no systemd unit, compose > file, k8s manifest or Terraform anywhere in the repo**. Every alerting path is *inside the node > process* — which means the one failure that matters most, **the process is dead**, produces no > signal at all, by construction. *History, 2026-10-26:* the quote is kept as the audit wrote it. Since then the repository has gained systemd units (`deploy/systemd/`) and Kubernetes manifests (`deploy/k8s/`), so its "no systemd unit … k8s manifest" clause is no longer true of the tree. Every claim below is labelled **MEASURED** or **REASONED**. `gh` is unauthenticated here and `act` is absent, and there is no systemd on the host this was written on — so **every deployment artifact in `deploy/` is configuration, not evidence**, and each one says so at the step. --- ## 0. The shape of the problem, in thirty seconds A dead process cannot report its own death. That is not a defect to be fixed inside the node; it is a property of processes. So the fix has two halves and only one of them is code: | | What it is | Where it lives | |---|---|---| | **The pulse** | `GET /metrics` — Cepheid, the Prometheus text exposition | in this repository, `src/ops/cepheid.ts` | | **The observer** | a scraper, a supervisor, an alert rule, a pager | **on your machines, and nowhere else** | **If you install only the first half you have gained nothing for the case that matters.** A metrics endpoint nobody scrapes is the same silence in a different shape. The three things you must run outside the node, in order of how much they buy you: 1. **A supervisor that restarts it** — `deploy/systemd/strblk-node.service`. Fixes most outages before a human sees them. 2. **A scraper that alerts on ABSENCE** — `deploy/prometheus/`. Tells you about the ones it cannot fix. 3. **A dead-man's-switch outside your monitoring** — the `SourcelessWatchdog` rule plus an account with somebody else. Tells you when the thing in step 2 has died. Nothing in this repository can do any of the three for you, and this page does not pretend otherwise. --- ## 1. What the node now exposes MEASURED, against a running node on 2026-09-07: ```text $ curl -sD - http://127.0.0.1:8081/metrics -o /dev/null HTTP/1.1 200 OK content-security-policy: default-src 'none'; frame-ancestors 'none'; base-uri 'none' x-content-type-options: nosniff referrer-policy: no-referrer x-frame-options: DENY cache-control: no-store content-type: text/plain; version=0.0.4; charset=utf-8 content-length: 16580 ``` **120 series** in that scrape. A sample of what is in it: ```text sourceless_up 1 sourceless_build_info{version="0.2.0",chain="SourceLess Development",network="dev",chain_id="31337",genesis="8ee28b94…"} 1 sourceless_chain_height 0 sourceless_finality_head 0 sourceless_finality_rewritable_heights 1 sourceless_finality_confirmation_depth 12 sourceless_peer_sessions 0 sourceless_queue_scan_truncated 0 sourceless_unsettled{state="syncing"} 0 sourceless_verify_pool_state{state="not-started"} 1 sourceless_keys_encrypted_at_rest 0 sourceless_audit_intact 1 sourceless_rpc_requests_total 2 sourceless_rpc_admitted_total{class="read"} 1 sourceless_rpc_refused_total{class="unknown",reason="unknown-method"} 1 ``` `cache-control: no-store` matters more than it looks: a cached scrape is a lie with a timestamp, and a scraper that gets one records a node as healthy for as long as the cache holds. ### The rule about a value the node cannot measure Prometheus has no null. The tempting encoding of "this node cannot answer" is `0`, which is indistinguishable from a real zero — on `best_peer_height` a zero would read as *every peer is at genesis*. **So an unmeasured value is omitted, never zero-filled**, and the reason is written into the body where a person running `curl` will see it. MEASURED, same scrape: ```text # UNMEASURED sourceless_best_peer_height: no peer has advertised a height yet # UNMEASURED sourceless_finality_line: measured, and the measurement has no numeric value at this height # UNMEASURED sourceless_settled_total: the sync engine counts settled writes and the node does not # expose it: HestiaStatus carries the unsettled classes only, and RheaEngine is private to HestiaNode ``` This is better than a sentinel, not merely more honest: it makes the absence answerable by the **same** primitive the dead-process case needs. ```promql absent(sourceless_finality_line) # this node cannot compute its finality line absent(sourceless_up) # this node is not answering at all ``` One alerting idiom, two very different facts, and neither is a magic number somebody has to remember is special. ### Why there is no client library `npm run deps` holds the tree at **2 direct and 4 transitive** dependencies. A Prometheus client library was never available. The text exposition format is documented plain text, so `src/ops/cepheid.ts` emits it with string concatenation and imports nothing outside this repository. The format's own rules — one `# TYPE` per name, a trailing newline, `+Inf` rather than `Infinity` — are asserted in `tests/integration/cepheid.integration.test.ts`, because a scraper enforces them by rejecting the **whole document**: one bad float loses all 120 series. ### What a scrape costs `/metrics` is **not** free and is not a liveness probe. It calls `HestiaNode.status()`, which drives the node's own chain reconciliation, and `OrreryConsole.report()`, which walks the data directory with a `stat` per file. It is behind the endpoint-wide rate limit for that reason. `/health` is the cheap one: it asks the node nothing at all, which is what a probe hit every second has to be. **Probe `/health`. Scrape `/metrics`.** Do not swap them. ### `/health` is liveness. `/ready` is readiness. A load balancer wants the second one `GET /ready`, on the **Iris** RPC door, answers **200** only when this node is fit to be sent client work, and **503 with the reason** when it is not. `GET /health` cannot answer that question and is not meant to: every condition that makes a node unfit to serve leaves it alive. | State | `/health` | `/ready` | | --- | --- | --- | | serving, caught up | 200 | 200 | | still syncing after a restart | 200 | 503 `catching up: this node is at 12 and a peer claims 11041` | | behind and not catching up | 200 | 503 `… is not catching up … it needs a person` | | escalated `local-state-untrusted` | 200 | 503 `… a history it has itself declared untrustworthy` | | no readiness source wired | 200 | 503 `this door was mounted without a readiness source` | The last row is deliberate. A route that answered 200 when nothing had told it would report every node that never wired this up as ready, which is the state it exists to expose. So: **restart on `/health`, route on `/ready`.** A container healthcheck asks whether to replace the process; a load balancer asks whether to send it a client. Swapping them gives you a pool that restarts nodes for being behind, and clients reading balances from a node eleven thousand blocks in the past. --- ## 2. Binding: where the metrics endpoint listens, and why it refuses `/metrics` is served by **Astrolabe**, the operator endpoint, on `127.0.0.1:8081` by default. ### The four ports a node can open, so a second install does not collide | Port | Surface | Default | |---|---|---| | 8081 | Astrolabe — operator endpoint and `/metrics`, GET and HEAD only | `--ops-port` | | 8082 | Gungnir — the operating console. **Has a POST**; TLS or a bind refusal | `--dashboard-port` | | 8083 | Iris — the public JSON-RPC door | `--rpc-port` | | 8084 | **Gna — the browser wallet**, `strblk wallet serve` | `--wallet-port` | **8084 was in no inventory anywhere**, and that has a sharp edge: `brokkr --auto-ports` shifts the 8081–8083 block, and a second install lands its RPC port on 8084 — the browser wallet's default. Two surfaces, one port, and the one that loses is whichever bound second. Gna is a separate process (`strblk wallet serve`), not part of `strblk node`, so an installed node does not open it. It holds no key and signs nothing; the tab does both. ### Seat and seal — the two metrics that make a silent validator visible `sourceless_seat_held` is 1 when this node holds a validator seat, and `sourceless_seal_failures_total` counts seals it attempted and could not complete. They exist because a production node with no producer key threw on every turn into an empty catch and reported height 0 with **every health signal green**. Bring up a whole validator set that way and not one alert fires: `SourcelessNoPeers` clears because they peer with each other, and `SourcelessNotAdvancing` needs a peer that is AHEAD, which none of them is. **`seat_held == 1` with no blocks is NOT on its own a fault.** A node returns early when there is no work — an empty chain does not manufacture empty blocks — so a quiet testnet correctly seals nothing. `SourcelessSeatNotSealing` therefore pairs the two with `queue_depth > 0`. **A non-loopback `--ops-host` is now REFUSED** unless the operator states one of two things, on exactly the terms `Iris` established for the public RPC door. This follows that decision rather than inventing a third policy: `astrolabeExposureRefusal` imports `isLoopbackHost` from `network/iris.ts`, so there is one definition in this tree of what loopback means and it fails closed — an unresolvable hostname is *not known to be* loopback and is treated as public. MEASURED: ```text $ strblk node --ops-host 0.0.0.0 … The operator endpoint will not listen on a public address in the clear. --ops-host 0.0.0.0 is not a loopback address. This endpoint serves the operator page, /api/report, /metrics and the signed /api/ops routes on ONE socket. … ``` ### The justification, since it could have gone the other way Metrics are less sensitive than `submitTransaction`. Height and peer count are on the public explorer already. The obvious argument is that a scrape target which only answers on loopback can only be scraped from the same host, which is a real operational constraint. It refuses anyway, for three reasons, and the third is decisive: 1. **Half of what `/metrics` carries is reconnaissance, not public data.** Queue depths by record kind say what *this operator's* node is holding and when it is congested. `sourceless_rpc_refused_total{reason="rate-limit"}` is an attacker's own feedback channel — a flood that is being refused looks identical to one that is not, from outside, unless the target publishes the counter for them to read. `keys_encrypted_at_rest`, `audit_signed` and `audit_intact` are a map of which node in a fleet is worth attacking. None of that is on the explorer and none of it should be answerable by anyone who can reach a port. 2. **This is not a metrics-only socket.** `/metrics` shares a listener with the operator page, `/api/report` and the signed `/api/ops` routes. A policy that let the socket out on a host where the page must not go would be incoherent the moment anybody read the code. 3. **`--ops-host` was accepting a non-loopback bind with no statement of any kind.** That is the gap Iris closed for the RPC door and this endpoint still had. Adding `/metrics` to a surface with a weaker policy than the door beside it would have been the third policy the audit was right to warn about. ### What you should actually do **Neither of the two flags.** Run the scrape agent **on the node's host**, against `127.0.0.1:8081`, and let the agent push outward. That needs no bind, no certificate and no proxy assertion — and it is the only shape that also answers the dead-process case, because an agent that survives the node is the thing that can report the node's absence. A remote scrape of a socket that has stopped answering cannot distinguish a dead node from a cut cable. The two flags exist for the fleet that has already decided otherwise: ``` --ops-tls-cert FILE --ops-tls-key FILE terminate TLS here, in node:https --ops-behind-tls-proxy assert a terminator stands in front; nothing checks it --ops-name NAME[,NAME] the names it is asked for under, beside 127.0.0.1 and localhost ``` A request under any other `Host` is answered `421`, so a scraper that reaches this port by a name needs `--ops-name`. `GET /health` is exempt. Where TLS ends in this process the certificate decides the name and the list is enforced only when one is given. Neither has a default. A half-supplied certificate pair is refused as the typo it is, rather than falling back to plaintext — falling back is how an endpoint ends up public with an operator who believes it is not. --- ## 3. The supervisor — the half that fixes things `deploy/systemd/strblk-node.service`, generated by `node scripts/pharos.mjs` from the ports and realms in the registries. **REASONED, not measured: there is no systemd on the host this was written on and nothing in `deploy/` has been started by systemd.** What is measured is what the node does when it is signalled; each directive is chosen against one of those measurements. ```bash sudo cp deploy/systemd/strblk-node.service /etc/systemd/system/ sudo cp deploy/systemd/strblk-node.env /etc/sourceless/strblk-node.env # edit it first sudo systemctl daemon-reload && sudo systemctl enable --now strblk-node ``` The four directives that carry the argument: **`Restart=always`, `RestartSec=5`, `StartLimitBurst=5`.** `always` rather than `on-failure`: a node that exits 0 has still stopped being a validator. The burst limiter keeps a node that *cannot* start from becoming a loop that buries its own reason in journal lines — after 5 failures in 10 minutes systemd leaves the unit failed, which the alert rule in §5 sees as absence. **`KillSignal=SIGTERM`, `TimeoutStopSec=300`.** SIGTERM and let it finish. MEASURED: `HestiaNode.stop()` plus `lease.release()` took **3.2–3.8 ms** across three runs on an empty chain, and the lock file was gone afterwards. That is a **floor**, and at Asgard's size it is not the cost: on 2026-11-16 six of the seven asgard-vps genesis seats were still in their shutdown at 90 s and were killed with SIGKILL (OPS-2). Why is not yet measured. 300 s since 2026-11-18, the same as the seat units; size it from the first timed clean stop. A tight `TimeoutStopSec` is a data-loss setting — `docs/RUNBOOK_BACKUP.md` §5 measures why. **`KillMode=control-group`.** This is systemd's default and it is written out anyway, for two reasons. It makes a future change to it a deliberate edit rather than an inherited one. And it is what `docs/RUNBOOK_ROLLBACK.md`'s stop step depends on being true: that runbook's preflight decides *the node is stopped* by the **absence of a lock file**, and a lock file is left behind by exactly one thing — a node process that outlived the stop. MEASURED, and this is why `ExecStart` invokes `node` directly rather than through a shell or `npm`: an orphaned node keeps the Cerberus lease, and the restart is then refused by the lock: ```text DirectoryLockedError: refusing to open