VxCloud
🐘Intermediate15 minDatabases

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
1

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.
2

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).

app.prodxcloud.com/dashboard/development

MetalDB Postgres — Configure

1
2
orders-prod
orders_app
••••••••••••
db.t3.micro▾
14.9▾
50
5432
db.t3.micro suits dev; bump instance class and storage for production.
3

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.

app.prodxcloud.com/dashboard/development

MetalDB Postgres — High availability

1
2
14
Enabled▾
Multi-AZ adds a hot standby; backups are point-in-time within the retention window.

Right-size retention

Backups consume disk on the node. 7–14 days covers most “oops” recoveries; go longer only if compliance requires it.
4

Provision and collect the Vault path

Provisioning posts to POST /api/v1/infrastructure/services/tenant/provision/databases/ and streams status over WebSocket until COMPLETED.

Deployment progress100%
  • Reserve resources on node20%
  • Initialize Postgres + standby55%
  • Configure backups + pgAdmin80%
  • Write connection string to Vault100%
The final step seals the credential — you never see the password in plaintext.

The connection string lives at a deterministic Vault path:

vault path
$ workspaces/<org>/<workspace>/metaldb/<db_id>/connection_string

Reference it, don’t copy it

Apps should consume vault:metaldb/<db>#connection_string as an env var (see the FastAPI tutorial). Copy-pasting the literal into a repo defeats the whole design.
5

Verify and connect with pgAdmin

psql
$ psql "$(vault read -field=connection_string …/orders-prod)"
psql (14.9) — SSL on
$ orders-prod=> SELECT 1;
?column? ---------- 1
Primary reachable; replica streaming
pgAdmin is available as a sidecar on port 5050 for a UI.

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.