forked from DevOps/deploy.stack
build(moltbot): 添加生产环境docker compose配置文件
添加moltbot的生产环境docker compose配置文件,包含容器配置、资源限制和健康检查
This commit is contained in:
33
moltbot/stack.yml
Normal file
33
moltbot/stack.yml
Normal file
@@ -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'
|
||||||
Reference in New Issue
Block a user