Add complete migration guide for 淇淇
This commit is contained in:
377
MIGRATION_GUIDE.md
Normal file
377
MIGRATION_GUIDE.md
Normal file
@@ -0,0 +1,377 @@
|
|||||||
|
# 淇淇完整迁移指南
|
||||||
|
|
||||||
|
## 迁移概述
|
||||||
|
|
||||||
|
本文档提供将淇淇完整克隆到新服务器的完整步骤。
|
||||||
|
|
||||||
|
## 迁移内容清单
|
||||||
|
|
||||||
|
### ✅ 已备份到Git的内容
|
||||||
|
- **配置文件:**
|
||||||
|
- `config/clawdbot.json` - Clawdbot主配置
|
||||||
|
- `config/openclaw.json` - OpenClaw配置
|
||||||
|
- `CONFIG_BACKUP.md` - 配置备份说明
|
||||||
|
|
||||||
|
- **文档:**
|
||||||
|
- `CONFIG_SYNC.md` - Git同步说明
|
||||||
|
- `GIT_STATUS.md` - Git状态记录
|
||||||
|
|
||||||
|
### ⚠️ 需要手动处理的内容
|
||||||
|
- Clawdbot/Clawd程序安装
|
||||||
|
- 插件安装(qqbot等)
|
||||||
|
- 工作区完整克隆(.git已包含,但需要完整拉取)
|
||||||
|
- 系统服务配置
|
||||||
|
- 环境变量(如果有)
|
||||||
|
- API Keys/认证凭据(如果有独立配置)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 方法一:快速迁移(推荐,使用配置文档)
|
||||||
|
|
||||||
|
适用于:只迁移核心配置,重新安装程序
|
||||||
|
|
||||||
|
### 1. 在新服务器上安装Clawdbot
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 安装Clawdbot
|
||||||
|
npm install -g @clawdbot/cli
|
||||||
|
|
||||||
|
# 验证安装
|
||||||
|
clawdbot --version
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2. 克隆配置仓库
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 克隆仓库到临时目录
|
||||||
|
cd /tmp
|
||||||
|
git clone https://szends@126.com:2Live@2026*@git.stableeasy.com/iven/openclaw.git
|
||||||
|
cd openclaw
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3. 恢复配置文件
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 创建配置目录
|
||||||
|
mkdir -p ~/.clawdbot
|
||||||
|
mkdir -p ~/.openclaw
|
||||||
|
|
||||||
|
# 复制配置文件
|
||||||
|
cp config/clawdbot.json ~/.clawdbot/clawdbot.json
|
||||||
|
cp config/openclaw.json ~/.openclaw/openclaw.json
|
||||||
|
|
||||||
|
# 设置权限
|
||||||
|
chmod 600 ~/.clawdbot/clawdbot.json
|
||||||
|
chmod 600 ~/.openclaw/openclaw.json
|
||||||
|
```
|
||||||
|
|
||||||
|
### 4. 安装QQBot插件
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 安装插件
|
||||||
|
openclaw plugins install @sliverp/qqbot@latest
|
||||||
|
|
||||||
|
# 或使用clawdbot命令(如果支持)
|
||||||
|
clawdbot plugin install @sliverp/qqbot@latest
|
||||||
|
```
|
||||||
|
|
||||||
|
### 5. 设置工作区
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 创建工作区目录
|
||||||
|
mkdir -p ~/clawd
|
||||||
|
cd ~/clawd
|
||||||
|
|
||||||
|
# 克隆完整工作区(如果需要保留git历史)
|
||||||
|
# 或初始化新的工作区
|
||||||
|
```
|
||||||
|
|
||||||
|
### 6. 启动Gateway
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 配置并启动systemd服务
|
||||||
|
clawdbot gateway install-service
|
||||||
|
clawdbot gateway start
|
||||||
|
|
||||||
|
# 或直接运行(开发模式)
|
||||||
|
clawdbot gateway
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 方法二:完整迁移(使用rsync/SSH)
|
||||||
|
|
||||||
|
适用于:完全复制当前服务器,包括所有文件和环境
|
||||||
|
|
||||||
|
### 1. 在原服务器打包
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 进入工作区
|
||||||
|
cd ~/clawd
|
||||||
|
|
||||||
|
# 打包配置文件和重要数据
|
||||||
|
tar -czf /tmp/qiqi-migration.tar.gz \
|
||||||
|
~/.clawdbot \
|
||||||
|
~/.openclaw \
|
||||||
|
~/clawd \
|
||||||
|
~/.ssh
|
||||||
|
|
||||||
|
# 传输到新服务器(使用scp)
|
||||||
|
scp /tmp/qiqi-migration.tar.gz user@new-server:/tmp/
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2. 在新服务器解压
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 解压文件
|
||||||
|
cd /
|
||||||
|
tar -xzf /tmp/qiqi-migration.tar.gz
|
||||||
|
|
||||||
|
# 安装Clawdbot(如果未安装)
|
||||||
|
npm install -g @clawdbot/cli
|
||||||
|
|
||||||
|
# 安装插件依赖(可能需要重新安装)
|
||||||
|
cd ~/.openclaw/extensions/qqbot
|
||||||
|
npm install
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3. 调整配置(如有需要)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 编辑配置文件,修改服务器特定的设置
|
||||||
|
vim ~/.clawdbot/clawdbot.json
|
||||||
|
vim ~/.openclaw/openclaw.json
|
||||||
|
```
|
||||||
|
|
||||||
|
### 4. 启动服务
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 启动systemd服务
|
||||||
|
systemctl --user start clawdbot-gateway
|
||||||
|
|
||||||
|
# 检查状态
|
||||||
|
systemctl --user status clawdbot-gateway
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 方法三:Git完整克隆工作区
|
||||||
|
|
||||||
|
适用于:工作区已有git历史,需要完整保留
|
||||||
|
|
||||||
|
### 1. 克隆完整仓库
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 克隆仓库到新位置
|
||||||
|
git clone https://szends@126.com:2Live@2026*@git.stableeasy.com/iven/openclaw.git ~/clawd
|
||||||
|
cd ~/clawd
|
||||||
|
|
||||||
|
# 检查所有分支和标签
|
||||||
|
git branch -a
|
||||||
|
git tag
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2. 恢复配置文件
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 复制配置到系统位置
|
||||||
|
mkdir -p ~/.clawdbot ~/.openclaw
|
||||||
|
cp config/clawdbot.json ~/.clawdbot/
|
||||||
|
cp config/openclaw.json ~/.openclaw/
|
||||||
|
|
||||||
|
# 设置权限
|
||||||
|
chmod 600 ~/.clawdbot/clawdbot.json
|
||||||
|
chmod 600 ~/.openclaw/openclaw.json
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3. 安装Clawdbot和插件
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 安装Clawdbot
|
||||||
|
npm install -g @clawdbot/cli
|
||||||
|
|
||||||
|
# 安装QQBot插件
|
||||||
|
openclaw plugins install @sliverp/qqbot@latest
|
||||||
|
|
||||||
|
# 如果配置文件中配置了其他插件,也要安装
|
||||||
|
# 查看配置:cat ~/.openclaw/openclaw.json | grep -A 20 plugins
|
||||||
|
```
|
||||||
|
|
||||||
|
### 4. 启动并验证
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 启动gateway
|
||||||
|
clawdbot gateway start
|
||||||
|
|
||||||
|
# 查看日志
|
||||||
|
journalctl --user -u clawdbot-gateway -f
|
||||||
|
# 或
|
||||||
|
tail -f /tmp/clawdbot/clawdbot-$(date +%Y-%m-%d).log
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 配置文件说明
|
||||||
|
|
||||||
|
### clawdbot.json 关键配置
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"channels": {
|
||||||
|
"qqbot": {
|
||||||
|
"enabled": true,
|
||||||
|
"appId": "1903233329",
|
||||||
|
"clientSecret": "CNSQI2lUDwd9c3Oj"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"gateway": {
|
||||||
|
"port": 18789,
|
||||||
|
"token": "19a6f039c7d4ff4c09d0db52022c0ec111b6f1a3abb5cc18"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### openclaw.json 关键配置
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"channels": {
|
||||||
|
"qqbot": {
|
||||||
|
"enabled": true,
|
||||||
|
"appId": "1903233329",
|
||||||
|
"clientSecret": "CNSQI2lUDwd9c3Oj"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 验证步骤
|
||||||
|
|
||||||
|
### 1. 检查配置文件
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 验证Clawdbot配置
|
||||||
|
cat ~/.clawdbot/clawdbot.json | jq .
|
||||||
|
|
||||||
|
# 验证OpenClaw配置
|
||||||
|
cat ~/.openclaw/openclaw.json | jq .
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2. 检查插件安装
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 检查插件目录
|
||||||
|
ls -la ~/.openclaw/extensions/
|
||||||
|
|
||||||
|
# 检查qqbot插件
|
||||||
|
ls -la ~/.openclaw/extensions/qqbot/
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3. 检查Gateway状态
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 检查服务状态
|
||||||
|
clawdbot gateway status
|
||||||
|
|
||||||
|
# 或systemd服务
|
||||||
|
systemctl --user status clawdbot-gateway
|
||||||
|
```
|
||||||
|
|
||||||
|
### 4. 测试QQBot连接
|
||||||
|
|
||||||
|
在QQ中发送测试消息给机器人,检查是否能收到回复。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 常见问题
|
||||||
|
|
||||||
|
### Q1: 配置文件中的token可以复制吗?
|
||||||
|
A: Gateway token可以在相同环境复制使用,但建议在每台服务器上重新生成。
|
||||||
|
|
||||||
|
### Q2: 插件需要重新安装吗?
|
||||||
|
A: 是的,插件需要在新服务器上重新安装。配置文件中的插件配置仅用于启用/禁用。
|
||||||
|
|
||||||
|
### Q3: 工作区中的文件会被迁移吗?
|
||||||
|
A:
|
||||||
|
- **方法一:** 不会,需要手动迁移或重新clone
|
||||||
|
- **方法二:** 会,打包迁移
|
||||||
|
- **方法三:** 会,通过git clone迁移
|
||||||
|
|
||||||
|
### Q4: 环境变量需要配置吗?
|
||||||
|
A: 检查原服务器的环境变量(`env | grep -i clawd`),在新服务器上设置相同的变量。
|
||||||
|
|
||||||
|
### Q5: 需要重新配置QQBot吗?
|
||||||
|
A: 配置文件中已包含AppID和AppSecret,直接复制即可使用。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 推荐迁移方案
|
||||||
|
|
||||||
|
**对于大多数情况,推荐使用方法一(快速迁移):**
|
||||||
|
|
||||||
|
1. 安装Clawdbot
|
||||||
|
2. 克隆配置仓库
|
||||||
|
3. 恢复配置文件
|
||||||
|
4. 安装插件
|
||||||
|
5. 克隆工作区(可选)
|
||||||
|
6. 启动服务
|
||||||
|
|
||||||
|
**优点:**
|
||||||
|
- 简单快速
|
||||||
|
- 避免复制不必要的文件
|
||||||
|
- 确保新环境干净
|
||||||
|
|
||||||
|
**适用场景:**
|
||||||
|
- 新服务器需要干净的安装
|
||||||
|
- 原服务器可能有很多临时文件
|
||||||
|
- 需要保持两个服务器独立运行
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 迁移后的维护
|
||||||
|
|
||||||
|
### 定期同步配置
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd ~/clawd
|
||||||
|
# 拉取最新配置
|
||||||
|
git pull origin master
|
||||||
|
|
||||||
|
# 如有本地修改,合并或解决冲突
|
||||||
|
```
|
||||||
|
|
||||||
|
### Git配置同步
|
||||||
|
|
||||||
|
原服务器修改配置后自动推送:
|
||||||
|
```bash
|
||||||
|
cd ~/clawd
|
||||||
|
cp ~/.clawdbot/clawdbot.json config/
|
||||||
|
cp ~/.openclaw/openclaw.json config/
|
||||||
|
git add config/
|
||||||
|
git commit -m "Update config files"
|
||||||
|
git push origin master
|
||||||
|
```
|
||||||
|
|
||||||
|
新服务器拉取配置:
|
||||||
|
```bash
|
||||||
|
cd ~/clawd
|
||||||
|
git pull origin master
|
||||||
|
cp config/clawdbot.json ~/.clawdbot/
|
||||||
|
cp config/openclaw.json ~/.openclaw/
|
||||||
|
clawdbot gateway restart
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 总结
|
||||||
|
|
||||||
|
| 方案 | 复杂度 | 完整性 | 推荐场景 |
|
||||||
|
|-----|--------|--------|----------|
|
||||||
|
| 方法一(快速) | ⭐ 简单 | ⭐⭐⭐ 配置完整 | 新服务器独立部署 |
|
||||||
|
| 方法二(完整) | ⭐⭐⭐ 复杂 | ⭐⭐⭐⭐⭐ 完全复制 | 完全克隆现有服务器 |
|
||||||
|
| 方法三(Git) | ⭐⭐ 中等 | ⭐⭐⭐⭐ 工作区完整 | 需要保留git历史 |
|
||||||
|
|
||||||
|
**选择建议:**
|
||||||
|
- 首次迁移 → 方法一
|
||||||
|
- 需要完全一样 → 方法二
|
||||||
|
- 需要保留git历史 → 方法三
|
||||||
Reference in New Issue
Block a user