Files
crypto_monitor/deploy/README.md
T
2026-05-21 11:45:49 +08:00

69 lines
1.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 环境一键部署
为仓库内各子项目创建 Python 虚拟环境、安装依赖、初始化 `.env` 与静态目录。
## Windows(推荐)
双击仓库根目录 **`一键部署.bat`**,或在 PowerShell 中:
```powershell
cd C:\path\to\crypto_monitor
.\deploy\setup_env.ps1
```
仅部署部分项目:
```powershell
.\deploy\setup_env.ps1 -Only binance,gate_bot
```
重建虚拟环境:
```powershell
.\deploy\setup_env.ps1 -RecreateVenv
```
跳过 PM2、跳过复制 `.env`
```powershell
.\deploy\setup_env.ps1 -SkipPm2 -SkipEnvCopy
```
## Linux / macOS
```bash
cd /opt/crypto_monitor
bash deploy/setup_env.sh
bash deploy/setup_env.sh --only binance,gate
bash deploy/setup_env.sh --recreate-venv
```
## 脚本会做什么
| 步骤 | 说明 |
|------|------|
| 检查 Python | 需要 **3.10+** |
| `crypto_monitor_*` | 各目录 `.venv` + `pip install -r ../requirements.txt` |
| `manual_trading_hub` | 独立 `requirements.txt` |
| `.env` | 若不存在则从 `.env.example` 复制(**不覆盖**已有) |
| 目录 | 创建 `static/images``static/images/order_charts` |
| PM2 | 若已装 Node.js 且未 `-SkipPm2`,尝试 `npm install -g pm2` |
## 部署之后
1. 编辑各子目录 **`.env`**(API、登录密码、SOCKS 代理等)。
2. 本地试运行(以 Binance 为例):
```bash
cd crypto_monitor_binance
source .venv/bin/activate # Windows: .\.venv\Scripts\activate
python app.py
```
3. 服务器长期运行见各目录 **《部署文档.md》**SSH SOCKS、PM2)。
## 依赖说明
- 四个监控子项目共用仓库根目录 **[requirements.txt](../requirements.txt)**。
- 走 SOCKS 代理时必须安装 **PySocks**(已包含在 requirements 中)。