version: 0.1.0
OpenClaw 生产部署套件 - Docker + CI/CD + 健康检查
bash
cd skills/deployment-kit
# 构建镜像
npm run docker:build
# 运行容器
npm run docker:run
# 查看日志
docker logs -f openclaw
bash
cd docker
# 启动所有服务
docker-compose up -d
# 查看状态
docker-compose ps
# 查看日志
docker-compose logs -f openclaw
bash
# 本地检查
npm run health:check
# 或直接使用脚本
node scripts/health-check.js
text
deployment-kit/
├── docker/
│ ├── Dockerfile # 多阶段构建
│ └── docker-compose.yml # 完整服务栈
├── .github/workflows/
│ └── ci-cd.yml # GitHub Actions
├── scripts/
│ └── health-check.js # 健康检查
└── package.json
检查项说明阈值Gateway网关 HTTP 响应200 OKDisk Space磁盘使用率Warning: 80%, Critical: 90%Memory内存使用率Warning: 80%, Critical: 90%Logs近期错误数Warning: >10 错误
javascript
import { runHealthChecks } from './scripts/health-check.js';
const result = await runHealthChecks();
console.log(result);
// {
// gateway: { status: 'ok' },
// disk: { status: 'ok', usage: '45%' },
// memory: { status: 'ok', usage: '60%' },
// logs: { status: 'ok', recentErrors: 0 }
// }
dockerfile
# 基础镜像
FROM node:20-alpine
# 非 root 用户
USER openclaw
# 健康检查
HEALTHCHECK --interval=30s --timeout=3s \
CMD curl -f http://localhost:18789/health || exit 1
变量说明默认值NODE_ENV运行环境productionTZ时区Asia/ShanghaiOPENCLAW_CONFIG配置文件路径/app/config/openclaw.json
端口服务说明18789OpenClaw Gateway主服务端口9090Prometheus监控(可选)3100Loki日志(可选)
yaml
# docker-compose.yml 已包含
services:
prometheus:
image: prom/prometheus:latest
ports:
- "9090:9090"
grafana:
image: grafana/grafana:latest
ports:
- "3000:3000"
MIT