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
+8 -12
View File
@@ -31,9 +31,9 @@
安装示例:
```bash
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install flask requests ccxt werkzeug PySocks Pillow
cd /opt/crypto_monitor/crypto_monitor_gate
source .venv/bin/activate
pip install -r ../requirements.txt
```
## 配置(`.env.example` → `.env`
@@ -56,19 +56,15 @@ pip install flask requests ccxt werkzeug PySocks Pillow
其余见 **`.env.example` 内注释** 或 **`app.py` 顶部默认值**。
## 本地运行
## 运行
**Windows** 推荐使用 UTF-8 控制台脚本
生产使用 **PM2**`ecosystem.config.cjs`)。调试
```powershell
.\start_utf8.ps1
```bash
source .venv/bin/activate && python app.py
```
或直接:
```powershell
python .\app.py
```
见 [docs/ubuntu-server.md](../docs/ubuntu-server.md)。
端口由 **`APP_PORT`** 控制(未设置默认 **5000**)。浏览器登录 **`/login`**,口令为 **`APP_PASSWORD`**。
+4 -2
View File
@@ -1,10 +1,12 @@
# `crypto_monitor_gate` 部署指南:SSH SOCKS + Gate.io + PM2Ubuntu
Ubuntu 环境(Python / Node / PM2、/opt 路径)见 **[docs/ubuntu-server.md](../docs/ubuntu-server.md)**。
本文面向:**在本机运行本项目**,但 **直连 Gate.io API 不稳定或被重置** 的场景。思路是:
- 本机用 `ssh -D` 做动态转发,把 **SOCKS5 出口**放到能正常访问 Gate 的机器(常见为一台境外 VPS)
- 项目在 `.env` 中设置 **`GATE_SOCKS_PROXY=socks5h://127.0.0.1:1080`**(或你实际端口),`ccxt` 经 SOCKS 访问交易所
- **SSH 隧道**:用 `ssh -D` 在本机常驻即可(screen / tmux / systemd 等),**不必交给 PM2**
- **SSH 隧道**:用 `ssh -D` 在本机常驻(可用 **tmux****autossh** 保持连接),**不要** 把 `ssh` 交给 PM2
- 使用 **PM2** 仅托管 **Flask 应用**;仓库根目录 **`ecosystem.config.cjs`** 只定义 `crypto-monitor-gate`
> 安全提醒:不要把 `.env`、私钥 `.pem`、Gate API Key 提交到 Git;下文只用占位符。
@@ -238,7 +240,7 @@ pm2 startup
### 9.1 SSH SOCKS(自行后台常驻,不推荐用 PM2)
示例(前台;实际可用 `screen`/`tmux`/`-f` 后台化或 systemd):
示例(前台调试;生产请用 **PM2**,见本文与 [docs/ubuntu-server.md](../docs/ubuntu-server.md)):
```bash
ssh -N -D 127.0.0.1:1080 gate-vps \