feat(docker): add postgres service to dev compose
新增 postgres:16-alpine service + named volume + healthcheck,作为 Stage 0+ 默认 DB backend。生产可通过 DATABASE_URL 指向远程 RDS 时跳过此 service。 端口 / 用户 / 密码 / 库名都走 env var 覆盖(POSTGRES_USER/PORT/... 默认 deerflow/5432/deerflow_dev)。 YAML 通过 `docker compose config` 校验;live healthcheck 待 docker daemon 起后由 T1.3 testcontainers 路径覆盖。 Stage 0 PR1 T1.2. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
# Usage: docker-compose -f docker-compose-dev.yaml up --build
|
# Usage: docker-compose -f docker-compose-dev.yaml up --build
|
||||||
#
|
#
|
||||||
# Services:
|
# Services:
|
||||||
|
# - postgres: PostgreSQL 16 (port 5432) — Stage 0+ default DB backend
|
||||||
# - nginx: Reverse proxy (port 2026)
|
# - nginx: Reverse proxy (port 2026)
|
||||||
# - frontend: Frontend Next.js dev server (port 3000)
|
# - frontend: Frontend Next.js dev server (port 3000)
|
||||||
# - gateway: Backend Gateway API + agent runtime (port 8001)
|
# - gateway: Backend Gateway API + agent runtime (port 8001)
|
||||||
@@ -13,6 +14,30 @@
|
|||||||
# Access: http://localhost:2026
|
# Access: http://localhost:2026
|
||||||
|
|
||||||
services:
|
services:
|
||||||
|
# ── Database (Stage 0+ default backend) ────────────────────────────────
|
||||||
|
# Postgres for local dev. Production may point DATABASE_URL at a remote RDS;
|
||||||
|
# this service can then be omitted via `docker compose --profile <other>`.
|
||||||
|
postgres:
|
||||||
|
image: postgres:16-alpine
|
||||||
|
container_name: deer-flow-postgres
|
||||||
|
environment:
|
||||||
|
POSTGRES_USER: ${POSTGRES_USER:-deerflow}
|
||||||
|
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-deerflow_dev}
|
||||||
|
POSTGRES_DB: ${POSTGRES_DB:-deerflow}
|
||||||
|
ports:
|
||||||
|
- "${POSTGRES_PORT:-5432}:5432"
|
||||||
|
volumes:
|
||||||
|
- postgres-data:/var/lib/postgresql/data
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-deerflow} -d ${POSTGRES_DB:-deerflow}"]
|
||||||
|
interval: 5s
|
||||||
|
timeout: 3s
|
||||||
|
retries: 5
|
||||||
|
start_period: 10s
|
||||||
|
networks:
|
||||||
|
- deer-flow-dev
|
||||||
|
restart: unless-stopped
|
||||||
|
|
||||||
# ── Sandbox Provisioner ────────────────────────────────────────────────
|
# ── Sandbox Provisioner ────────────────────────────────────────────────
|
||||||
# Manages per-sandbox Pod + Service lifecycle in the host Kubernetes
|
# Manages per-sandbox Pod + Service lifecycle in the host Kubernetes
|
||||||
# cluster via the K8s API.
|
# cluster via the K8s API.
|
||||||
@@ -178,6 +203,8 @@ volumes:
|
|||||||
# image build are not shadowed by the host backend/ directory mount.
|
# image build are not shadowed by the host backend/ directory mount.
|
||||||
gateway-venv:
|
gateway-venv:
|
||||||
gateway-uv-cache:
|
gateway-uv-cache:
|
||||||
|
# Persist Postgres data across container restarts.
|
||||||
|
postgres-data:
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
deer-flow-dev:
|
deer-flow-dev:
|
||||||
|
|||||||
Reference in New Issue
Block a user