Files
loki/infra/postgres-host/docker-compose.yml
T
g-butandCursor ec6f423b0f feat(infra): Postgres portability, Oracle cutover scripts, and DB kill-switch essay
Vendor-neutral DATABASE_URL helpers, dump/restore/sync tooling, and one-command
Oracle migration after a single console VM step. Publishes the studio-stack
thoughts article and hardens build (dynamic layout, resilient sitemap).

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-23 11:24:20 +02:00

45 lines
1.2 KiB
YAML

# Self-hosted Postgres for Cockpit + studio apps (Oracle Always Free / Hetzner VPS).
# Run on a VM with: docker compose up -d
#
# Expose:
# :5432 direct → DATABASE_URL (migrations, LISTEN/NOTIFY)
# :6432 pool → DATABASE_POOL_URL (Vercel / serverless)
#
# See docs/infrastructure/postgres-portability.md
services:
postgres:
image: postgres:17-alpine
restart: unless-stopped
environment:
POSTGRES_USER: ${POSTGRES_USER:-studio}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?Set POSTGRES_PASSWORD in .env}
volumes:
- pg_data:/var/lib/postgresql/data
- ./init:/docker-entrypoint-initdb.d:ro
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-studio}"]
interval: 5s
timeout: 3s
retries: 10
ports:
- "127.0.0.1:5432:5432"
pgbouncer:
image: edoburu/pgbouncer:v1.24.1-p1
restart: unless-stopped
depends_on:
postgres:
condition: service_healthy
environment:
DATABASE_URL: postgres://${POSTGRES_USER:-studio}:${POSTGRES_PASSWORD}@postgres:5432/cockpit
POOL_MODE: transaction
MAX_CLIENT_CONN: 200
DEFAULT_POOL_SIZE: 20
AUTH_TYPE: scram-sha-256
ports:
- "127.0.0.1:6432:5432"
volumes:
pg_data: