Ancient Holdingsv.Chronos.Talos.16 · d1de0a1e
WebsiteNetworkOperatorBaronAdmin

Documentation / 6. Backups & seeds

Chapter 6

Backups & seeds

Encrypted archives, donor snapshots, restore flow.

Every managed node can take an encrypted archive of its blockchain data directory. The pipeline:

tar → gzip → libsodium secretstream → .ahbk on disk

The content key is sealed with libsodium secretbox using the hub’s master key (held in the vault behind fresh- ancient-confirm). Archives land in ./data/backups/ and can be:

  • Downloaded raw — the encrypted .ahbk, resumable via HTTP Range, decrypted locally with bin/dr-tool.mjs + the exported master key. No hub involvement in the decrypt.
  • Staged as .tar.gz — two-step flow: Prepare decrypts onto a staged plaintext file on the hub; Download streams it like a normal file. Expires after 30 minutes; a discard button cancels the stage.

Seeds — hub-wide donor snapshots

A seed is a completed backup promoted to the hub-wide donor snapshot. New installs and reseeds pull from the current seed instead of syncing the full chain from scratch — saves days on new-node onboarding. Seeds are delete-protected; only an Ancient Admin can retire a seed, and only by promoting a fresher one to take its place.

Managed on /admin/seeds (ancient + modern). Donor-eligibility check runs every ~23 hours; operators of eligible nodes can donate via the Seeds page. Donor contributions are rewarded with +1 Stoicism point per successful donation.

Hub-scores ledger snapshots

Separate from node backups: the hub also takes a nightly dump of its scoring tables (stoicism_accounts, stoicism_daily, stoicism_events) — the full ledger state — encrypted and stored as hub-scores-YYYY-MM-DD.ahbk. These are NOT shown in the main Backups list (operators found the tiny ~5 KB files confusing); they live in data/backups/ for ancient-admin retrieval.

Failed backup rows

Failed rows get a compact inline Delete button next to their error blurb, using the same DELETE /api/admin/backups/[id] endpoint as completed rows. No on-disk file to clean; the DB row just goes away. Double-confirm + password re-auth.

Automatic sweep — the hub backs up the whole fleet

The hub runs a rolling backup sweep: it interrogates the eligiblefleet and pulls a fresh backup, so the hub holds a current restore point for the whole fleet — not just the seed donor. Eligible means backup-capable (a hub-installed docker node whose runner path resolves the backup dir without SSH) and online (a recent, reachable fleet report); foreign-network nodes and container-less parent rows are skipped.

It takes one backup per physical box. StoaChain nodes all converge to the same chain (that’s why one seed bootstraps any new node), so per-node backups are largely redundant — and a box’s co-located slaves share one disk. So a box is covered when any node on it has a fresh backup, and the sweep backs up one representative node per box, rotating which one so it self-heals around an unreachable slave.

The sweep pulls one at a time— a single scheduled backup per tick, only when no backup or seed-refresh is already running, so tar + encrypt never pile up and starve each other. A box becomes due when its newest backup is older than ~24h; a retry backoff keeps a persistently-failing box from starving the rest. It runs only on the leader worker.

The sweep is off by default and armed with the backup_sweep_enabled flag; disarming stops new enqueues while any in-flight backup finishes. Together with keep-1 retention (below), the hub converges on one fresh backup per box.

Retention — one working backup per node

The encrypted .ahbk on the hub is the canonical copy, so a managed node holds zeroraw checkpoints after a backup. The node’s raw checkpoints are pruned at three points — before a run starts, after a successful upload, and after a failed or timed-out run — over both the SSH and agent (Hermes) transports, so a failed run never leaves checkpoints piling on the operator’s drive.

On the hub side, a completed backup supersedesthe node’s older completed archives (keep-latest): the hub holds exactly one working backup per node, briefly two while a fresh one lands. The 14-day expiry timer never deletes a node’s newest completed backup — so a node whose newer backups are failing keeps its last good archive rather than being left with none. Seed archives are never pruned by retention.

A background reaper marks backups wedged in creating (a worker restart mid-encrypt) as failed and deletes their orphaned .ahbk, .ahbk.body and .partfiles, so a crashed build can’t leak disk on the hub.

Pluggable backup destinations (local / S3 / IPFS), rule-based autonomic backup policy engine, and destination-side encryption for S3 are all queued — see roadmap v1.1.x.