docker-compose.external-db.yml
Download docker-compose.external-db.yml as it is.
# Use a Postgres you already run instead of the bundled one:## HOURADVANTAGE_DATABASE_URL=postgres://user:pass@host:5432/houradvantage?sslmode=require (in .env)# docker compose -f docker-compose.yml -f docker-compose.external-db.yml up -d --wait## The bundled postgres service is put behind a profile nobody enables, so it# is not started, and the gateways stop waiting for it; POSTGRES_PASSWORD# is not needed. Use sslmode=require (or verify-full) for a database across# the network: the default, prefer, falls back to plain text. The database must# exist and the user must be able to create tables in it; the gateway# creates and migrates its schema on start (one instance at a time). The# role must carry the TCP keepalives (tcp_keepalives_idle, _interval, _count# and tcp_user_timeout) and no statement_timeout, lock_timeout or# idle_in_transaction_session_timeout (the gateway refuses to start otherwise# and prints the SQL; Operations, Database role settings). Through# PgBouncer in transaction mode, give the gateways# HOURADVANTAGE_DATABASE_SESSION_URL as well: the database itself.## A Postgres on the Docker host itself is reachable as host.docker.internal# (Docker Desktop); on Linux add `extra_hosts: ["host.docker.internal:host-gateway"]`# to the gateway service.
services: postgres: profiles: ["bundled-db"]
gateway: # No wait for the bundled database; the Valkey is still waited for. depends_on: !override valkey: condition: service_healthy