docs: unify Ubuntu root /opt PM2 deployment and refresh README

Add docs/ubuntu-server.md; remove Windows and alternate process managers from deployment guides; index strategy, key monitor, TP/SL, breakeven, and replay docs in root README.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-06-04 11:48:54 +08:00
parent 546bc7bcf1
commit 1282293e91
16 changed files with 355 additions and 491 deletions
+25 -62
View File
@@ -104,70 +104,32 @@ $env:HUB_DISABLED_IDS="1" # 默认即关闭 OKXid=1
---
## 3. 启动顺序(Windows 示例
## 3. 启动顺序(Ubuntu + PM2
**原则**先子代理与四实例 Flask,再中控
### 3.1 子代理(每所一个终端)
在对应策略目录加载 `.env` 后:
```powershell
# 币安
cd c:\Users\dekun\Desktop\crypto_monitor\crypto_monitor_binance
$env:EXCHANGE="binance"; $env:PORT="15200"; $env:HOST="127.0.0.1"
# 可选:$env:CONTROL_TOKEN="你的随机串"
python ..\manual_trading_hub\agent.py
```
```powershell
# OKX(若启用)
cd ..\crypto_monitor_okx
$env:EXCHANGE="okx"; $env:PORT="15201"
python ..\manual_trading_hub\agent.py
```
```powershell
# Gate 训练
cd ..\crypto_monitor_gate
$env:EXCHANGE="gate"; $env:PORT="15202"
python ..\manual_trading_hub\agent.py
```
```powershell
# Gate 趋势
cd ..\crypto_monitor_gate_bot
$env:EXCHANGE="gate"; $env:PORT="15203"
python ..\manual_trading_hub\agent.py
```
### 3.2 四实例 Flask
在各目录按原有方式启动 `app.py`(确保 `APP_PORT` 与设置页 Flask URL 一致)。
### 3.3 中控
```powershell
cd c:\Users\dekun\Desktop\crypto_monitor\manual_trading_hub
$env:HUB_HOST="0.0.0.0" # 仅本机可改为 127.0.0.1
$env:HUB_PORT="5100"
$env:HUB_BRIDGE_TOKEN="你的随机串" # 与各实例、子代理一致
python hub.py
```
浏览器打开:
- 监控区:http://127.0.0.1:5100/monitor
- 行情区:http://127.0.0.1:5100/market
- 系统设置:http://127.0.0.1:5100/settings
- 登录页:http://127.0.0.1:5100/login(已设 `HUB_PASSWORD` 时)
- 旧链接 `/trade` 会自动跳转到 `/monitor`
验收(无需登录):
**原则**代码在 **`/opt/crypto_monitor`**,先四实例 Flask,再中控(一条 PM2 含 4 agent + hub)。环境见 **[docs/ubuntu-server.md](../docs/ubuntu-server.md)**
```bash
# 四所 Flask(示例:币安;其余三所同理)
cd /opt/crypto_monitor/crypto_monitor_binance
pm2 start ecosystem.config.cjs
# 中控 + 子代理
cd /opt/crypto_monitor/manual_trading_hub
pm2 start ecosystem.config.cjs
pm2 save
```
浏览器(本机或反代):
- 监控区:`http://127.0.0.1:5100/monitor`
- 行情区:`http://127.0.0.1:5100/market`
- 系统设置:`http://127.0.0.1:5100/settings`
验收:
```bash
bash /opt/crypto_monitor/manual_trading_hub/scripts/verify_hub_deploy.sh
curl -s http://127.0.0.1:5100/api/ping
# 应含 "build":"20260521-no-trade-ui", "trade_ui":false
```
---
@@ -451,7 +413,7 @@ pm2 save && pm2 startup
快捷:`bash scripts/pm2_hub.sh start|restart|logs`(同样 hub+agent 一起)。
更细的安装顺序、反代、验收见 **《部署文档.md》**screen / systemd 见 **scripts/**
更细的安装顺序、反代、验收见 **《部署文档.md》**PM2 见 **[scripts/后台运行-Ubuntu.md](./scripts/后台运行-Ubuntu.md)**。
---
@@ -478,4 +440,5 @@ pm2 save && pm2 startup
| [常见问题.md](./常见问题.md) | 故障实录与排障 |
| [README.md](./README.md) | 速览 |
| [.env.example](./.env.example) | 环境变量模板 |
| [scripts/后台运行-Ubuntu.md](./scripts/后台运行-Ubuntu.md) | screen / systemd |
| [scripts/后台运行-Ubuntu.md](./scripts/后台运行-Ubuntu.md) | PM2 常驻 |
| [docs/ubuntu-server.md](../docs/ubuntu-server.md) | Ubuntu 环境总览 |