diff --git a/moltbot/stack.yml b/moltbot/stack.yml new file mode 100644 index 0000000..e8fbe57 --- /dev/null +++ b/moltbot/stack.yml @@ -0,0 +1,33 @@ + +services: + moltbot: + container_name: moltbot-prod + image: xxx.xuanyuan.run/moltbot/moltbot:v1.0.0 # 锁定稳定版本 + restart: unless-stopped + user: "1000:1000" + ports: + - "127.0.0.1:18789:18789" + - "127.0.0.1:18791:18791" + volumes: + - /data/moltbot:/home/moltbot/.clawdbot + - /data/moltbot/logs:/home/moltbot/.clawdbot/logs + - /data/moltbot/credentials:/home/moltbot/.clawdbot/credentials + env_file: + - .env.moltbot + # 资源限制配置(注意:非Swarm模式下deploy.resources不生效) + deploy: + resources: + limits: + cpus: '4' + memory: 8G + # 健康检查(兼容无curl场景,修正CMD语法风险,采用CMD-SHELL支持shell运算符) + healthcheck: + test: ["CMD-SHELL", "wget -qO- http://localhost:18789/health >/dev/null || exit 1"] + interval: 30s + timeout: 10s + retries: 3 + start_period: 60s # 给服务启动预留时间 + # 非Swarm模式资源限制补充(mem_limit/cpus 兼容普通docker compose) + mem_limit: 8g + memswap_limit: 8g + cpus: '4' \ No newline at end of file