mirror of
https://github.com/bytedance/deer-flow.git
synced 2026-12-06 04:18:35 +08:00
* feat(deploy): support opt-in PostgreSQL in production Compose * fix(deploy): include PostgreSQL logs on startup failure * docs(deploy): document bundled PostgreSQL in the env example * fix(deploy): stop bundled PostgreSQL after its env file is removed * fix(deploy): give the bundled PostgreSQL Gateway a database-scoped login * fix(deploy): include the selected PostgreSQL service in production logs --------- Co-authored-by: Totoro-qaq <279883115+Totoro-qaq@users.noreply.github.com>
45 lines
1.4 KiB
YAML
45 lines
1.4 KiB
YAML
# Optional PostgreSQL for the production stack (DEER_FLOW_COMPOSE_POSTGRES=1).
|
|
services:
|
|
postgres:
|
|
image: postgres:16
|
|
environment:
|
|
POSTGRES_USER: postgres
|
|
POSTGRES_DB: deerflow
|
|
POSTGRES_PASSWORD_FILE: /run/secrets/postgres_bootstrap_password
|
|
POSTGRES_INITDB_ARGS: --auth-host=scram-sha-256
|
|
DEER_FLOW_POSTGRES_PASSWORD: ${DEER_FLOW_POSTGRES_PASSWORD:?Set DEER_FLOW_POSTGRES_PASSWORD in the deploy env file}
|
|
secrets:
|
|
- postgres_bootstrap_password
|
|
volumes:
|
|
- postgres-data:/var/lib/postgresql/data
|
|
- ./postgres-init.sql:/docker-entrypoint-initdb.d/10-deerflow.sql:ro
|
|
healthcheck:
|
|
# Wait for the final TCP listener and a database-scoped application login.
|
|
test:
|
|
- CMD-SHELL
|
|
- >-
|
|
PGPASSWORD="$$DEER_FLOW_POSTGRES_PASSWORD" psql -X -h 127.0.0.1 -U deerflow -d deerflow -Atqc
|
|
'SELECT NOT (rolsuper OR rolcreatedb OR rolcreaterole) FROM pg_roles WHERE rolname = current_user'
|
|
| grep -qx t
|
|
interval: 5s
|
|
timeout: 3s
|
|
retries: 12
|
|
networks:
|
|
- deer-flow
|
|
restart: unless-stopped
|
|
|
|
gateway:
|
|
build:
|
|
args:
|
|
UV_EXTRAS: "${UV_EXTRAS:-} postgres"
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
|
|
volumes:
|
|
postgres-data:
|
|
|
|
secrets:
|
|
postgres_bootstrap_password:
|
|
file: ${DEER_FLOW_POSTGRES_BOOTSTRAP_PASSWORD_FILE:-${HOME}/.config/deerflow/postgres-bootstrap-password}
|