The sibling product was renamed on 2026-09-14. Every reference follows:
service and route paths (src/services/loki, /api/integrations/loki),
env keys (LOKI_*), the build-intent audience and timeline source ('loki'),
ecosystem config, docs, tests, and 13 file names.
Tool labels keep "Loki" capitalised: the old name had an internal capital
and passed the "looks like a name" shape test for free; a one-word name
needs listing, so softLower now carries a small PROPER_NOUNS set.
Box and data were moved ahead of this: LOKI_* keys sit beside the old ones
in the app env, the OAuth client is `loki` with the new callback host, and
timeline/metadata rows carrying the old name were rewritten.
Claude-Session: https://claude.ai/code/session_016YJVAanfj8keVSXyZnTemh
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
5.3 KiB
OrangeCat resilience runbook
Purpose: proactive resilience for the single-box self-host — the gaps the 2026-07-07
DevOps audit flagged that need box-side action. Complements the recovery-side docs
(DISASTER_RECOVERY.md, RESTORE_DRILL.md):
those cover restoring after loss; this covers reducing the blast radius and the manual
recovery time up front.
Box: bitbaum — root@167.233.22.31. OrangeCat lives at /opt/orangecat/app, runs as
systemd orangecat-app behind Caddy, DB in the supabase-db Docker container.
1. Single-box SPOF → scripted bring-up + published RTO
Today a full box loss means manually provisioning a new Hetzner box before the (fast) data restore can run — the RTO is dominated by that manual setup, not the restore.
Reduce it: keep the box's OrangeCat footprint reproducible so step 1 of DR is a script, not archaeology. The OC-specific pieces are now version-controlled:
- App systemd unit →
scripts/systemd/orangecat-app.service - App launcher →
scripts/systemd/launch.sh
Fresh-box OrangeCat bring-up (after Docker + Supabase stack + Caddy exist):
- Restore the DB (see
DISASTER_RECOVERY.md). - Create the app dir and drop in the runtime env:
ssh root@<newbox> 'mkdir -p /opt/orangecat/app' scp /path/to/orangecat-app.env root@<newbox>:/opt/orangecat/app/.env # from the config backup - Install the unit + launcher and deploy the app:
scp scripts/systemd/orangecat-app.service root@<newbox>:/etc/systemd/system/ ssh root@<newbox> 'systemctl daemon-reload' OC_BOX=root@<newbox> bash scripts/deploy-selfhost.sh # builds off-box + swaps in - Add the Caddy vhost for
orangecat.ch(the deploy re-asserts the HTTP/3 guards). curl https://orangecat.ch/api/health→ expect"status":"healthy".
Publish the measured RTO in
DISASTER_RECOVERY.mdafter the next drill so it's a known number, not a surprise. Consider a cheap warm-standby VM restoring the nightly B2 snapshot if the RTO target drops below the manual-provision time.
Full box IaC (cloud-init/Ansible for Docker + Supabase + Caddy) belongs in the shared
loki/scripts/hetzner/ toolkit — coordinate there rather than forking box-wide
provisioning into this repo.
2. Off-site backups are deletable → B2 Object-Lock
pg-backup.sh pushes encrypted restic snapshots to Backblaze B2 nightly, but the box holds
the B2 key, so a box compromise (or a buggy restic forget) could delete the only off-site
copy. Make the bucket append-only from the box's perspective.
- In the B2 console, enable Object Lock on the backup bucket (must be set at/near bucket
creation for some plans — if the current bucket can't enable it, create a new locked
bucket and re-point
restic.env). - Issue a restricted application key for the box that can write + read but not delete
(uncheck
deleteFiles); put it in/opt/backups/restic.env. - Run retention (
restic forget --keep-daily 14 --keep-weekly 8 --keep-monthly 12 --prune) from a separate trusted host with a delete-capable key on a schedule — never from the box. - Keep ≥2 copies of
RESTIC_PASSWORD(password manager + one offline). Losing it makes every snapshot unrecoverable.
3. Deploy credential is root → non-root oc-deploy user
CD SSHes in as root. Scope it down so a leaked deploy key can't own the box.
- Create the user and app ownership (app already runs as
ubuntu):ssh root@167.233.22.31 'useradd -m -s /bin/bash oc-deploy && \ install -d -o oc-deploy -g oc-deploy -m 700 /home/oc-deploy/.ssh' - Add the deploy public key to
/home/oc-deploy/.ssh/authorized_keys. - Grant only the specific privileged commands the deploy needs via a sudoers drop-in
(
/etc/sudoers.d/oc-deploy):systemctl restart orangecat-app, themv/chownin the swap, and thedocker exec supabase-db psqlused byapply-migrations.sh. Validate withvisudo -c. - Point CD at it: set the repo variable
OC_BOX=oc-deploy@167.233.22.31and rotateSELFHOST_SSH_KEYto the new key. Update thedeploy-selfhost.shsudo/chownsteps if any assumed root. - Rotate the deploy key on a schedule.
4. Backup pipeline dependency (know what you depend on)
pg-backup.sh + pg-backup.timer are installed by the loki Hetzner toolkit
(scripts/hetzner/install-backups.sh), not this repo — so OC's durability is governed by
code OC doesn't version-control. Two must-holds, verified at each drill:
- The dump covers the
supabase-dbcontainer DB (docker exec supabase-db pg_dump), not just the box-system Postgres — OrangeCat's data lives in the container. (This was the original "zero backups" bug; the fix must stay in loki'sinstall-backups.shor it reverts on reinstall.) - Backup freshness is now monitored:
/api/healthreportslast_backup_age_hoursand.github/workflows/uptime.ymlopens abackup-staleissue past 26h. Confirm the app user can read/opt/backups/pg(it currently reports a real age, so it can).
Last updated: 2026-07-07 (DevOps overhaul). Owner actions above are box-side; the repo holds the SSOT artifacts and this runbook.