私有化部署指南
概述
智航云 AI 中台支持私有化部署,适合对数据安全有严格要求的企业客户。私有化部署将完整的 AI 中台能力部署到客户自有的服务器或内网环境中。
部署方式
方式一:标准私有化部署
适合有互联网连接的企业内网部署:
客户服务器 (Linux)
├── claw-backend (Node.js 后端)
├── claw-web (前端静态文件)
├── MongoDB (数据库)
├── Nginx (反向代理)
└── 可选: 向量数据库 (RAG 增强)方式二:离线部署包 (claw-deploy-package)
适合完全断网的安全环境:
- 部署包大小约 2.7GB
- 包含所有依赖和前端资源
- 代码经过混淆保护
- 支持离线激活
系统要求
硬件要求
| 规格 | 最低配置 | 推荐配置 |
|---|---|---|
| CPU | 4 核 | 8 核 |
| 内存 | 8 GB | 16 GB |
| 硬盘 | 50 GB SSD | 200 GB SSD |
| 网络 | 100 Mbps | 1 Gbps |
软件要求
| 组件 | 版本要求 |
|---|---|
| 操作系统 | CentOS 7+, Ubuntu 20.04+, Windows Server 2019+ |
| Node.js | 18.x 或更高 |
| MongoDB | 6.0 或更高 |
| Nginx | 1.20 或更高 |
部署步骤
第一步:环境准备
bash
# 安装 Node.js 18
curl -fsSL https://rpm.nodesource.com/setup_18.x | sudo bash -
sudo yum install -y nodejs
# 安装 MongoDB 6.0
# 参考 MongoDB 官方文档
# 安装 Nginx
sudo yum install -y nginx第二步:部署后端
bash
# 解压部署包
tar -xzf claw-backend-deploy.tar.gz
cd claw-backend
# 安装依赖
npm install --production
# 配置环境变量
cp .env.example .env编辑 .env 配置:
bash
# 数据库
MONGO_URI=mongodb://localhost:27017/claw_platform
# 服务端口
PORT=3000
# AI 模型配置(可选,如需使用云端模型)
ANTHROPIC_API_KEY=sk-ant-xxxxx
# 加密密钥(用于凭据加密)
ENCRYPTION_KEY=your-random-32-char-key
# 许可证
LICENSE_KEY=your-license-keybash
# 启动服务
npm start
# 或使用 PM2 管理进程
pm2 start server.js --name claw-backend第三步:部署前端
bash
# 解压前端文件
tar -xzf claw-web-dist.tar.gz
# 复制到 Nginx 目录
sudo cp -r dist/* /usr/share/nginx/html/第四步:配置 Nginx
nginx
server {
listen 80;
server_name aiplatform.yourcompany.com;
# 前端静态文件
location / {
root /usr/share/nginx/html;
try_files $uri $uri/ /index.html;
}
# API 反向代理
location /api/ {
proxy_pass http://127.0.0.1:3000/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
# SSE 流式支持
location /v1/ai/chat/stream {
proxy_pass http://127.0.0.1:3000/v1/ai/chat/stream;
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_buffering off;
proxy_cache off;
}
}bash
sudo nginx -t
sudo systemctl restart nginx第五步:验证部署
bash
# 检查后端服务
curl http://localhost:3000/health
# 检查 API
curl http://localhost:3000/v1/auth/usage \
-H "X-API-Key: your-initial-key"
# 检查前端页面
curl -I http://aiplatform.yourcompany.comSDK 配置
私有化部署后,SDK 需要指向你自己的 API 地址:
python
claw = ClawPlatform(
api_key="claw_xxxx",
base_url="https://aiplatform.yourcompany.com/api/v1"
)javascript
const claw = new ClawPlatform({
apiKey: 'claw_xxxx',
baseUrl: 'https://aiplatform.yourcompany.com/api/v1'
})离线部署注意事项
对于完全断网的环境:
- AI 模型:需要部署本地模型(如 Qwen、ChatGLM),或通过内网代理访问云端模型
- npm 依赖:部署包已包含所有依赖,无需联网安装
- 激活方式:使用离线激活码,联系 services@invoratec.cn 获取
- 更新方式:通过离线升级包更新,不支持在线更新
数据备份
MongoDB 备份
bash
# 全量备份
mongodump --db claw_platform --out /backup/$(date +%Y%m%d)
# 恢复
mongorestore --db claw_platform /backup/20260412/claw_platform定时备份
bash
# 添加 cron 任务,每天凌晨 2 点备份
0 2 * * * mongodump --db claw_platform --out /backup/$(date +\%Y\%m\%d) --gzipHTTPS 配置
生产环境强烈建议启用 HTTPS:
nginx
server {
listen 443 ssl;
server_name aiplatform.yourcompany.com;
ssl_certificate /etc/ssl/certs/your-cert.pem;
ssl_certificate_key /etc/ssl/private/your-key.pem;
# ... 其他配置同上
}
server {
listen 80;
server_name aiplatform.yourcompany.com;
return 301 https://$host$request_uri;
}监控
健康检查
bash
# 添加到监控系统
curl -f http://localhost:3000/health || echo "服务异常"日志
bash
# 后端日志
tail -f /var/log/claw-backend/app.log
# Nginx 日志
tail -f /var/log/nginx/access.log升级
bash
# 1. 备份数据库
mongodump --db claw_platform --out /backup/pre-upgrade
# 2. 停止服务
pm2 stop claw-backend
# 3. 解压新版本
tar -xzf claw-backend-v2.x.tar.gz
# 4. 安装依赖
npm install --production
# 5. 启动服务
pm2 start claw-backend技术支持
私有化部署相关问题请联系:
- 邮箱:services@invoratec.cn
- 技术支持包含:远程部署协助、故障排查、升级指导
