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:
@@ -19,9 +19,10 @@
|
||||
安装示例:
|
||||
|
||||
```bash
|
||||
python -m venv .venv
|
||||
source .venv/bin/activate # Windows: .venv\Scripts\activate
|
||||
pip install flask requests ccxt werkzeug PySocks Pillow
|
||||
# 推荐在 /opt/crypto_monitor 执行仓库根目录 deploy/setup_env.sh
|
||||
cd /opt/crypto_monitor/crypto_monitor_binance
|
||||
source .venv/bin/activate
|
||||
pip install -r ../requirements.txt
|
||||
```
|
||||
|
||||
页面上的 **「当日资金(交易账户)」** 与 **「可开仓」可用 U** 仅统计 **Binance U 本位永续合约账户**(`fetch_balance` 的 `swap` / FAPI `assets` 中的 USDT),**不会**再用现货余额顶替。
|
||||
@@ -46,19 +47,17 @@ pip install flask requests ccxt werkzeug PySocks Pillow
|
||||
|
||||
其余变量(登录、企业微信、风控参数、**`AI_PROVIDER` / `OPENAI_*` / `OLLAMA_*`**、数据库路径等)见 **`.env.example` 内注释** 或 `app.py` 顶部默认值。
|
||||
|
||||
## 本地运行
|
||||
## 运行
|
||||
|
||||
**Windows(UTF-8 控制台)** 可使用:
|
||||
生产环境使用 **PM2**(`ecosystem.config.cjs`)。临时调试:
|
||||
|
||||
```powershell
|
||||
.\start_utf8.ps1
|
||||
```bash
|
||||
cd /opt/crypto_monitor/crypto_monitor_binance
|
||||
source .venv/bin/activate
|
||||
python app.py
|
||||
```
|
||||
|
||||
或直接:
|
||||
|
||||
```powershell
|
||||
python .\app.py
|
||||
```
|
||||
环境说明见 [docs/ubuntu-server.md](../docs/ubuntu-server.md)。
|
||||
|
||||
默认监听端口由 `.env` 的 `APP_PORT` 决定(未设置时多为 `5000`)。
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
# `crypto_monitor_binance` 部署指南:SSH SOCKS + Binance + PM2(Ubuntu)
|
||||
|
||||
项目功能、环境变量总览与本地运行说明见 **[README.md](./README.md)**。
|
||||
项目功能、环境变量总览见 **[README.md](./README.md)**。Ubuntu 环境(Python / Node / PM2)见 **[docs/ubuntu-server.md](../docs/ubuntu-server.md)**。
|
||||
|
||||
本文面向:**在本机或 VPS 上运行本项目**,但 **直连 Binance API 不稳定、超时或被网络策略拦截** 的场景。思路是:
|
||||
|
||||
- 本机用 `ssh -D` 做动态转发,把 **SOCKS5 出口**放到能稳定访问 Binance 的机器(常见为一台境外 VPS)
|
||||
- 项目在 `.env` 中设置 **`BINANCE_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-binance`**
|
||||
|
||||
> 安全提醒:不要把 `.env`、私钥 `.pem`、Binance API Key / Secret 提交到 Git;下文只用占位符。
|
||||
@@ -323,7 +323,7 @@ pm2 startup
|
||||
|
||||
### 10.1 SSH SOCKS(自行后台常驻,不推荐用 PM2)
|
||||
|
||||
示例(前台;实际可用 `screen`/`tmux`/`-f` 后台化或 systemd):
|
||||
示例(前台调试;生产请用 **PM2**,见本文 §6 与 [docs/ubuntu-server.md](../docs/ubuntu-server.md)):
|
||||
|
||||
```bash
|
||||
ssh -N -D 127.0.0.1:1080 bn-vps \
|
||||
|
||||
Reference in New Issue
Block a user