Add one-click deploy script for /opt production setup with PM2.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-06-12 13:32:06 +08:00
parent 5e95d3af2f
commit b38b821c35
5 changed files with 519 additions and 32 deletions
+38 -16
View File
@@ -52,20 +52,36 @@ Trading Studio 是一套运行在 Ubuntu 物理服务器(RTX 3060 Ti)上的
> 完整环境配置请参阅 [DEPLOY.md](./DEPLOY.md)
```bash
# 1. 克隆仓库
git clone https://git.bz121.com/dekun/Trading_Studio.git
cd Trading_Studio
### 一键部署(生产环境推荐)
# 2. 创建虚拟环境并安装依赖(详见 DEPLOY.md)
**root** 用户部署到 `/opt/Trading_Studio` 并由 PM2 常驻:
```bash
sudo -i
git clone https://git.bz121.com/dekun/Trading_Studio.git /opt/Trading_Studio
cd /opt/Trading_Studio
chmod +x deploy.sh
bash deploy.sh
```
浏览器访问:`http://<服务器IP>:5683`
日常更新:
```bash
cd /opt/Trading_Studio && bash deploy.sh update
```
### 手动部署(开发调试)
```bash
git clone https://git.bz121.com/dekun/Trading_Studio.git /opt/Trading_Studio
cd /opt/Trading_Studio
python3 -m venv venv
source venv/bin/activate
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121
pip install -r requirements.txt
# 3. 启动中控
python app.py
# 浏览器访问: http://<服务器IP>:5683
```
---
@@ -108,18 +124,21 @@ python app.py
## PM2 守护运行
```bash
# 方式 1ecosystem 配置
pm2 start ecosystem.config.js
标准路径 `/opt/Trading_Studio`root 用户:
# 方式 2:直接命令
pm2 start app.py --name "trading_studio" --interpreter ./venv/bin/python
```bash
# 一键部署 + PM2 启动(推荐)
cd /opt/Trading_Studio && bash deploy.sh
# 或手动 PM2
pm2 start ecosystem.config.js
# 常用管理
pm2 status
pm2 logs trading_studio
pm2 restart trading_studio
pm2 save && pm2 startup # 开机自
bash deploy.sh restart # 重启
bash deploy.sh update # 拉代码 + 更新依赖 + 重
pm2 save && pm2 startup # 开机自启(deploy.sh 已自动配置)
```
---
@@ -150,6 +169,7 @@ outputs/
```
Trading_Studio/
├── deploy.sh # 一键部署脚本(/opt + PM2
├── app.py # Gradio 主入口
├── config.py # 全局配置
├── whisper_service.py # Whisper CUDA 识别
@@ -158,13 +178,15 @@ Trading_Studio/
├── ecosystem.config.js # PM2 守护配置
├── requirements.txt # Python 依赖
├── README.md # 本文件
├── DEPLOY.md # 部署指南
├── DEPLOY.md # 部署指南(含一键部署教程)
├── .gitignore
├── speaker_emb.pt # 音色文件(运行时生成,不入库)
├── uploads/ # 上传临时目录
└── outputs/ # 合成 wav 输出
```
**生产标准路径:** `/opt/Trading_Studio`
---
## 硬件要求