interplane.Get Omega
Read in your language

interplane-forge

INTERPLANE Forge

Brought by drakestapleton

branch main Branches Tags History

interplane-forge / infra / RUNBOOK.md

257 lines · 19521 bytes Raw Blame History Source

interplane.io and the forge: operations runbook

Scope: the public site interplane.io (static pages plus forged) and the redirect from www.aienos.com/forge/ (since 2026-11-10), served from the Spark since 2026-11-08. Deploy details live in infra/DEPLOY.md (written for the hub-era edge; the same scripts and rules apply) and the front-door switch in infra/spark/README-edge.md. This file covers running it: where the data is, how to renew, back up, restore, and what to do when a host is down. Hosts: the Spark (ssh spark, LAN 192.168.1.108), the hub Pi (ssh hub, 192.168.1.192), the operator Mac. Router: Calix at https://192.168.1.1.

1. Serving path

client ─TCP 443─▶ router 74.167.68.53 ─port-forward─▶ Spark 192.168.1.108:443
  nginx stream SNI router (infra/spark/nginx/sni-router.conf, PROXY protocol on)
    interplane.io, www.interplane.io ─▶ 127.0.0.1:4448 (ssl, proxy_protocol) → vhost sites-interplane.io
    www.aienos.com, aienos.com       ─▶ the aienos vhosts (`/forge/…` → 301/308 to https://interplane.io/…, DEPLOY.md "www.aienos.com/forge/ redirect")
    hs.aienos.com                    ─▶ raw TCP to the Pi 192.168.1.192:443 (Headscale keeps its own TLS)
  vhost interplane.io: static `/var/www/interplane.io` first (try_files), else forged 127.0.0.1:18480
    /status/uptime/ → alias /var/www/interplane-uptime/ (the probe page, section 6; the location is in forge/home-root)
    /rad/           → 127.0.0.1:8780 → edge-rad-tunnel.service (ssh -L) → the Pi's radicle-httpd
forged: tmux session `forged` (infra/spark/forged-service.sh supervisor), binary ~/work/forge/web/server/forged

2. Where the data lives

datawheresource of truth?backup
forged stateSpark ~/forge-data/social.log (when present) is; archives/, collab/, search/ are derived caches; logs/ is the request log; social.key is the session HMAC keyforge-backup (section 4), without caches, logs and social.key
Radicle storage (86 RIDs)Spark ~/.radicle/storageyes for refs; objects are seeded to iris/rosa.radicle.network for public RIDs [INFERENCE: not verified per RID] and the Pi holds a copy of all but 2 RIDsforge-backup archives every refs/ tree (not objects)
Radicle node/delegate keySpark ~/.radicle/keysyesnone: never copied by any script here; Drake's open item (section 10)
nginx configSpark /etc/nginx (readable parts); Pi /etc/nginxthe Spark copy serves; infra/spark/nginx/ holds the edited filesforge-backup (readable files only; certs/ is root-only and skipped); /etc/nginx.dist-20261108T114650Z
TLS certificatesPi acme.sh (root) → Pi /etc/nginx/certs → Spark /etc/nginx/certsthe Pire-issuable; not backed up
static site/var/www/interplane.io (Spark and Pi)Radicle z399yKv…rebuildable from source
Forgejo (atlas)Spark ~/atlas-forgejo/cipher (gocryptfs), mounted at ~/atlas-forgejo/datayes~/.local/bin/forgejo-backup → ~/atlas-forgejo-backups (section 9)
VaultwardenSpark ~/services/vaultwarden/datayesaien-run-vault-backup + Mac com.aien.vault-backup-pull → Mac ~/Backups/vault-spark/

All backup archives are age-encrypted to the one recipient age1kj2a3s98qgu9nc7nlxd7npj50ekgqh32jfdp6jg9dgn2v6scrccqus5ec6. Its identity lives only on the Mac: ~/.config/atlas-forgejo-backup/recovery.agekey. Losing the Mac and that file loses every backup.

3. Deploy, roll back, renew

4. Backups (forge)

infra/ops/forge-backup.sh writes one archive per change burst: ~/forge-backups/forge-backup-<UTC>.tar.gz.age plus .sha256 and latest.json, keeping the newest 60 (FORGE_BACKUP_KEEP). Contents: forge-data/ (no caches, logs, *.pid, social.key), nginx/ (readable files of /etc/nginx), storage/<RID>/refs/ and MANIFEST.txt. It never reads ~/.radicle/keys and refuses (exit 4) if a secret path would enter the archive. Without a valid FORGE_BACKUP_RECIPIENT it refuses (exit 3) before writing anything. An unchanged content digest writes nothing.

Trigger: infra/ops/aien-run-forge-backup.service, onchange-glob.sh 3600 86400 over ~/forge-data, /etc/nginx, its subdirs, ~/.radicle/storage, each RID dir and every dir under each refs/ (aien-onchange is not recursive, so the glob wrapper expands the dirs and restarts the watcher when the set of dirs changes). At most one run per hour (Radicle refs move on every push; a measured 2026-11-09: 13.6 MB as plain tar, 0.43 MB gzipped, per archive), at least one per day.

Off-host: the Mac pulls ~/forge-backups and ~/atlas-forgejo-backups with infra/ops/mac/forge-backup-pull.sh (launchd com.aien.forge-backup-pull) into ~/Backups/forge-spark/ and ~/Backups/forgejo-spark/, keeping 120 days. It waits on the Spark with inotifywait -e moved_to (each script renames its finished archive into place), at least once a day (PULL_MAX_GAP).

5. Restore

Identity: the Mac's ~/.config/atlas-forgejo-backup/recovery.agekey. Decrypt on the Mac, or copy the identity to the target over ssh into a 0600 file and delete it afterwards.

shasum -a 256 -c forge-backup-<UTC>.tar.gz.age.sha256          # Mac (sha256sum -c on Linux)
infra/ops/forge-backup.sh restore forge-backup-<UTC>.tar.gz.age ~/.config/atlas-forgejo-backup/recovery.agekey /tmp/restore-<UTC>

restore refuses a non-empty target, checks the .sha256 when present, and reports a wrong identity as "decryption FAILED". Then, by hand, after reading MANIFEST.txt:

Drill (dry-run restore into a scratch dir): run infra/test/ops-scratch.sh on the Spark. It makes a throwaway age key, backs up the live sources into a scratch spool, restores into a scratch dir, checks that no social.key, keys/ or objects/ came back, and checks that a wrong key and a non-empty target are refused. For a drill with the real key, do the restore step above on the Mac into $(mktemp -d), read MANIFEST.txt, then delete the dir. Log each drill below.

Drill log:

6. Monitoring: the probe page

infra/ops/ipl-uptime-probe.sh (unit aien-run-ipl-uptime.service, aien-loop 300: reachability has no change signal) GETs /, /explore, /forge/ and two forge pages by the public name every 5 min and reads the served certificate's expiry with openssl. infra/ops/ipl-uptime-render.sh (unit aien-run-ipl-uptime-page.service, aien-onchange on the state dir) renders /var/www/interplane-uptime/index.html, served at https://interplane.io/status/uptime/.

It is an inside view. The Spark resolves the public address and the router hairpins it back to the Spark, so it shows that nginx, forged and the cert work, not that the house is reachable from outside. The page says so and prints no uptime percentage, only counts inside the measured window. The outside check is Drake's open item 11 (UptimeRobot).

Install (Drake or the desk; nothing below has been run):

sudo install -d -o drakestapleton -m 755 /var/www/interplane-uptime
# nginx: deploy infra/spark/nginx/sites-interplane.io from forge/home-root (section 3; routing below)
cp infra/ops/aien-run-ipl-uptime.service infra/ops/aien-run-ipl-uptime-page.service ~/.config/systemd/user/
systemctl --user daemon-reload
systemctl --user enable --now aien-run-ipl-uptime.service aien-run-ipl-uptime-page.service

The units run from the live checkout ~/work/forge/web, so merge first.

Routing: the vhost locations live in the home-root lane, not in this branch (forge/home-root 8ba7444, also forge/home-root-on-iplreach 884d3d1, in infra/spark/nginx/sites-interplane.io and infra/nginx/sites-enabled/interplane.io, with smoke.sh and edge-local.sh checks). There location = /status/uptime (301 to the slash) and location ^~ /status/uptime/ (alias /var/www/interplane-uptime/) are carved out ahead of the /status/ 301 to /protocol/status/: an exact or ^~ prefix match stops nginx from trying the regex locations, so neither that 301 nor forged takes the page, and a missing page is a plain 404. Until forge/home-root is merged and its vhost deployed, /status/uptime/ goes to forged. This branch does not touch the vhost (two copies would fail nginx -t with a duplicate location). infra/test/ops-scratch.sh section 4 tests the vhost of the tree it runs in on a throwaway nginx (root and static folders from disk, other paths to forged, /status/uptime/ to forged while the location is absent); section 4b serves the page through another ref's vhost when IPL_TEST_VHOST_REF=forge/home-root is set, and is NOT_RUN otherwise.

7. Clock timers and their replacements (RULE-no-cron)

timerreplacement in this repostatus
atlas-forgejo-backup.timer (nightly)infra/spark/aien-run-forgejo-backup.service: onchange-glob 21600 86400 on the Forgejo refs dirs, ExecCondition=mountpoint -q ~/atlas-forgejo/datawritten, not installed. Install only after Forgejo is back (section 9), then systemctl --user disable --now atlas-forgejo-backup.timer
edge-mirror.timer (every 5 min)infra/spark/edge-mirror-onchange.service: aien-onchange 60 86400 on ~/.local/share/interplane-site (published.cksum and sync.log, written by sync-to-hub.sh on every interplane.io publish)partial: covers interplane.io only. The other folders (aienos.com, aienos-code, aienos-hive, aienos-stats, replicate, si) have no change signal on the Spark, so the timer stays until their publishers write to the Spark directly (README-edge "Next"). Both may run: edge-mirror.sh now takes a lock and waits
edge-certs.timer (daily)nonetimer stays. The certs change on the Pi, which has no inotify-tools, and acme.sh runs from root's crontab there; no signal crosses to the Spark. Options for Drake: an acme.sh --reloadcmd on the Pi that touches a file the Spark watches over ssh, or apt install inotify-tools on the Pi

Live timers were not disabled by this work.

8. When something is down

Start with bash infra/smoke.sh (public) and bash infra/smoke.sh local (forged direct): exit 2 = a site page failed, exit 1 = only forge routes failed.

9. Forgejo (atlas) outage, since 2026-11-08

Evidence and root cause: infra/spark/forgejo/EVIDENCE-20261109.txt. Short form: the Forgejo and gocryptfs binaries were deleted with the archived setup dir on 2026-11-08; the nightly backup stopped Forgejo, which then could not restart; the storage unit restart-loops on 203/EXEC. The encrypted data (~/atlas-forgejo/cipher) and the Nov 6 and Nov 7 backups are intact.

Decision for Drake: restore or retire.

Restore (needs root for the last step):

bash infra/spark/forgejo/forgejo-runtime-restore.sh --dry-run        # verifies sha, signature, versions into a scratch dir
bash infra/spark/forgejo/forgejo-runtime-restore.sh --apply          # stages ~/.local/opt/atlas-forgejo-runtime-20260904, repoints the symlink
install -m 755 infra/spark/forgejo/forgejo-backup ~/.local/bin/forgejo-backup    # the patched script (see forgejo-backup.patch)
~/.local/bin/forgejo-backup --dry-run                                # must print "ok" for both binaries
sudo systemctl reset-failed atlas-forgejo-storage.service atlas-forgejo.service
sudo systemctl start atlas-forgejo-storage.service atlas-forgejo.service
curl -sk https://127.0.0.1:3443/api/healthz
# on the Mac, after the pull: forgejo-backup verify <archive> ~/.config/atlas-forgejo-backup/recovery.agekey

Roll back the runtime: ln -sfn "$(cat ~/.local/opt/atlas-forgejo-runtime-20260904/previous-symlink-target)" ~/atlas-forgejo-setup-20260904. Roll back the script: patch -R ~/.local/bin/forgejo-backup infra/spark/forgejo/forgejo-backup.patch. After it runs: install infra/spark/aien-run-forgejo-backup.service and disable the timer (section 7).

Retire: sudo systemctl disable --now atlas-forgejo-storage.service atlas-forgejo.service, systemctl --user disable --now atlas-forgejo-backup.timer, keep ~/atlas-forgejo/cipher and the last two archives (both also pulled to the Mac once the pull is installed) until Drake says otherwise.

10. Drake's open items (ops proposal parts b and c)

Install (part a, written here, nothing enabled):

  1. /var/www/interplane-uptime, the nginx vhost from forge/home-root and the two probe units (section 6).
  2. cp infra/ops/aien-run-forge-backup.service ~/.config/systemd/user/ && systemctl --user daemon-reload && systemctl --user enable --now aien-run-forge-backup.service.
  3. Mac: cp infra/ops/mac/forge-backup-pull.sh ~/.local/bin/ && cp infra/ops/mac/com.aien.forge-backup-pull.plist ~/Library/LaunchAgents/ && launchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/com.aien.forge-backup-pull.plist.
  4. edge-mirror-onchange.service (section 7) and the Forgejo decision (section 9).
  5. Radicle delegate key: decide whether ~/.radicle/keys gets an encrypted off-host copy. Today it has none, and this work does not copy it.

At Gandi (Drake; the acme.sh token on the Pi is not authorized for these):

  1. Mail: a mailbox, or a forward of hello@ and security@ to an existing address.
  2. SPF: ?all → ~all, then -all once mail is confirmed; or v=spf1 -all and no MX if no mail.
  3. DMARC: _dmarc TXT "v=DMARC1; p=none; rua=mailto:<addr from 6>", p=quarantine after 2 clean weeks.
  4. CAA: 0 issue "letsencrypt.org" and 0 iodef "mailto:security@interplane.io".
  5. Registrar: auto-renew, transfer lock, 2FA, the domain expiry date. Record here who holds the Gandi login and where the 2FA device is.

Outside check:

  1. UptimeRobot free plan (no card): HTTPS keyword monitors for https://interplane.io/ and /forge/ (https://www.aienos.com/forge/ only redirects to interplane.io since 2026-11-10; a monitor on it should expect 301), alerts to the address from item 6. Without an account: manual check-host.net runs only. Inside probes do not count as outside.

Router (Drake, Calix): reserve 192.168.1.108 for the Spark (MAC 4c:bb:47:2b:b8:7b) and, when the :80→301 change is merged, forward TCP 80 to .108. Record the router admin login location here.

Alerts: none exist. Until items 6 and 11 are done, a failure is seen only on the probe page, the journal (journalctl --user -u <unit>), and the BOARD.