文档修改

This commit is contained in:
2026-05-21 16:51:27 +08:00
parent 7dbc5542de
commit ab854b2c3c
14 changed files with 116 additions and 102 deletions
+28 -14
View File
@@ -1,4 +1,4 @@
# `crypto_monitor` 本地部署 + SSH SOCKS 转发 + PM2 启动指南Ubuntu
# `crypto_monitor_okx` 部署指南:SSH SOCKS + OKX + PM2Ubuntu
本文面向:**本地 Ubuntu 机器运行项目**,但 **本机直连 OKX 会被 TLS/SNI reset** 的场景。解决思路是:
@@ -23,26 +23,40 @@
---
## 1. 从云服务器把项目同步到本地(推荐:打包下载)
## 1. 获取代码与目录
### 1.1 Git 克隆(推荐)
```bash
mkdir -p /opt/crypto_monitor_user
cd /opt/crypto_monitor_user
git clone https://git.bz121.com/dekun/crypto_monitor_user.git
cd crypto_monitor_user/crypto_monitor_okx
cp -n .env.example .env # 若尚无 .env
```
下文用 **`/opt/crypto_monitor_user/crypto_monitor_okx`** 仅为示例,请换成你的实际绝对路径。
### 1.2 从云服务器打包同步到本地(可选)
在云服务器项目目录(包含 `app.py` 的目录)执行:
```bash
cd /opt/crypto_monitor/crypto_monitor_okx
cd /opt/crypto_monitor_user/crypto_monitor_okx
# 可选:清理 Python 缓存,减少小文件传输
find . -type d -name __pycache__ -prune -exec rm -rf {} +
find . -type f -name "*.pyc" -delete
tar -czf crypto_monitor.tgz .
tar -czf crypto_monitor_user.tgz .
```
下载 `crypto_monitor.tgz` 到本机后解压:
下载 `crypto_monitor_user.tgz` 到本机后解压:
```bash
mkdir -p /opt/crypto_monitor/crypto_monitor_okx
cd /opt/crypto_monitor
tar -xzf crypto_monitor.tgz -C crypto_monitor_okx
mkdir -p /opt/crypto_monitor_user/crypto_monitor_okx
cd /opt/crypto_monitor_user
tar -xzf crypto_monitor_user.tgz -C crypto_monitor_okx
cd crypto_monitor_okx
cp -n .env.example .env # 若尚无 .env
```
@@ -109,7 +123,7 @@ curl -4 -Iv --max-time 15 --proxy socks5h://127.0.0.1:1080 https://www.okx.com/a
在本机项目目录:
```bash
cd /opt/crypto_monitor/crypto_monitor_okx
cd /opt/crypto_monitor_user/crypto_monitor_okx
python3 -m venv .venv
source .venv/bin/activate
@@ -138,7 +152,7 @@ export PYTHONDONTWRITEBYTECODE=1
### 5.1 首次配置
```bash
cd /opt/crypto_monitor/crypto_monitor_okx
cd /opt/crypto_monitor_user/crypto_monitor_okx
cp -n .env.example .env # 已存在 .env 时不覆盖
nano .env
@@ -195,7 +209,7 @@ AI_MODEL=你的模型名
启动:
```bash
cd /opt/crypto_monitor/crypto_monitor_okx
cd /opt/crypto_monitor_user/crypto_monitor_okx
source .venv/bin/activate
python app.py
```
@@ -250,10 +264,10 @@ pm2 startup
`pm2` 管理 Python 的常用方式是直接启动解释器:
```bash
cd /opt/crypto_monitor/crypto_monitor_okx
cd /opt/crypto_monitor_user/crypto_monitor_okx
pm2 start /opt/crypto_monitor/crypto_monitor_okx/.venv/bin/python --name crypto-monitor -- \
/opt/crypto_monitor/crypto_monitor_okx/app.py
pm2 start /opt/crypto_monitor_user/crypto_monitor_okx/.venv/bin/python --name crypto-monitor -- \
/opt/crypto_monitor_user/crypto_monitor_okx/app.py
```
> 若项目目录与上文不一致,请替换为实际绝对路径;或用 `readlink -f app.py` 得到绝对路径。