agentleFS
bkraad47bkraad47/ramen/skills/backup-restore/SKILL.md

backup-restore

Skill4 starsChanged 27 days agoBSD-3-ClauseView on GitHub

Take a versioned JSON backup of Ramen console state (zones, users, groups, environments, workers, config) to a local path or the groups bucket, verify it, and restore it after a bad change or into a new console. Use before risky operations and for disaster recovery.

2 other projects use a version of this.

Adopted by

Most recently taken up by

  • Other versions2 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 2

    1. davekilleen/Dex★ 509same name
    2. Seeed-Projects/Seeed-Jetson-DevelopTool★ 57same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository7 other files it gives its agents.

The file

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 1 is distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Check the file: valid JSON, release_version matches curl -sk $CONSOLE/readyz | jq .version, contains zones, users, groups, environments, …

    line 15
  2. Distinctive:

    Never try to extract secret values or hashes from the store to "complete" a backup.

    line 49
  3. Very specific:

    If the backup's release_version is newer than the console's, stop and ask.

    line 50
  4. Very specific:

    Never pass prune without showing the human the dry_run extra list first — it deletes groups, zones, environments, workers and users.

    line 51

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Backup and restore

Console state lives in Firestore/DynamoDB; backups are JSON exports tagged with the release version (docs/CONTRACTS.md §4a, F7.2). They exclude secret values and password hashes. Group code is in git + the bucket and needs no backup. Super-admin rmn_ key required: H='X-Ramen-Api-Key: $RMN', U=$RAMEN_CONSOLE_URL/api/v1.

Backup

  1. curl -sk -H "$H" -H 'Content-Type: application/json' -X POST $U/backups -d '{"target":"bucket"}' ("local" writes under RAMEN_BACKUP_ROOT on the console pod/container — only useful locally). → 201 {id, release_version}.
  2. Download a copy: curl -sk -H "$H" $U/backups/<id>/download -o ramen-backup-<release>-<date>.json; store it where the team keeps recovery material (not in the repo).
  3. Check the file: valid JSON, release_version matches curl -sk $CONSOLE/readyz | jq .version, contains zones, users, groups, environments, and grep -c 'rmk_\|rmn_\|password' file is 0.
  4. Note the id in the change ticket.

Restore

Flags (all default false, CONTRACTS §13.1): dry_run plans without writing, prune deletes what the backup does not contain, reconcile re-applies the restored zones, force accepts a backup from a newer release.

  1. Confirm the target console runs the same or newer release than release_version. A newer backup is refused with 409; force:true is a human decision, not a default.
  2. Back up the current state first (step Backup) and quote both ids in the ticket.
  3. Plan it: curl -sk -H "$H" -H 'Content-Type: application/json' -X POST $U/backups/<id>/restore -d '{"dry_run":true}' → {restored:{col:{created,updated,unchanged}}, extra, warnings}. Read extra before considering prune: those are the rows a prune would delete.
  4. Restore: … -d '{"reconcile":true}' (merge and re-apply the zones), or … -d '{"prune":true,"reconcile":true}' when the intent is "make it look exactly like the backup". config is never pruned and the key or account running the restore is never deleted — the response says so in warnings.
  5. Everyone else is signed out (every restored user's session epoch is bumped); the caller keeps their session. Users the store had lost come back login_disabled: re-invite them or POST $U/users/<id>/password. The bootstrap super admin is re-applied from env on the next console start.
  6. orphans in the response lists namespaces the cloud still runs that the backup never knew about. Nothing deletes them for you: check each one, then DELETE $U/groups/<g> if it should not exist.
  7. Re-add secret values (if RAMEN_SECRETS_BACKEND=store), generate rmn_ keys again, and deploy every environment that changed. To restore into a different console, upload the JSON to <bucket>/_backups/ under the same name first (or copy it into RAMEN_BACKUP_ROOT with target:"local").

Validate

(read-only sub-agent; viewer or super-admin rmn_ key; the backup file path)

  • V1 Backup file parses as JSON, has keys release_version, zones, users, groups, environments; no string starts with rmk_/rmn_; no password_hash/value fields.
  • V2 GET $U/audit contains backup.create (and backup.restore after a restore) with ok:true.
  • V3 After restore: GET $U/groups lists every group in the file; GET $U/zones every zone; GET $U/groups/<g>/environments every environment with the same zones lists.
  • V4 After restore + deploy: GET $U/groups/<g>/zones/<z>/workers → ≥1 live worker; one tools/list through the LB with a fresh rmk_ key → 200.
  • V5 A dry_run restore of the same backup now reports created: 0 for every collection, and extra holds only what was deliberately created after it.

Boundaries

  • Restore only on explicit request; it overwrites current state. Take a backup of the current state first (step Backup) and quote both ids.
  • Never try to extract secret values or hashes from the store to "complete" a backup.
  • If the backup's release_version is newer than the console's, stop and ask; never pass force on your own.
  • Never pass prune without showing the human the dry_run extra list first — it deletes groups, zones, environments, workers and users.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.