Managed Postgres

A managed PostgreSQL database, provisioned in one command and wired into your services by reference.

Provision

lizard add postgres

The first Postgres addon is named postgres, so ${{postgres.DATABASE_URL}} works immediately.

Environment variables

The addon exposes a standard set of connection variables:

VariableDescription
DATABASE_URLFull connection string (postgres://…)
PGHOSTHost
PGPORTPort
PGUSERUser
PGPASSWORDPassword
PGDATABASEDatabase name
POSTGRES_USERAlias for the user
POSTGRES_DBAlias for the database
POSTGRES_PASSWORDAlias for the password

Connect a service

Reference the connection string from the consumer service and redeploy:

lizard secrets set DATABASE_URL='${{postgres.DATABASE_URL}}' --service api
lizard redeploy --service api

The reference resolves at deploy time and rotates automatically if the addon’s credentials change — every consumer picks up the new value on its next deploy.

Verify connectivity without printing the connection string:

lizard run --service api -- sh -c 'psql "$DATABASE_URL" -c "SELECT 1"'

Run migrations on deploy

Use a pre-deploy command for migrations. Make migrations safe to retry and compatible with both the old and new application version:

lizard service set api --set preDeployCommand="npm run migrate"
lizard redeploy --service api

For a Django app the command is python manage.py migrate; Python app hosting has the equivalent for Flask and FastAPI.

Browse and query data

Open the Postgres editor in the dashboard (lizard open) to run SQL and browse tables directly. For ad-hoc local work, run a command with the service’s injected environment:

lizard run --service api -- sh -c 'exec psql "$DATABASE_URL"'

Grow storage

Data volumes are grow-only:

lizard scale --service postgres --storage 8192

Multiple databases

Adding a second Postgres gives it a generated name (e.g. postgres-autumn-bear). Reference it explicitly:

lizard add postgres
lizard secrets set ANALYTICS_URL='${{postgres-autumn-bear.DATABASE_URL}}' --service api

See also

See storage and recovery for backup and restore planning. Local lizard run requires psql and a reachable database endpoint; it does not run inside the deployed service.

Updated