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:
@@ -0,0 +1,26 @@
|
||||
# 应用机 132 的密钥与凭据。cp .env.example .env 后填写(.env 不进 git)。
|
||||
# 三个应用服务共享 SUNDYNIX_SECRET_KEY,必须完全一致(否则跨服务密文解不开)。
|
||||
|
||||
# —— 引导密钥(生成:openssl rand -base64 32)——
|
||||
SUNDYNIX_SECRET_KEY=change-me-secret-32
|
||||
JWT_SECRET=change-me-jwt-32
|
||||
|
||||
# —— 库密码(须与 128-infra/.env 一致)——
|
||||
POSTGRES_PASSWORD=change-me-postgres
|
||||
NEO4J_PASSWORD=change-me-neo4j
|
||||
|
||||
# —— 对象存储(126 上的 MinIO 凭据)——
|
||||
MINIO_ACCESS_KEY=change-me-minio-access
|
||||
MINIO_SECRET_KEY=change-me-minio-secret
|
||||
MINIO_BUCKET=sundynix-docs
|
||||
|
||||
# —— 管理员白名单:首次注册后拿 user.id 填这里,重启 gateway 生效(逗号分隔多个)——
|
||||
ADMIN_USER_IDS=
|
||||
|
||||
# —— CORS:admin 同源免;桌面端/web 从 3000 跨源直连需填实际 origin(frp 外网域名等),
|
||||
# 生产(APP_ENV=production)下缺省不放行任意源。多个逗号分隔。——
|
||||
CORS_ALLOW_ORIGIN=
|
||||
|
||||
# —— 可选调参 ——
|
||||
DISPATCHER_CONCURRENCY=8
|
||||
TASK_TOKEN_BUDGET=200000
|
||||
@@ -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:3000(frp 映射)。gateway 已内嵌 admin 控制台(同源 serve UI+API),
|
||||
# 无需单独 admin nginx 容器。dispatcher/mcp-go/mcp-py 只走 NATS,无对外端口。
|
||||
# - 基础设施在 128(PG/NATS集群/Redis/Milvus/Neo4j),对象存储在 126(MinIO),env 全部指向它们。
|
||||
# - 构建上下文为仓库根(../..,因 Go 服务 replace ../sundynix-shared)。
|
||||
# - NATS_STREAM_REPLICAS=3:durable 流走 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
|
||||
Reference in New Issue
Block a user