Repository navigation
dbbackup: discover every database on every server over ssh - #64
Merged
Merged
Conversation
`diskpush dbbackup discover [SERVER...] [--save]` looks on each saved connection and ~/.ssh/config host with one read-only probe per server and finds Postgres/Supabase/MySQL in Docker or native, SQLite files, and the app env files that use them. --save keeps them; running it again adds only what is new and names saved ones a reachable server no longer has. Databases can now live on a server: the dump runs there (docker exec pg_dump / mysqldump, sudo -u postgres pg_dump, sqlite3 .backup + quick_check) and only the bytes come back over `ssh -o BatchMode=yes`, through the same gzip + completion-line check. No database port opened, no password copied, no local pg_dump needed. - plugin-api: optional, additive BaseContext.servers (ServerRef list, known_hosts files, ssh_config path); wired in the CLI and desktop hosts - ssh-core: toServerRef() - git forges and duplicate logins are skipped; aliases that reach the same machine (/etc/machine-id) are listed once - desktop task "Find databases on every server"; setting sqliteRoots - docs/plugins.md, README Live-tested read-only against the fleet (370 -> ~180 real databases after noise filters on 7 of 8 servers) and end to end on dev2: a Supabase stack, a shared-cluster app database, a plain Postgres container and a SQLite volume backed up over ssh and verified. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Vienna tenant homes held .retired/ app copies and backups/ full of dated copies; the live fleet count drops from 175 to 142 real databases. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
diskpush dbbackup discover [SERVER...] [--save]finds every database on every server DiskPush already knows (saved connections +~/.ssh/confighosts, i.e.diskpush fleet servers), over the ssh keys/agent already in use, and--savekeeps them for backup. A saved database can now live on a server: its dump runs there and only the bytes come back over ssh.docker psimage match, thenpsqlinside the container (POSTGRES_USER / postgres / supabase_admin, socket or 127.0.0.1)docker exec <c> pg_dump …mysql -urootinside with the container's own root passworddocker exec <c> mysqldump …postgresOS usersudo -n -u postgres pg_dump -p <port>mysqldumpas rootsqliteRoots), skipping deps/caches/checkouts/worktrees/hidden/backups/tmp/opencodesqlite3 .backup+quick_checkon the server, file streamed backNo database port opened, no database password copied, no local
pg_dumpneeded. The existing gzip + completion-line rule still applies, so a dump cut short is discarded.Pieces
BaseContext.servers(ServerReflist,knownHostsFiles,sshConfigFile). No API version bump; wired in the CLI (serverDirectory) and desktop hosts.toServerRef().discover.ts(probe, parser, naming, reconcile, save),remote.ts(ssh argv withBatchMode=yes, remote dump commands, run-as whitelist),DatabaseConfig.server/via/container/database/dbUser/dbHost/port/runAs, desktop task Find databases on every server,sshindoctor.user@host:portaliases are skipped; aliases reaching the same machine (/etc/machine-id) are listed once under the one with most access. Unknown host keys fail unless--accept-new.Tests
umask 022),pnpm -r typecheckclean, ThreatCrush plugin gate passes (only LOW masked fixture URLs in tests).discover.test.ts: probe parser, owners from env files, naming, reconcile and idempotent save, server picking and same-machine merge, ssh argv, remote dump commands, run-as refusal; the real probe script run against a fakedockerand a temp SQLite tree; and discover, save, back up and verify through a fakessh, including a truncated dump and a SQLite round trip with restore.Live
discoveracross the real fleet: 142 databases on 7 of 8 servers (dev2: 65 Supabase incl. the sharedsupabase-dbcluster's per-app DBs, 3 Postgres, 24 SQLite; vienna 46 SQLite; bbs-root 4). 77 git aliases skipped;seed3/seed2correctly merged into dev2/vienna;bbs1(:22 is the BBS) reported as no shell.discover --save, thenrunbacked up a Supabase stack, a shared-cluster app DB, a Postgres container and a SQLite volume over ssh; allverify, and the SQLite copy passesintegrity_check.🤖 Generated with Claude Code