# Managed database backups A capture profile maps one application and Wormhole orbit to a paired outpost. The hub stores the assignment, format, schedule, and retention policy. The agent reads connection settings and password references from its local profile file. Each application has one active capture lease. An agent can serve several applications in parallel. ## Pair an agent Build the hub, CLI and agent with `cargo build --workspace`. Put Restic on the hub and the database client for the source server version on the agent. SSH profiles also use OpenSSH on the agent. MySQL remote capture runs the server-compatible `mysqldump` on the SSH host. Generate a pairing code in **Outposts** or call `POST /api/v1/wormhole/pairing` with operator credentials. On the agent, create the credential file once. ```sh tessera-agent --hub-url https://backup.example.org --credentials /etc/tessera/wormhole.json pair CODE --name database-outpost tessera-agent --credentials /etc/tessera/wormhole.json --capture-profiles /etc/tessera/capture.json run ``` Always pass `--credentials`: only then is the upload token written to the file and kept out of the terminal. Without it, `pair` prints `TESSERA_UPLOAD_TOKEN=…` to stdout, where shell history, logs and CI output can capture it. The file must not exist yet, and its directory must be writable by the account that runs `pair` (for a service account, use its home directory rather than a root-owned `/etc` path, or create the file as root and `chown` it to the service account with mode 0600 before `run`). The credentials file is owner-only and contains the hub URL, outpost UUID and upload token. Keep it outside the repository. TLS uses the system trust store. Set `TESSERA_WORMHOLE_CA` for a private CA and configure both `TESSERA_WORMHOLE_CLIENT_CERT` and `TESSERA_WORMHOLE_CLIENT_KEY` for a hub that requires mTLS. Plain HTTP capture is available on loopback for local testing. ## Register an application In **Orbits**, choose **Database** or **Filesystem / Folder**, then **Via Outpost**. Save the orbit and register its Outpost backup profile. Pick the paired Outpost, application UUID, and optional daily UTC schedule. Database profiles also need an engine. For **Via Hub**, give the hub a readable folder path or a reachable PostgreSQL/MySQL endpoint and an absolute password-file path. Mount these files into the container when applicable. TLS verifies the server identity by default. Provide a CA file for a private CA. The hub needs a matching database client on its PATH. The bundled hub image includes `pg_dump` and `mysqldump`. Use a compatible client for the source server version. For CLI setup, create an orbit using `tessera orbit billing --provider wormhole` and save its returned UUID. Use the UUID of the paired outpost shown in **Outposts**. Choose a stable application UUID and submit the following object to `POST /api/v1/capture-profiles` using the hub's admin API token or authenticated operator session. ```json { "application_id": "e1656c14-0d87-4572-a548-b66cc283e61f", "orbit_id": "393e5c00-65b8-4084-a521-099732948a6c", "outpost_id": "c7072265-89ab-493a-8dbe-948c1e9aa24c", "format": "postgres_custom", "schedule": { "hour": 2, "timezone": "Asia/Jakarta" } } ``` To change a profile's schedule or retention later, send `PUT /api/v1/capture-profiles/{application_id}` with an administrator credential and only the fields to change: an absent field stays, `null` clears it. The format, orbit and Outpost are part of the profile's identity and are refused. Validation matches registration. Changing the schedule moves the schedule cursor to the time of the change, so a slot that has already passed under the new schedule is not run late: the first job comes from the next slot. The change is audited as `capture.profile_updated`. Downloads are named `_