Cross-site snapshot copy verb
One verb form for the three-step, two-host flow that copies data between a production instance on another site and dev. Today (docs/deployment.md → Production Backups → Example) that is: ssh to the site, snapshot or list there, assemble an scp for the triple into /data/data-ui/snapshots/ on evo-x2, then scripts/data-ui snapshot restore <name> dev:<model>. The goal is only to remove the ssh, the listing and the hand-assembled scp; the restore stays a hand-run step.
The grammar
A site prefix — <site>: — qualifies a snapshot name. It never qualifies an address. A colon is illegal in a snapshot name, so the in-pool copy <src-name> <dst-name> [<model>] and the transfer cannot be confused.
scripts/data-ui snapshot list prod-2: # a site's whole pool
scripts/data-ui snapshot save prod-2:prd-backlog-keep-1 prd:backlog # snapshot on the spot
scripts/data-ui snapshot copy prod-2:prd-backlog-keep-1 prd-backlog-keep-1
scripts/data-ui snapshot restore prd-backlog-keep-1 dev:backlog # unchanged, hand-run
list [<site>:]— no prefix lists the local pool (today's behavior);<site>:with an empty name lists that site's pool, the scp convention.save <name> <src-address>— the name may carry a site prefix. The address is never prefixed and is resolved on the site that owns the pool:save prod-2:x prd:backlogruns the save on prod-2, soprd:backlogresolves where its namespace lives. The address grammar (dev:/stg:/prd:) is untouched.copy <src> <dst> [<model>]— either operand may carry a site prefix; an unprefixed operand is this site's pool. Same-site on both sides stays the existing in-pool rename.- No prefix means local, so
copy prod-2:keep-1 keep-1is a pull andcopy keep-1 prod-2:keep-1is a push. dropwith a site prefix and a site-prefixedrestoreare out of scope (a restore's name is already local to the address's site).
Behavior
- Pure copy. No restore, ever; the verb moves the triple and prints the restore line. The same shape
<app>-backup recoveralready prints. - No fresh save.
copymoves an existing snapshot; taking one issave's job, now reachable across sites. - Whole triple:
.dump,.files.tar.gzwhen present,.meta. A DB-only source lands DB-only. - Transport: scp plus a size and sha256 check per file, the pattern the deploy forwarder already uses for
MODEL_FILE. Stage to temp names on the destination and move onto the slot names only when every file verified; a failed transfer leaves nothing behind. - Existing destination refused unless
FORCE=1, as the in-pool copy does. - Provenance. The landed
.metagainscopied-from-site=<site>andcopied-from=<src>, mirroring today'scopied-fromkey; the<model>retarget keeps itscopied-model-from. - Site resolution needs no map. The site name is the ssh Host alias — deploys already depend on it, since
DEPLOY_HOST=prod-2is run literally asssh prod-2. Each site knows its own name from the marker/data/data-ui/site(local_siteinscripts/lib/checkout.sh). The verb reads the remote's marker back over ssh and requires it to equal the typed name, so a stale alias can never copy to the wrong site. Adding a site is one ssh alias plus its marker, both of which deploys need anyway. - Remote execution: ssh to the site and run its production clone's
scripts/data-ui, the forwarder's launcher rule.
The site rule
A production-only site (SITE_PRODUCTION_ONLY) exchanges pools only with other production-only sites:
- on prod-2, any operand naming
evo-x2is refused; other production sites are allowed; - from evo-x2, both directions with prod-2 work;
- the move runbook's prod-2-pulls-evo-x2 data stays on the S3
recoverpath.
This is the existing flag applied at the existing boundary (production_only_refuses in scripts/data-ui), not a new concept.
Also in this plan
Fix the ~/.ssh/config accumulation. publish-eip in ops/prod-2-aws.sh appends a Host prod-2 stanza on every run, and the evo-x2 file currently holds three identical ones. ssh honors the first stanza, so after an address change a newer one would be silently ignored. publish-eip must replace the stanza instead of appending, and the existing duplicates must be cleaned up.
Docs: docs/cli.md (the snapshot section), docs/snapshots.md, docs/deployment.md (the Production Backups example), and the script's help text.
Follow-up
rsync instead of scp is a separate item filed right after this one: SceneBook's photos tar can be gigabytes and scp re-sends it whole on every copy. Out of time for now.
Related
- "Site argument on backup restore/recover verbs" (slot 7650) and "Swank tunnel verbs" (slot 7475) share the site-as-ssh-alias convention; keep the spellings consistent.
- Slot
- 7276
- Status
- 10 Open
- Tags
- scripts, ops, prod, mvp
- Contributors
- Donnie, Sofia