# ============================================================================= # 测试环境编排 (Test Branch Environment) # 特性: # 1. 独占系统业务库 (5434:5432) 与专属数据卷 # 2. 独占对话记录、工作区及日志目录 (./data/test) # 3. 共享连接知识库服务 (shuimu-kb-shared:5432) # ============================================================================= name: agent-test services: system-db: image: postgres:16-alpine container_name: shuimu-system-pg-test command: ["postgres", "-c", "shared_buffers=256MB", "-c", "max_connections=150"] environment: POSTGRES_USER: ${SYSTEM_DB_USER:-app} POSTGRES_PASSWORD: ${SYSTEM_DB_PASSWORD:-test_secret_db_pass} POSTGRES_DB: ${SYSTEM_DB_NAME:-agent_system_test} ports: - "127.0.0.1:${SYSTEM_DB_PUBLISH_PORT:-5434}:5432" volumes: - test-system-pgdata:/var/lib/postgresql/data - ./deploy/postgres/system_init.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_test}"] interval: 5s timeout: 5s retries: 20 restart: unless-stopped networks: - test-net cursor-agent: image: alpine:latest container_name: shuimu-cursor-agent-test command: ["sh", "-c", "echo 'Test Agent Runner is standby' && sleep infinity"] environment: CURSOR_RUNNER_ADDR: ":18766" DATA_DIR: /app/data/workspaces ports: - "127.0.0.1:${CURSOR_RUNNER_PORT:-18766}:18766" volumes: - ./data/test/workspaces:/app/data/workspaces restart: unless-stopped networks: - test-net app: image: alpine:latest container_name: shuimu-agent-app-test command: ["sh", "-c", "echo 'Test Agent App service is running on :8081' && sleep infinity"] depends_on: system-db: condition: service_healthy environment: ENV: test HTTP_ADDR: ":${HTTP_PORT:-8081}" DATA_DIR: /app/data # 独占测试业务与对话库 APP_DB_DSN: postgres://${SYSTEM_DB_USER:-app}:${SYSTEM_DB_PASSWORD:-test_secret_db_pass}@system-db:5432/${SYSTEM_DB_NAME:-agent_system_test}?sslmode=disable # 共享知识库 POSTGRES_SHARED_KB_DSN: postgres://${KB_DB_USER:-regkb}:${KB_DB_PASSWORD:-shared_kb_secret_pass}@shuimu-kb-shared:5432/${KB_DB_NAME:-regulations}?sslmode=disable CURSOR_RUNNER_URL: http://cursor-agent:18766 AUX_FILE_DSN: file:/var/lib/feishu/outbox_test.db?_journal_mode=WAL&_busy_timeout=5000 ports: - "${APP_PUBLISH_HOST:-0.0.0.0}:${HTTP_PORT:-8081}:${HTTP_PORT:-8081}" volumes: # 独占对话记录与环境数据 - ./data/test:/app/data - test-aux-sqlite-data:/var/lib/feishu restart: unless-stopped networks: - test-net - shared-net networks: test-net: name: chat-agent-test-net driver: bridge shared-net: name: chat-agent-shared-net external: true volumes: test-system-pgdata: name: agent-test-system-pgdata test-aux-sqlite-data: name: agent-test-aux-sqlite-data