chore(deploy): 三机部署 compose 拆分 + NATS 3 节点集群

126=MinIO(已部署)、128=基础设施、132=应用。

- deploy/128-infra:NATS 3 节点集群(独立卷+cluster routes,暴露4222/4223/4224)+PG/Redis/
  Milvus(自带etcd+自带内部minio,不复用126)/Neo4j/Jaeger;端口对局域网暴露、卷持久化。
- deploy/nats-cluster/nats{1,2,3}.conf:max_payload 一致 + jetstream + cluster。
- deploy/132-app:仅 gateway(3000:8080)+dispatcher+mcp-go+mcp-py,无 admin nginx;env 指向
  126/128;mcp-go 补齐 MINIO env(本会话 blob 遗漏);NATS_STREAM_REPLICAS=3;.env.example 模板。
- docker-compose.prod.yml(单机):删 admin 服务(已内嵌)、mcp-go 补 MINIO env。
- 三个 compose 均 docker compose config 校验通过;.env 已 gitignore、.env.example 可提交。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Blizzard
2026-07-18 14:45:24 +08:00
parent 2e02a12260
commit 6b45adbbd2
8 changed files with 313 additions and 8 deletions
+80
View File
@@ -0,0 +1,80 @@
# sundynix-agentix · 应用机 192.168.100.132
#
# cd deploy/132-app && cp .env.example .env # 填密钥/密码/MinIO 凭据
# docker compose up -d --build # 在 132 本地构建并运行(Gitea 自动部署也走这条)
#
# 说明:
# - 对外只暴露 gateway:3000frp 映射)。gateway 已内嵌 admin 控制台(同源 serve UI+API),
# 无需单独 admin nginx 容器。dispatcher/mcp-go/mcp-py 只走 NATS,无对外端口。
# - 基础设施在 128PG/NATS集群/Redis/Milvus/Neo4j),对象存储在 126MinIO),env 全部指向它们。
# - 构建上下文为仓库根(../..,因 Go 服务 replace ../sundynix-shared)。
# - NATS_STREAM_REPLICAS=3durable 流走 128 三节点集群,有 Raft quorum 容错。
services:
gateway:
build: { context: ../.., dockerfile: sundynix-gateway/Dockerfile }
image: sundynix/gateway:${TAG:-latest}
restart: unless-stopped
environment:
APP_ENV: production
GATEWAY_ADDR: ":8080"
NATS_URL: nats://192.168.100.128:4222,nats://192.168.100.128:4223,nats://192.168.100.128:4224
NATS_STREAM_REPLICAS: "3"
POSTGRES_DSN: postgres://sundynix:${POSTGRES_PASSWORD:?}@192.168.100.128:5432/sundynix?sslmode=disable
REDIS_ADDR: 192.168.100.128:6379
MINIO_ENDPOINT: 192.168.100.126:9000
MINIO_ACCESS_KEY: ${MINIO_ACCESS_KEY:?}
MINIO_SECRET_KEY: ${MINIO_SECRET_KEY:?}
MINIO_BUCKET: ${MINIO_BUCKET:-sundynix-docs}
SUNDYNIX_SECRET_KEY: ${SUNDYNIX_SECRET_KEY:?}
JWT_SECRET: ${JWT_SECRET:?}
ADMIN_USER_IDS: ${ADMIN_USER_IDS:-}
CORS_ALLOW_ORIGIN: ${CORS_ALLOW_ORIGIN:-*}
OTEL_EXPORTER_OTLP_ENDPOINT: http://192.168.100.128:4318
ports: ["3000:8080"] # frp 外网 → 132:3000 → 容器 8080
dispatcher:
build: { context: ../.., dockerfile: sundynix-dispatcher/Dockerfile }
image: sundynix/dispatcher:${TAG:-latest}
restart: unless-stopped
environment:
APP_ENV: production
NATS_URL: nats://192.168.100.128:4222,nats://192.168.100.128:4223,nats://192.168.100.128:4224
NATS_STREAM_REPLICAS: "3"
SUNDYNIX_SECRET_KEY: ${SUNDYNIX_SECRET_KEY:?}
OTEL_EXPORTER_OTLP_ENDPOINT: http://192.168.100.128:4318
DISPATCHER_CONCURRENCY: ${DISPATCHER_CONCURRENCY:-8}
TASK_TOKEN_BUDGET: ${TASK_TOKEN_BUDGET:-200000}
mcp-go:
build: { context: ../.., dockerfile: sundynix-mcp-go/Dockerfile }
image: sundynix/mcp-go:${TAG:-latest}
restart: unless-stopped
environment:
APP_ENV: production
NATS_URL: nats://192.168.100.128:4222,nats://192.168.100.128:4223,nats://192.168.100.128:4224
NATS_STREAM_REPLICAS: "3"
POSTGRES_DSN: postgres://sundynix:${POSTGRES_PASSWORD:?}@192.168.100.128:5432/sundynix?sslmode=disable
REDIS_ADDR: 192.168.100.128:6379
MILVUS_ADDR: 192.168.100.128:19530
NEO4J_URI: neo4j://192.168.100.128:7687
NEO4J_USER: neo4j
NEO4J_PASS: ${NEO4J_PASSWORD:?}
# 报告源/产物 + KB 正文对象存储(本会话新加 blob)——指向 126,勿漏,否则 fallback localhost 连不上。
MINIO_ENDPOINT: 192.168.100.126:9000
MINIO_ACCESS_KEY: ${MINIO_ACCESS_KEY:?}
MINIO_SECRET_KEY: ${MINIO_SECRET_KEY:?}
MINIO_BUCKET: ${MINIO_BUCKET:-sundynix-docs}
SUNDYNIX_SECRET_KEY: ${SUNDYNIX_SECRET_KEY:?}
OTEL_EXPORTER_OTLP_ENDPOINT: http://192.168.100.128:4318
mcp-py:
build: { context: ../../sundynix-mcp-py, dockerfile: Dockerfile }
image: sundynix/mcp-py:${TAG:-latest}
restart: unless-stopped
environment:
NATS_URL: nats://192.168.100.128:4222,nats://192.168.100.128:4223,nats://192.168.100.128:4224
# secure_sandbox(代码隔离执行)需访问宿主 Docker 拉一次性容器。安全敏感:等于把 132 宿主
# Docker 暴露给该服务(可逃逸);不需要代码执行工具可注释掉这两行。mcp-py 无对外端口。
volumes:
- /var/run/docker.sock:/var/run/docker.sock