时地方
This commit is contained in:
@@ -1,3 +1,188 @@
|
||||
|
||||
|
||||
|
||||
# 1 复制 .nanobot目录
|
||||
# 2 初始化运行环境
|
||||
|
||||
## 2.1 个人 Telegram Bot
|
||||
nanobot onboard --config ~/.nanobot-personal/config.json \
|
||||
--workspace ~/.nanobot-personal/workspace
|
||||
|
||||
## 2.2 工作 Slack Bot
|
||||
nanobot onboard --config ~/.nanobot-work/config.json \
|
||||
--workspace ~/.nanobot-work/workspace
|
||||
|
||||
|
||||
# 3启动Agent
|
||||
|
||||
nanobot gateway --config ~/.nanobot-personal/config.json --port 18796
|
||||
nanobot gateway --config ~/.nanobot-work/config.json
|
||||
|
||||
|
||||
# 4 创建不同的系统服务
|
||||
|
||||
|
||||
**两个服务都已成功启动并运行!** ✅
|
||||
|
||||
| 服务 | 配置 | 端口 | 状态 |
|
||||
|------|------|------|------|
|
||||
| **nanobot-gateway** | /home/ubuntu/.nanobot/config.json | 18790 | ✅ active |
|
||||
| **nanobot-gateway2** | /home/ubuntu/.nanobot2/config.json | 18796 | ✅ active |
|
||||
|
||||
**注意:** 当前手动运行的 nanobot 进程(PID 444830)需要停止,因为 systemd 服务已经在运行。需要我帮你停止手动进程吗?
|
||||
|
||||
**创建新服务的时候,一定一定需要告诉nanobot,新服务的名称,否则很有可能就把前面的nanobot服务名称给替换掉了@@@@@@@@!!!!!!!**
|
||||
|
||||
|
||||
**两个服务文件内容:**
|
||||
|
||||
---
|
||||
|
||||
**nanobot-gateway.service** (端口 18790)
|
||||
|
||||
```
|
||||
[Unit]
|
||||
Description=Nanobot Gateway Service (Port 18790)
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=ubuntu
|
||||
Group=ubuntu
|
||||
WorkingDirectory=/home/ubuntu/.nanobot/workspace
|
||||
Environment="HOME=/home/ubuntu"
|
||||
Environment="PATH=/home/ubuntu/.local/bin:/usr/local/bin:/usr/bin:/bin"
|
||||
Environment="UV_PYTHON=/home/ubuntu/.local/share/uv/tools/nanobot-ai/bin/python3"
|
||||
ExecStart=/home/ubuntu/.local/bin/nanobot gateway --config /home/ubuntu/.nanobot/config.json --port 18790
|
||||
Restart=always
|
||||
RestartSec=5
|
||||
StandardOutput=journal
|
||||
StandardError=journal
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
**nanobot-gateway2.service** (端口 18796)
|
||||
|
||||
```
|
||||
[Unit]
|
||||
Description=Nanobot Gateway Service 2 (Port 18796)
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=ubuntu
|
||||
Group=ubuntu
|
||||
WorkingDirectory=/home/ubuntu/.nanobot2/workspace
|
||||
Environment="HOME=/home/ubuntu"
|
||||
Environment="PATH=/home/ubuntu/.local/bin:/usr/local/bin:/usr/bin:/bin"
|
||||
Environment="UV_PYTHON=/home/ubuntu/.local/share/uv/tools/nanobot-ai/bin/python3"
|
||||
ExecStart=/home/ubuntu/.local/bin/nanobot gateway --config /home/ubuntu/.nanobot2/config.json --port 18796
|
||||
Restart=always
|
||||
RestartSec=5
|
||||
StandardOutput=journal
|
||||
StandardError=journal
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
```
|
||||
|
||||
|
||||
|
||||
**服务管理命令:**
|
||||
|
||||
---
|
||||
|
||||
**nanobot-gateway** (端口 18790 - 当前这个我)
|
||||
|
||||
```bash
|
||||
# 启动
|
||||
sudo systemctl start nanobot-gateway
|
||||
|
||||
# 重启
|
||||
sudo systemctl restart nanobot-gateway
|
||||
|
||||
# 停止
|
||||
sudo systemctl stop nanobot-gateway
|
||||
|
||||
# 查看状态
|
||||
sudo systemctl status nanobot-gateway
|
||||
|
||||
# 开机启动
|
||||
sudo systemctl enable nanobot-gateway
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
**nanobot-gateway2** (端口 18796)
|
||||
|
||||
```bash
|
||||
# 启动
|
||||
sudo systemctl start nanobot-gateway2
|
||||
|
||||
# 重启
|
||||
sudo systemctl restart nanobot-gateway2
|
||||
|
||||
# 停止
|
||||
sudo systemctl stop nanobot-gateway2
|
||||
|
||||
# 查看状态
|
||||
sudo systemctl status nanobot-gateway2
|
||||
|
||||
# 开机启动
|
||||
sudo systemctl enable nanobot-gateway2
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
**常用快捷命令:**
|
||||
|
||||
```bash
|
||||
# 同时重启两个
|
||||
sudo systemctl restart nanobot-gateway nanobot-gateway2
|
||||
|
||||
# 同时查看状态
|
||||
sudo systemctl status nanobot-gateway nanobot-gateway2
|
||||
|
||||
# 查看日志
|
||||
sudo journalctl -u nanobot-gateway -f
|
||||
sudo journalctl -u nanobot-gateway2 -f
|
||||
```
|
||||
|
||||
|
||||
---
|
||||
|
||||
**我的运行环境** ✅
|
||||
|
||||
- **工作目录**: `/home/ubuntu/.nanobot2/workspace`
|
||||
- **配置文件**: `~/.nanobot2/config.json`
|
||||
- **配置中的 workspace**: `/home/ubuntu/.nanobot2/workspace`
|
||||
|
||||
确实是在 `.nanobot2` 环境下运行。
|
||||
|
||||
---
|
||||
|
||||
**当前 nanobot 进程**
|
||||
|
||||
| PID | 命令 | 说明 |
|
||||
| ------ | --------------------------------------------------------------- | ------------------------------- |
|
||||
| 1550 | `nanobot gateway` | 另一个 gateway 实例(无 `--config` 参数) |
|
||||
| 443106 | `nanobot gateway --config ~/.nanobot2/config.json --port 18796` | **我(当前会话)** |
|
||||
|
||||
---
|
||||
|
||||
**关于 onboard 实例**
|
||||
|
||||
没有找到 `nanobot onboard` 进程。可能:
|
||||
- 之前运行过但已退出
|
||||
- 或者记混了(可能是 PID 1550 那个 gateway 实例?)
|
||||
|
||||
需要我帮你清理 PID 1550 的那个 gateway 实例吗?或者你想确认一下 onboard 进程的状态?
|
||||
|
||||
|
||||
## 🔄 **Nanobot 克隆部署方案**
|
||||
|
||||
### **当前架构分析**
|
||||
@@ -323,3 +508,5 @@ docker exec -it nanobot-main nanobot --version
|
||||
**蔡叔叔,现在的内存做日常任务够用,但跑多个Docker实例会比较紧张。建议先不加容器,或者升级服务器内存到4GB后再部署。** 🐈
|
||||
|
||||
|
||||
---
|
||||
|
||||
|
||||
Reference in New Issue
Block a user