openclaw/ROADMAP.md
Claude Code 77645d143d feat: complete distributed Moltbot cluster enhancements
This commit adds comprehensive enhancements to the Moltbot distributed
cluster system, completing high and medium priority features.

Features Added:
- Web Management Panel (admin-panel.html)
  - Real-time database integration
  - Device management from database
  - Monitoring integration links (Grafana/Prometheus)
  - System health status indicator

- Database Persistence System
  - PostgreSQL database with 4 tables (conversations, devices, system_logs, statistics)
  - HTTP API at port 18800 for database operations
  - systemd service for auto-start

- Monitoring Stack (Grafana + Prometheus)
  - Docker Compose setup
  - Grafana: http://38.14.254.51:3000 (admin/moltbot2024)
  - Prometheus: http://38.14.254.51:9090
  - Node Exporter for system metrics

- Automation Scripts
  - notebook-auto-deploy.bat: Automated notebook deployment
  - register-device.bat: Device registration with database
  - setup-ssh-keys.bat: SSH key configuration for passwordless sync
  - sync-daemon.bat: Auto-sync every 10 minutes
  - sync-sessions.bat: Manual session sync

- Email/Webhook Alert System
  - Alert configuration at /opt/moltbot-monitoring/alert-config.json
  - Support for email, DingTalk, Slack, WeChat

- Session Synchronization
  - Server-side: /opt/moltbot-sync/sync-sessions.sh
  - Client-side: sync-sessions.bat
  - Cron job: */10 * * * * (every 10 minutes)
  - Backup rotation (keeps last 10)

Updated:
- ROADMAP.md: Marked completed features, updated progress

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-29 17:42:40 +08:00

666 lines
12 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 🚀 Moltbot 分布式集群 - 扩展和升级计划
**当前版本**: v1.0
**最后更新**: 2026-01-29
**状态**: 核心功能已完成,待扩展优化
---
## 📋 待完成的配置
### 1. 笔记本部署 ⏳
**优先级**: 🔴 高
**当前状态**: 配置文件和脚本已准备
**待完成**:
- [ ] 笔记本1: 部署 Moltbot
- [ ] 笔记本2: 部署 Moltbot
**步骤**:
```bash
# 在笔记本上
git clone https://github.com/flowerjunjie/moltbot.git C:\moltbot
cd C:\moltbot
notebook-setup.bat
```
---
## 🎯 功能扩展计划
### 2. 邮件/Webhook 告警 🔔
**优先级**: 🟡 中
**当前状态**: 监控系统运行中,告警仅记录到日志
**可升级为**:
- [ ] 邮件告警(服务异常时发送邮件)
- [ ] Webhook 告警(发送到钉钉/企业微信/Slack
- [ ] 短信告警(关键故障)
- [ ] 桌面通知(本地服务异常)
**实现方案**:
```bash
# 服务器配置
/opt/moltbot-monitoring/alert.sh
```
**示例配置**:
```json
{
"alerts": {
"email": {
"enabled": true,
"smtp": "smtp.gmail.com:587",
"to": "your-email@example.com",
"from": "moltbot@example.com"
},
"webhook": {
"enabled": true,
"url": "https://oapi.dingtalk.com/robot/send?access_token=xxx"
}
}
}
```
---
### 3. 真正的会话同步 🔄
**优先级**: 🟡 中
**当前状态**: 各设备独立使用,无会话同步
**原因**: Moltbot 不支持 Redis 作为会话存储
**替代方案**:
#### 方案A: 导出/导入会话
```bash
# 导出台式机会话
cp -r ~/.clawdbot/agents/main/sessions sessions-backup.json
# 在笔记本上导入
cp sessions-backup.json ~/.clawdbot/agents/main/sessions/
```
#### 方案B: 同步脚本
创建 `sync-sessions.sh` 定期同步会话到服务器
```bash
#!/bin/bash
# 每10分钟同步一次
while true; do
scp -r ~/.clawdbot/agents/main/sessions \
root@38.14.254.51:/opt/moltbot-backup/sessions-$(hostname)/
sleep 600
done
```
#### 方案C: 共享网络存储
使用 NFS/SMB 共享会话目录
```bash
# 服务器配置 NFS 共享
/opt/moltbot/sessions/ *(rw,sync)
# 客户端挂载
mount 38.14.254.51:/opt/moltbot/sessions ~/.clawdbot/agents/main/sessions
```
---
### 4. SSL/TLS 加密通信 🔐
**优先级**: 🟢 低
**当前状态**: 明文通信 (ws://)
**升级为**:
- [ ] 配置 HTTPS/WSS
- [ ] 申请 SSL 证书
- [ ] 强制加密连接
**实现方案**:
```json
{
"gateway": {
"tls": {
"enabled": true,
"cert": "/path/to/cert.pem",
"key": "/path/to/key.pem"
}
}
}
```
---
### 5. 负载均衡和故障转移 ⚖️
**优先级**: 🟢 低
**当前状态**: 本地优先,但无故障转移
**升级为**:
- [ ] 多节点负载均衡
- [ ] 自动故障转移
- [ ] 健康检查和自动切换
**架构升级**:
```
当前: 设备 → 本地 Gateway (失败则无法使用)
升级: 设备 → 本地 Gateway (失败) → 服务器 Gateway (备用)
```
---
### 6. 数据库持久化 💾
**优先级**: 🟡 中
**当前状态**: PostgreSQL 运行中但未充分利用
**可扩展为**:
- [ ] 长期对话历史存储
- [ ] 用户数据管理
- [ ] 统计分析
- [ ] 数据备份和恢复
**实现方案**:
```sql
-- 创建对话历史表
CREATE TABLE conversations (
id SERIAL PRIMARY KEY,
device_id VARCHAR(100),
session_id VARCHAR(100),
message TEXT,
response TEXT,
timestamp TIMESTAMP DEFAULT NOW()
);
```
---
## 🔧 系统优化计划
### 7. 性能优化 ⚡
**优先级**: 🟢 低
**优化方向**:
- [ ] API 请求缓存
- [ ] 并发请求优化
- [ ] 数据库查询优化
- [ ] CDN 加速(如果使用外部 API
**示例**:
```json
{
"cache": {
"enabled": true,
"ttl": 300,
"maxSize": 1000
}
}
```
---
### 8. 安全加固 🛡️
**优先级**: 🟡 中
**安全措施**:
- [ ] Redis 密码认证(已配置 ✅)
- [ ] Gateway Token 认证(已配置 ✅)
- [ ] 防火墙白名单
- [ ] 访问日志审计
- [ ] 速率限制
- [ ] 敏感数据加密
**防火墙配置**:
```bash
# 仅允许特定IP访问
iptables -A INPUT -p tcp --dport 18789 -s 192.168.1.0/24 -j ACCEPT
iptables -A INPUT -p tcp --dport 18789 -j DROP
```
---
### 9. 监控增强 📊
**优先级**: 🟡 中
**当前监控**: 基础健康检查
**升级为**:
- [ ] Grafana + Prometheus 可视化
- [ ] 实时性能指标
- [ ] 自定义仪表盘
- [ ] 历史数据分析
**实现方案**:
```yaml
# Prometheus 配置
scrape_configs:
- job_name: 'moltbot'
static_configs:
- targets: ['38.14.254.51:18789']
```
---
### 10. 自动化测试 🧪
**优先级**: 🟢 低
**测试类型**:
- [ ] 单元测试
- [ ] 集成测试
- [ ] 端到端测试
- [ ] 压力测试
**CI/CD 集成**:
```yaml
# .github/workflows/test.yml
name: Test
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: pnpm test
```
---
## 🌟 高级功能
### 11. 多语言支持 🌍
**优先级**: 🟢 低
**支持语言**:
- [ ] 英语(当前 ✅)
- [ ] 中文
- [ ] 日语
- [ ] 其他语言
**实现方式**:
```json
{
"i18n": {
"default": "en",
"supported": ["en", "zh", "ja"],
"detection": "auto"
}
}
```
---
### 12. 语音交互 🎤
**优先级**: 🟢 低
**功能**:
- [ ] 语音输入
- [ ] 语音输出
- [ ] 多轮对话
**技术栈**:
- Whisper API (语音识别)
- TTS API (语音合成)
---
### 13. 图像处理 🖼️
**优先级**: 🟢 低
**功能**:
- [ ] 图像识别(已支持 ✅)
- [ ] 图像生成
- [ ] OCR 文字识别
---
### 14. 文件处理 📄
**优先级**: 🟡 中
**支持的文件类型**:
- [ ] PDF 读取和生成
- [ ] Word 文档处理
- [ ] Excel 数据分析
- [ ] 代码文件解析
---
### 15. 插件系统 🔌
**优先级**: 🟢 低
**已有插件**: skills/ 目录
**可扩展**:
- [ ] 自定义插件开发
- [ ] 插件市场
- [ ] 社区贡献
---
## 📱 移动端支持
### 16. iOS/Android 应用 📱
**优先级**: 🟢 低
**开发选项**:
- [ ] React Native 应用
- [ ] Flutter 应用
- [ ] PWA (Progressive Web App)
**核心功能**:
- [ ] 移动端对话
- [ ] 推送通知
- [ ] 离线模式
---
## 🤖 AI 能力扩展
### 17. 多模型支持 🧠
**优先级**: 🟡 中
**当前**: MiniMax (Claude 3.5 Sonnet)
**可扩展为**:
- [ ] OpenAI GPT-4
- [ ] Google Gemini
- [ ] Anthropic Claude
- [ ] 本地模型 (Ollama)
**配置示例**:
```json
{
"models": {
"providers": {
"openai": { "apiKey": "sk-..." },
"anthropic": { "apiKey": "sk-ant-..." },
"google": { "apiKey": "AIza..." }
}
}
}
```
---
### 18. Function Calling 🔨
**优先级**: 🟡 中
**当前**: 基础工具调用
**可扩展为**:
- [ ] 自定义函数
- [ ] API 集成
- [ ] 工作流自动化
---
### 19. Agent 智能体 🤖
**优先级**: 🟢 低
**功能**:
- [ ] 多 Agent 协作
- [ ] 任务分解
- [ ] 自主规划
---
## 🏗️ 基础设施升级
### 20. 容器化部署 🐳
**优先级**: 🟡 中
**Docker 化**:
```dockerfile
FROM node:22
COPY . /app
WORKDIR /app
RUN pnpm install
CMD ["node", "moltbot.mjs", "gateway"]
```
**Docker Compose**:
```yaml
version: '3'
services:
moltbot:
build: .
ports:
- "18789:18789"
environment:
- NODE_ENV=production
```
---
### 21. Kubernetes 部署 ☸️
**优先级**: 🟢 低
**适用于**: 大规模部署
- [ ] 自动扩缩容
- [ ] 滚动更新
- [ ] 服务发现
---
### 22. 云服务集成 ☁️
**优先级**: 🟢 低
**云平台**:
- [ ] AWS 部署
- [ ] Azure 部署
- [ ] Google Cloud 部署
- [ ] 阿里云部署
---
## 📊 管理后台
### 23. Web 管理界面 🌐
**优先级**: 🟡 中
**功能**:
- [ ] 设备管理
- [ ] 用户管理
- [ ] 对话历史查看
- [ ] 统计分析
- [ ] 系统配置
**技术栈**:
- React + TypeScript
- Ant Design / Material-UI
- Next.js / Vite
---
### 24. 数据分析 📈
**优先级**: 🟢 低
**分析内容**:
- [ ] 使用统计
- [ ] 对话分析
- [ ] 性能监控
- [ ] 成本分析
---
## 🔗 集成扩展
### 25. 第三方集成 🔗
**优先级**: 🟢 低
**可集成服务**:
- [ ] Slack / Discord / Telegram Bot
- [ ] Notion / Obsidian 笔记
- [ ] GitHub / GitLab 代码仓库
- [ ] Jira / T项目管理
---
## 📅 升级路线图
### 短期 (1-2周) 🔴
- [x] 基础架构搭建
- [x] 服务器配置
- [x] 桌面配置
- [ ] **笔记本1部署**
- [ ] **笔记本2部署**
- [x] 邮件告警配置
- [x] 会话同步脚本
### 中期 (1-2个月) 🟡
- [x] Web 管理界面
- [x] 数据库持久化
- [x] 监控增强 (Grafana + Prometheus)
- [x] 容器化部署 (Docker Compose)
- [ ] 性能优化
- [ ] 安全加固
### 长期 (3-6个月) 🟢
- [ ] 移动端应用
- [ ] 多模型支持
- [ ] Function Calling
- [ ] Agent 智能体
- [ ] Kubernetes 部署
- [ ] 云服务集成
---
## 💡 快速实现
### 立即可做 (5分钟)
1. **部署笔记本**
```bash
git clone https://github.com/flowerjunjie/moltbot.git C:\moltbot
cd C:\moltbot
notebook-setup.bat
```
2. **配置邮件告警**
- 编辑 `/opt/moltbot-monitoring/alert.sh`
- 添加 SMTP 配置
- 测试邮件发送
3. **设置会话同步**
- 创建 `sync-sessions.sh` 脚本
- 添加到 crontab
### 本周可做 (1-2小时)
1. **SSL/TLS 配置**
- 申请免费证书
- 更新 Gateway 配置
- 测试 WSS 连接
2. **监控增强**
- 安装 Grafana
- 配置 Prometheus
- 创建仪表盘
3. **数据库持久化**
- 设计数据表结构
- 编写存储脚本
- 测试数据读写
---
## 🎯 推荐优先级
### 🔴 高优先级(立即做)
1. **笔记本部署** - 完整覆盖所有设备 ⏳ 待完成
2. ~~**邮件告警**~~ - ✅ 已完成,配置文件已就绪
3. ~~**会话同步脚本**~~ - ✅ 已完成,定期同步运行中
### 🟡 中优先级(本月完成)
4. ~~**Web 管理界面**~~ - ✅ 已完成admin-panel.html 可用
5. ~~**数据库持久化**~~ - ✅ 已完成PostgreSQL + API 就绪
6. **安全加固** - 防火墙白名单、访问日志审计
### 🟢 低优先级(有空再做)
7. **移动端应用** - 扩展使用场景
8. **多模型支持** - 增强灵活性
9. ~~**容器化部署**~~ - ✅ 已完成Docker Compose 监控栈运行中
---
## 📞 实施建议
### 渐进式升级
1. **第一阶段**: 完成基础配置 ✅
- ✅ 服务器、桌面已配置
- ⏳ 部署笔记本
2. **第二阶段**: 增强稳定性 ✅
- ✅ 配置告警系统
- ✅ 实现会话同步
- ✅ 数据库持久化
3. **第三阶段**: 扩展功能 ✅
- ✅ Web 管理界面 (admin-panel.html)
- ✅ 监控增强 (Grafana + Prometheus)
- ✅ 容器化部署 (Docker Compose)
4. **第四阶段**: 高级功能 ⏳
- ⏳ 移动端支持
- ⏳ 多模型集成
- ⏳ 智能体系统
### 已完成功能 (2026-01-29)
**邮件告警系统** - `/opt/moltbot-monitoring/alert.sh`
**会话同步脚本** - Windows + Linux 双向同步
**Web 管理面板** - `admin-panel.html` 实时数据展示
**数据库持久化** - PostgreSQL + HTTP API
**Grafana 监控** - http://38.14.254.51:3000 (admin/moltbot2024)
**Prometheus 指标** - http://38.14.254.51:9090
**自动化部署脚本** - `notebook-auto-deploy.bat`
**设备注册工具** - `register-device.bat`
---
## 📚 参考资料
**文档**:
- SETUP.md - 基础配置
- CLUSTER-CONFIG-SUMMARY.md - 配置详情
- QUICK-START.md - 快速开始
**GitHub**:
- Repository: https://github.com/flowerjunjie/moltbot
- Issues: 报告问题和建议
**配置文件**:
- `~/.clawdbot/moltbot.json` - 本地配置
- `/root/.clawdbot/moltbot.json` - 服务器配置
- `notebook-setup.json` - 笔记本模板
---
**🎉 持续改进,不断优化!**
当前系统已完全可用,建议按优先级逐步实施扩展功能。
如有问题或建议,欢迎提 Issue 或 Pull Request