Skip to content

Docker Compose

Tested with: Docker Compose v2.29 · Docker Engine 27 · PostgreSQL 17

Replace the db service with environment that points at Databasezy. Keep a local engine for tests with a Compose profile so the same file works offline.

compose.yaml
services:
api:
build: .
env_file: .env.databasezy # DATABASE_URL etc.; git-ignored
secrets:
- databasezy_ca
environment:
PGSSLMODE: verify-full
PGSSLROOTCERT: /run/secrets/databasezy_ca
ports: ["3000:3000"]
# Local engine for offline work and tests: `docker compose --profile local up`
db:
image: postgres:17
profiles: ["local"]
environment:
POSTGRES_USER: app
POSTGRES_PASSWORD: app
POSTGRES_DB: app
ports: ["5432:5432"]
secrets:
databasezy_ca:
file: ./databasezy-ca.pem # from `zb api GET /v1/orgs/{org}/ca.pem`
.env.databasezy (git-ignored)
DATABASE_URL=postgresql://app:<password>@pg-7f3k.us-east.databasezy.com:5432/app?sslmode=verify-full&sslrootcert=/run/secrets/databasezy_ca

Allow your machine’s public IP under Network → Allow-list in the portal.

docker compose run --rm api npx prisma migrate deploy runs them with the same environment.