Files
unknownandCursor e6d37d176d feat(datasource): 完成 M03 数据源配置与熔断巡检
交付三种引擎登记、草稿/已保存连接测试、可逆启用、每源熔断与 Cron 巡检,以及控制台页面;用户确认收尾后标 DONE_LOCAL。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-18 12:50:46 +08:00

141 lines
4.7 KiB
YAML

# Dev-only Compose. All published ports bind to 127.0.0.1.
# Do not reuse these bindings in test/prod deploy configs.
# Secrets come from env_file / shell env — never commit real passwords here.
name: watchman-dev
services:
rabbitmq:
image: rabbitmq:3.13-management-alpine
container_name: watchman-dev-rabbitmq
ports:
- "127.0.0.1:56729:5672"
- "127.0.0.1:15679:15672"
healthcheck:
test: ["CMD", "rabbitmq-diagnostics", "-q", "ping"]
interval: 5s
timeout: 5s
retries: 12
volumes:
- watchman_dev_rabbitmq:/var/lib/rabbitmq
# Optional isolated Postgres for containerized runs. Host Postgres on :5432 remains the
# default for local M01 development documented in docs/runbook.md.
postgres:
profiles: ["compose-db"]
image: postgres:17-alpine
container_name: watchman-dev-postgres
environment:
POSTGRES_USER: ${COMPOSE_POSTGRES_USER:-postgres}
POSTGRES_PASSWORD: ${COMPOSE_POSTGRES_PASSWORD:?set COMPOSE_POSTGRES_PASSWORD in .env.local}
POSTGRES_DB: ${WATCHMAN_DATABASE_NAME:-watchman}
ports:
- "127.0.0.1:54329:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB"]
interval: 5s
timeout: 5s
retries: 12
volumes:
- watchman_dev_postgres:/var/lib/postgresql/data
# M03 S2: probe target for SQL Server connection tests only. Not the platform database.
# Starts only with --profile source-sqlserver. SA password and host port come from
# .env.local; there is deliberately no default password here.
sqlserver:
profiles: ["source-sqlserver"]
image: mcr.microsoft.com/mssql/server:2022-latest
container_name: watchman-dev-sqlserver
environment:
ACCEPT_EULA: "Y"
MSSQL_SA_PASSWORD: ${WATCHMAN_TEST_SQLSERVER_PASSWORD:?set WATCHMAN_TEST_SQLSERVER_PASSWORD in .env.local}
ports:
- "127.0.0.1:${WATCHMAN_TEST_SQLSERVER_PORT:-1433}:1433"
healthcheck:
test:
- "CMD-SHELL"
- "/opt/mssql-tools18/bin/sqlcmd -C -S localhost -U sa -P \"$$MSSQL_SA_PASSWORD\" -Q \"SELECT 1\" -b -o /dev/null"
interval: 5s
timeout: 5s
retries: 24
start_period: 20s
volumes:
- watchman_dev_sqlserver:/var/opt/mssql
api:
profiles: ["app"]
build:
context: ..
dockerfile: deploy/Dockerfile
container_name: watchman-dev-api
command: ["python", "-m", "watchman", "api"]
env_file:
- path: ../.env.shared
required: false
- path: ../.env.local
required: true
environment:
# DEV ONLY: bind all interfaces inside the container network namespace.
# Host publish remains 127.0.0.1:8000 (see ports). Do not copy to deploy configs.
API_HOST: 0.0.0.0
# DEV ONLY: RabbitMQ image default guest/guest — local compose only.
CELERY_BROKER_URL: ${CELERY_BROKER_URL_DOCKER:-amqp://guest:guest@rabbitmq:5672//}
DATABASE_URL: ${DATABASE_URL_DOCKER:?set DATABASE_URL_DOCKER in .env.local}
DATABASE_MIGRATOR_URL: ${DATABASE_MIGRATOR_URL_DOCKER:?set DATABASE_MIGRATOR_URL_DOCKER in .env.local}
ports:
- "127.0.0.1:8000:8000"
extra_hosts:
- "host.docker.internal:host-gateway"
depends_on:
rabbitmq:
condition: service_healthy
worker:
profiles: ["app"]
build:
context: ..
dockerfile: deploy/Dockerfile
container_name: watchman-dev-worker
command: ["python", "-m", "watchman", "worker"]
env_file:
- path: ../.env.shared
required: false
- path: ../.env.local
required: true
environment:
CELERY_BROKER_URL: ${CELERY_BROKER_URL_DOCKER:-amqp://guest:guest@rabbitmq:5672//}
DATABASE_URL: ${DATABASE_URL_DOCKER:?set DATABASE_URL_DOCKER in .env.local}
DATABASE_MIGRATOR_URL: ${DATABASE_MIGRATOR_URL_DOCKER:?set DATABASE_MIGRATOR_URL_DOCKER in .env.local}
extra_hosts:
- "host.docker.internal:host-gateway"
depends_on:
rabbitmq:
condition: service_healthy
beat:
profiles: ["app"]
build:
context: ..
dockerfile: deploy/Dockerfile
container_name: watchman-dev-beat
command: ["python", "-m", "watchman", "beat"]
env_file:
- path: ../.env.shared
required: false
- path: ../.env.local
required: true
environment:
CELERY_BROKER_URL: ${CELERY_BROKER_URL_DOCKER:-amqp://guest:guest@rabbitmq:5672//}
DATABASE_URL: ${DATABASE_URL_DOCKER:?set DATABASE_URL_DOCKER in .env.local}
DATABASE_MIGRATOR_URL: ${DATABASE_MIGRATOR_URL_DOCKER:?set DATABASE_MIGRATOR_URL_DOCKER in .env.local}
extra_hosts:
- "host.docker.internal:host-gateway"
depends_on:
rabbitmq:
condition: service_healthy
volumes:
watchman_dev_rabbitmq:
watchman_dev_postgres:
watchman_dev_sqlserver: