Connections can also be managed from the interactive TUI (just run
capsule
with no arguments). Use the connection subcommands when you want to script
or automate setup — e.g. provisioning a new server with Ansible, cloud-init,
or a Docker entrypoint.Subcommands
capsule connection add
Flags
Postgres / MySQL example
MongoDB example
--uri isn’t passed, you’ll be prompted for the full connection string with input hidden (it contains embedded credentials):
Server migration safety check
The dashboard identifies a connection by its host, port, and database — not its label. So if you migrate a database to a new server and re-add it there with the same label you used before,add won’t know to update the old entry; it’ll otherwise create a second, orphaned-looking connection with a duplicate label pointing at the old, now-decommissioned server.
To catch this, add checks the dashboard for an existing connection with the same label under a different host/port/database before proceeding:
--force to proceed anyway. If not, the safer fix is usually to remove the stale connection (from the old server if it’s still reachable, or via the dashboard if it’s already gone) before adding the new one — see Migrating to a new server below.
capsule connection list
Flags
Once you’re past the first page, the command prints the exact command to run for the next one. Requesting a page beyond the last one is an error, not an empty list — so a script checking the exit code can reliably tell “no more pages” from “something’s wrong.”
capsule connection update
remove + add when credentials rotate or a host changes, since remove deletes the associated schedule too.
Flags
Only the flags you pass are changed — everything else is left as-is. At least one field (or a password/URI rotation) must be given, or the command errors out.
Rotating a password
CAPSULE_CONN_PASSWORD (or CAPSULE_CONN_URI for mongo) instead of passing --rotate-password — if either is set, the update applies it without any prompt:
Changing a host
capsule connection remove
capsule schedule for details on how that works.
Migrating to a new server
Moving a database to a new server involves two independent pieces of state: the dashboard’s connection record (identified by host/port/database, not label) and each server’s local config (connections.json, schedules) — neither carries over automatically.
Recommended order:
add never has anything to collide with, and you skip the safety-check error entirely. If the old server is already gone before you could run remove there, the orphaned entry needs to be deleted manually from the dashboard’s Connections page instead — then add the new one as above.
Notes
- Connections are stored locally in
~/.local/share/capsule/connections.json, encrypted at rest - Every successful
add,update, andremovesyncs to your dashboard automatically; a sync failure (e.g. offline) is logged as a warning but doesn’t block the local change - Plan connection limits: Hobbyist = 1, Solo = 3, Pro = 6
- Hobbyist and Solo plans are restricted to local databases — a host of
localhost,127.0.0.1,::1,0.0.0.0, or a Unix socket path. Pointing--hostat anything else (e.g. a separate database server, a managed RDS instance) on those plans fails withremote connections require the Pro plan or higher. This matters most for the common “app server and database on separate machines” setup — that needs Pro or Team, even if you’re otherwise within your connection-count limit.
See also
capsule schedule— schedule automatic backups for a connection you’ve addedcapsule doctor— verify the required database client tools are installed before adding a connection