agenthub/deploy/nanobot-gateway/docker-compose.yml

81 lines
3.2 KiB
YAML
Raw Permalink Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

# AgentHub 的「内嵌接入」样本栈:两个 nanobot 容器,零 connector 桥接进程。
#
# ./bootstrap.sh # 签 Agent 凭证、写 .env、build 镜像、起栈
# docker compose logs -f
# docker compose down # 停;身份与工作区留在命名卷里
#
# 和 ../nanobot-duo 的区别就是这一轮的重点:Agent 不再被桥接进程代管,
# nanobot 进程里挂一个 agenthub channel(channel/ 挂进容器),
# 由它自己拿这份凭证去 hub 注册,再自己保持一条出站 WebSocket。
# 所以这里没有入站端口映射,也没有 --port 暴露:hub 不需要能拨进容器。
#
# HUB_URL 默认走 host.docker.internal(Mac/Windows 的 Docker Desktop 自带;
# Linux 靠 extra_hosts 的 host-gateway)。
x-nanobot: &nanobot
image: nanobot:agenthub
init: true
environment: &nanobot-env
# 模型(只进 .env,不进镜像,也不写进 nanobot 的 config.json 之外)
NANOBOT_PROVIDER: ${NANOBOT_PROVIDER:-dashscope}
NANOBOT_MODEL: ${NANOBOT_MODEL:-qwen3.6-plus}
NANOBOT_API_KEY: ${DASHSCOPE_API_KEY:?先跑 bootstrap.sh 生成 .env}
NANOBOT_PROVIDER_BASE: ${NANOBOT_PROVIDER_BASE:-}
# AgentHub 接入(channel/agenthub/runtime.py 只从环境读密钥)
AGENTHUB_SERVER: ${HUB_URL:-http://host.docker.internal:8100}
AGENTHUB_DEPLOYMENT_KIND: docker
AGENTHUB_LABELS: runtime=nanobot,image=nanobot:agenthub,mode=embedded
# 不要在这里放 volumes:YAML 的 << 合并会被 service 级同名字段整体覆盖。
entrypoint: ["/opt/agenthub/entrypoint.sh"]
command:
- gateway
- --foreground
- --workspace
- /home/nanobot/.nanobot/workspace
healthcheck:
test: ["CMD", "python", "-c", "import urllib.request;urllib.request.urlopen('http://127.0.0.1:18790/health',timeout=3)"]
interval: 15s
timeout: 5s
retries: 5
start_period: 25s
restart: unless-stopped
services:
nanobot-alpha:
<<: *nanobot
container_name: agenthub-gw-alpha
environment:
<<: *nanobot-env
AGENTHUB_NAME: alpha
AGENTHUB_AGENT_TOKEN: ${AGENT_TOKEN_ALPHA:?先跑 bootstrap.sh 生成 .env}
AGENTHUB_DISPLAY_NAME: 阿尔法
AGENTHUB_DESCRIPTION: 内嵌接入的写作 Agent(nanobot + agenthub channel)
AGENTHUB_ROLE: writer
AGENTHUB_DEPLOYMENT_REF: docker:agenthub-gw-alpha
volumes:
- ./seed_config.py:/opt/agenthub/seed_config.py:ro
- ./entrypoint.sh:/opt/agenthub/entrypoint.sh:ro
- ./channel:/opt/agenthub/channel:ro
- alpha-home:/home/nanobot/.nanobot
nanobot-beta:
<<: *nanobot
container_name: agenthub-gw-beta
environment:
<<: *nanobot-env
AGENTHUB_NAME: beta
AGENTHUB_AGENT_TOKEN: ${AGENT_TOKEN_BETA:?先跑 bootstrap.sh 生成 .env}
AGENTHUB_DISPLAY_NAME: 贝塔
AGENTHUB_DESCRIPTION: 内嵌接入的审校 Agent(nanobot + agenthub channel)
AGENTHUB_ROLE: editor
AGENTHUB_DEPLOYMENT_REF: docker:agenthub-gw-beta
volumes:
- ./seed_config.py:/opt/agenthub/seed_config.py:ro
- ./entrypoint.sh:/opt/agenthub/entrypoint.sh:ro
- ./channel:/opt/agenthub/channel:ro
- beta-home:/home/nanobot/.nanobot
volumes:
alpha-home:
beta-home: