Install
openclaw skills install yuyonghao-deployment-kit提供基于 Docker 和 GitHub Actions 的多阶段构建、CI/CD 流水线和健康检查的生产部署套件。
openclaw skills install yuyonghao-deployment-kitversion: 0.1.0
OpenClaw 生产部署套件 - Docker + CI/CD + 健康检查
cd skills/deployment-kit
# 构建镜像
npm run docker:build
# 运行容器
npm run docker:run
# 查看日志
docker logs -f openclaw
cd docker
# 启动所有服务
docker-compose up -d
# 查看状态
docker-compose ps
# 查看日志
docker-compose logs -f openclaw
# 本地检查
npm run health:check
# 或直接使用脚本
node scripts/health-check.js
deployment-kit/
├── docker/
│ ├── Dockerfile # 多阶段构建
│ └── docker-compose.yml # 完整服务栈
├── .github/workflows/
│ └── ci-cd.yml # GitHub Actions
├── scripts/
│ └── health-check.js # 健康检查
└── package.json
| 检查项 | 说明 | 阈值 |
|---|---|---|
| Gateway | 网关 HTTP 响应 | 200 OK |
| Disk Space | 磁盘使用率 | Warning: 80%, Critical: 90% |
| Memory | 内存使用率 | Warning: 80%, Critical: 90% |
| Logs | 近期错误数 | Warning: >10 错误 |
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 }
// }
# 基础镜像
FROM node:20-alpine
# 非 root 用户
USER openclaw
# 健康检查
HEALTHCHECK --interval=30s --timeout=3s \
CMD curl -f http://localhost:18789/health || exit 1
| 变量 | 说明 | 默认值 |
|---|---|---|
| NODE_ENV | 运行环境 | production |
| TZ | 时区 | Asia/Shanghai |
| OPENCLAW_CONFIG | 配置文件路径 | /app/config/openclaw.json |
| 端口 | 服务 | 说明 |
|---|---|---|
| 18789 | OpenClaw Gateway | 主服务端口 |
| 9090 | Prometheus | 监控(可选) |
| 3100 | Loki | 日志(可选) |
# docker-compose.yml 已包含
services:
prometheus:
image: prom/prometheus:latest
ports:
- "9090:9090"
grafana:
image: grafana/grafana:latest
ports:
- "3000:3000"
MIT