Files
Agent-System/docker-compose.main.yml
T
weichenandCursor 265f09c1f2 fix(server): cache health probes, surface SSE marshal errors, fail closed on missing duties
Health checks reuse a two-second snapshot and bound the schema query. Task SSE writes an error frame when an event cannot be encoded. ResolveDocTask errors when the frozen plan has no duty row, while explicit none-duties stay zero. Drop the unwired semantic-summary replace env, record the intentional dev versus release model split, document the test/main cutover path, and archive pre-goose SQL.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-19 09:16:18 +00:00

190 lines
7.6 KiB
YAML

# =============================================================================
# 主分支/生产环境编排 (Main Branch Production Environment)
# 特性:
# 1. 独占系统业务库 (5435:5432) 与专属高稳定性数据卷
# 2. 独占生产对话记录、工作区及审计日志目录 (./data/main)
# 3. 共享连接知识库服务 (shuimu-kb-shared:5432)
# =============================================================================
name: agent-main
services:
system-db:
image: pgvector/pgvector:pg16
container_name: shuimu-system-pg-main
command: ["postgres", "-c", "shared_buffers=512MB", "-c", "max_connections=300"]
environment:
POSTGRES_USER: ${SYSTEM_DB_USER:-app}
POSTGRES_PASSWORD: ${SYSTEM_DB_PASSWORD:?SYSTEM_DB_PASSWORD is required for main/production}
POSTGRES_DB: ${SYSTEM_DB_NAME:-agent_system_main}
ports:
- "127.0.0.1:${SYSTEM_DB_PUBLISH_PORT:-5435}:5432"
volumes:
- main-system-pgdata:/var/lib/postgresql/data
- ./deploy/postgres/goose/00001_baseline.sql:/docker-entrypoint-initdb.d/01-init.sql:ro
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${SYSTEM_DB_USER:-app} -d ${SYSTEM_DB_NAME:-agent_system_main}"]
interval: 5s
timeout: 5s
retries: 20
restart: always
networks:
- main-net
pi-agent:
image: ${PI_AGENT_IMAGE:-shuimu-pi-agent:main}
build:
context: .
dockerfile: deploy/pi-agent/Dockerfile
container_name: shuimu-pi-agent-main
environment:
PORT: 18867
DATA_DIR: /app/data/workspaces
MINIMAX_ENDPOINT_URL: ${MINIMAX_ENDPOINT_URL:-https://api.minimaxi.com/v1}
MINIMAX_API_KEY: ${MINIMAX_API_KEY:-}
# Release pin. dev uses MiniMax-M2.7-highspeed on purpose.
MINIMAX_MODEL_ID: ${MINIMAX_MODEL_ID:-MiniMax-M3}
MINIMAX_API_TYPE: ${MINIMAX_API_TYPE:-openai-compatible}
MINIMAX_PROVIDER: minimax
TAVILY_API_KEYS: ${TAVILY_API_KEYS:-}
RUNNER_AUTH_TOKEN: ${RUNNER_AUTH_TOKEN:?RUNNER_AUTH_TOKEN is required for main/production}
ports:
- "127.0.0.1:${PI_AGENT_RUNNER_PORT:-18867}:18867"
volumes:
- ./data/main/workspaces:/app/data/workspaces
- ./data/main/agent_sessions:/root/.pi/agent/sessions
tmpfs:
- /tmp
healthcheck:
test: ["CMD-SHELL", "curl -f http://127.0.0.1:18867/health || exit 1"]
interval: 10s
timeout: 5s
retries: 5
restart: always
networks:
- main-net
app:
image: ${APP_IMAGE:-shuimu-agent-app:main}
build:
context: .
dockerfile: deploy/app/Dockerfile
container_name: shuimu-agent-app-main
depends_on:
system-db:
condition: service_healthy
events:
condition: service_healthy
environment:
ENV: main
SEED_DEMO_USERS: "false"
HTTP_ADDR: ":${HTTP_PORT:-8000}"
HTTP_PORT: "${HTTP_PORT:-8000}"
HTTP_HOST: "0.0.0.0"
AGENT_BACKEND: ${AGENT_BACKEND:-pi-agent}
AGENT_TIMEOUT: ${AGENT_TIMEOUT:-30m}
MAX_CONCURRENT_AGENTS: ${MAX_CONCURRENT_AGENTS:-8}
DATA_DIR: /app/data
# 独占生产业务与对话库
APP_DB_DSN: postgres://${SYSTEM_DB_USER:-app}:${SYSTEM_DB_PASSWORD:?SYSTEM_DB_PASSWORD is required for main/production}@system-db:5432/${SYSTEM_DB_NAME:-agent_system_main}?sslmode=disable
# 共享知识库
POSTGRES_SHARED_KB_DSN: postgres://${KB_DB_USER:-regkb}:${KB_DB_PASSWORD:?KB_DB_PASSWORD is required for main/production}@shuimu-kb-shared:5432/${KB_DB_NAME:-regulations}?sslmode=disable
PI_AGENT_RUNNER_URL: http://pi-agent:18867
PI_AGENT_RUNNER_AUTH_TOKEN: ${RUNNER_AUTH_TOKEN:?RUNNER_AUTH_TOKEN is required for main/production}
PI_AGENT_PROVIDER: ${PI_AGENT_PROVIDER:-minimax}
PI_AGENT_MODEL: ${PI_AGENT_MODEL:-${MINIMAX_MODEL_ID:-MiniMax-M3}}
RUNNER_AUTH_TOKEN: ${RUNNER_AUTH_TOKEN:?RUNNER_AUTH_TOKEN is required for main/production}
KB_DB_PASSWORD: ${KB_DB_PASSWORD:?KB_DB_PASSWORD is required for main/production}
ADMIN_USERNAME: ${ADMIN_USERNAME:-admin}
ADMIN_PASSWORD: ${ADMIN_PASSWORD:?ADMIN_PASSWORD is required for main/production}
AUTH_REGISTRATION_ENABLED: ${AUTH_REGISTRATION_ENABLED:-false}
AUTH_REQUIRE_APPROVAL: ${AUTH_REQUIRE_APPROVAL:-false}
EMBEDDING_ENDPOINT_URL: ${EMBEDDING_ENDPOINT_URL:-}
EMBEDDING_MODEL: ${EMBEDDING_MODEL:-bge-m3}
EMBEDDING_API_KEY: ${EMBEDDING_API_KEY:-}
RERANKER_ENDPOINT_URL: ${RERANKER_ENDPOINT_URL:-}
RERANKER_MODEL: ${RERANKER_MODEL:-bge-reranker-v2-m3-free}
RERANKER_API_KEY: ${RERANKER_API_KEY:-}
CORS_ALLOWED_ORIGINS: ${CORS_ALLOWED_ORIGINS:-}
ALLOW_IN_MEMORY: "false"
CACHE_ENABLED: ${CACHE_ENABLED:-true}
INTENT_V2_SHADOW: ${INTENT_V2_SHADOW:-false}
INTENT_V2_DECISION: ${INTENT_V2_DECISION:-false}
INTENT_V2_DECISION_TIER: ${INTENT_V2_DECISION_TIER:-none}
WORKFLOW_INTENTS_ENABLED: ${WORKFLOW_INTENTS_ENABLED:-true}
MULTI_INTENT_ENABLED: ${MULTI_INTENT_ENABLED:-true}
MULTI_INTENT_PLAN_TIER: ${MULTI_INTENT_PLAN_TIER:-legacy}
MULTI_INTENT_U9_SEGMENT: ${MULTI_INTENT_U9_SEGMENT:-false}
MULTI_INTENT_U10_MUTATE: ${MULTI_INTENT_U10_MUTATE:-false}
MULTI_INTENT_U11_DOCGOV: ${MULTI_INTENT_U11_DOCGOV:-false}
MULTI_INTENT_U12_RUN_CONTROL: ${MULTI_INTENT_U12_RUN_CONTROL:-false}
SEMANTIC_SUMMARY_SHADOW: ${SEMANTIC_SUMMARY_SHADOW:-false}
PI_CHANGE_REPORT_NARRATIVE: ${PI_CHANGE_REPORT_NARRATIVE:-false}
FAV_DEGRADED_READ: "false"
FAV_PUBLISHER_ENABLED: "false"
ports:
- "${APP_PUBLISH_HOST:-0.0.0.0}:${HTTP_PORT:-8000}:${HTTP_PORT:-8000}"
healthcheck:
test: ["CMD", "curl", "-fsS", "http://127.0.0.1:${HTTP_PORT:-8000}/api/v1/ready"]
interval: 10s
timeout: 5s
retries: 6
start_period: 20s
volumes:
# 独占生产对话记录与环境数据
- ./data/main:/app/data
- main-aux-sqlite-data:/var/lib/feishu
- ./.regulations:/app/.regulations:ro
restart: always
networks:
- main-net
- shared-net
events:
image: ${EVENTS_IMAGE:-shuimu-agent-events:main}
build:
context: .
dockerfile: deploy/app/Dockerfile
container_name: shuimu-agent-events-main
entrypoint: ["/app/events"]
command: ["-env", "/dev/null"]
depends_on:
system-db:
condition: service_healthy
environment:
ENV: main
HTTP_HOST: "0.0.0.0"
HTTP_PORT: "${EVENTS_HTTP_PORT:-8090}"
EVENTS_HTTP_PORT: "${EVENTS_HTTP_PORT:-8090}"
DATA_DIR: /app/data
ALLOW_IN_MEMORY: "false"
# validateProductionSecrets(ENV=main) 需要口令;events 本身只连系统库,KB DSN 仅满足启动校验
APP_DB_DSN: postgres://${SYSTEM_DB_USER:-app}:${SYSTEM_DB_PASSWORD:?SYSTEM_DB_PASSWORD is required for main/production}@system-db:5432/${SYSTEM_DB_NAME:-agent_system_main}?sslmode=disable
POSTGRES_SHARED_KB_DSN: postgres://${KB_DB_USER:-regkb}:${KB_DB_PASSWORD:?KB_DB_PASSWORD is required for main/production}@shuimu-kb-shared:5432/${KB_DB_NAME:-regulations}?sslmode=disable
ADMIN_PASSWORD: ${ADMIN_PASSWORD:?ADMIN_PASSWORD is required for main/production}
ports:
- "127.0.0.1:${EVENTS_HTTP_PORT:-8090}:${EVENTS_HTTP_PORT:-8090}"
healthcheck:
test: ["CMD", "curl", "-fsS", "http://127.0.0.1:${EVENTS_HTTP_PORT:-8090}/health"]
interval: 10s
timeout: 5s
retries: 6
start_period: 15s
restart: always
networks:
- main-net
- shared-net
networks:
main-net:
name: chat-agent-main-net
driver: bridge
shared-net:
name: chat-agent-shared-net
external: true
volumes:
main-system-pgdata:
name: agent-main-system-pgdata
main-aux-sqlite-data:
name: agent-main-aux-sqlite-data