Provision MetalDB — self-hosted Postgres
Stand up a managed Postgres on your own VM with an optional read replica, scheduled backups, and pgAdmin — and have the connection string land in Vault automatically.
What you'll build
- A managed Postgres instance you own, on your node
- Scheduled backups + optional Multi-AZ read replica
- A connection string sealed in Vault, ready to reference from any app
Before you begin
- A registered node with at least 1 GB RAM free
- A database name, user, and a strong password (8+ chars)
- A rough idea of storage and backup retention you need
MetalDB vs. a raw Postgres container
You could run postgres:16 via the Custom Service wizard. MetalDB adds the things you actually want in production: scheduled backups, a managed replica, a credential lifecycle in Vault, and a pgAdmin sidecar — without you wiring any of it.
It’s still your VM
MetalDB runs on the node you own. VxCloud manages the lifecycle; the data and the box are yours.Fill the Postgres form
Go to Databases → Postgres. The name must be alphanumeric with hyphens; the password must be 8+ characters (it’s validated before submit).
MetalDB Postgres — Configure
Enable backups and a read replica
Set backup retention (default 7 days) and tick Multi-AZ to get a standby replica for read scale-out and failover. These map to config.backup_retention_days and config.replicas in the provisioning request.
MetalDB Postgres — High availability
Right-size retention
Backups consume disk on the node. 7–14 days covers most “oops” recoveries; go longer only if compliance requires it.Provision and collect the Vault path
Provisioning posts to POST /api/v1/infrastructure/services/tenant/provision/databases/ and streams status over WebSocket until COMPLETED.
- Reserve resources on node20%
- Initialize Postgres + standby55%
- Configure backups + pgAdmin80%
- Write connection string to Vault100%
The connection string lives at a deterministic Vault path:
$ workspaces/<org>/<workspace>/metaldb/<db_id>/connection_stringReference it, don’t copy it
Apps should consumevault:metaldb/<db>#connection_string as an env var (see the FastAPI tutorial). Copy-pasting the literal into a repo defeats the whole design.Verify and connect with pgAdmin
Production-shaped Postgres
Backed up, optionally replicated, credential in Vault. Wire it into a service via the FastAPI + Postgres walkthrough, then automate releases with CI/CD.Nice work — you're done!
You completed Provision MetalDB — self-hosted Postgres. Keep the momentum going with the next walkthrough, or jump back to the full catalog.