docs: migrate reminder/gateway/crash-watch/migrate prose to docs (#715)

This commit is contained in:
damocles 2026-06-01 10:47:09 +02:00
commit 12a26e6cb0
7 changed files with 75 additions and 123 deletions

View file

@ -1,33 +1,7 @@
//! `/var/lib/hyperhive/agent-ports.json` writer. Port map for
//! per-agent `/agent/<name>/` TCP routing. Written alongside
//! `agents.conf` (see `gateway_nginx.rs`) on every topology change;
//! `gateway_nginx::render` reads it indirectly via
//! `lifecycle::agent_web_port` to populate TCP upstreams for agents
//! that haven't opted in to unix-socket mode yet. Also kept as a
//! human-readable audit file — `cat agent-ports.json` shows every
//! registered sub-agent and its deterministic port assignment.
//!
//! Shape (flat object keyed by logical agent name → web port):
//!
//! ```json
//! {
//! "iris": 8178,
//! "atlas": 8304,
//! "argus": 8267,
//! "damocles": 8549
//! }
//! ```
//!
//! Ports come from [`crate::lifecycle::agent_web_port`] — pure
//! FNV-1a(name) hash so the value is reproducible from the name
//! alone. Manager is excluded from the map: the gateway routes `/`
//! straight to it via the c0re dashboard upstream rather than a
//! per-agent `/agent/<name>/` prefix.
//!
//! Atomicity: write to a sibling `.tmp` file + rename so a partial
//! write never leaves an unparseable file in place. The gateway's
//! `nginx` worker can read mid-write and Just Work because `rename()`
//! is atomic on the same filesystem.
//! `/var/lib/hyperhive/agent-ports.json` writer — flat map of
//! agent name → TCP web port. Written alongside `agents.conf` on
//! every topology change. JSON shape, port derivation (FNV-1a hash),
//! atomicity, and manager exclusion: `docs/gateway.md::Agent port map`.
use std::collections::BTreeMap;
use std::path::PathBuf;