d726810320
默认账号改为 admin/admin123,去掉 Windows 部署说明,与客户端同套部署流程。 Co-authored-by: Cursor <cursoragent@cursor.com>
104 lines
2.7 KiB
Markdown
104 lines
2.7 KiB
Markdown
# crypto_okx_hub 环境一键部署(Ubuntu / root /opt)
|
|
|
|
在 **`/opt/crypto_okx_hub`** 下以 **root** 部署期权多机中控,使用 **PM2** 常驻.
|
|
|
|
仓库: [https://git.bz121.com/dekun/crypto_okx_hub.git](https://git.bz121.com/dekun/crypto_okx_hub.git)
|
|
|
|
完整步骤见根目录 **[部署文档.md](../部署文档.md)**.
|
|
|
|
---
|
|
|
|
## 一键部署管理器(推荐)
|
|
|
|
新服务器**无需先 clone**,一条命令进入菜单:
|
|
|
|
```bash
|
|
curl -fsSL https://git.bz121.com/dekun/crypto_okx_hub/raw/branch/main/deploy/manage.sh | bash
|
|
```
|
|
|
|
已安装机器:
|
|
|
|
```bash
|
|
bash /opt/crypto_okx_hub/deploy/manage.sh
|
|
```
|
|
|
|
### 菜单
|
|
|
|
| 选项 | 功能 |
|
|
|------|------|
|
|
| **1) 一键部署** | 环境识别 + 系统依赖 + Node/PM2 + venv + 启动 `crypto_okx_hub` |
|
|
| **2) 一键卸载** | 备份 `.env` / `hub.db` → 停 PM2 → 移走目录 |
|
|
| **3) 更新** | 快速更新 / 依赖更新 |
|
|
| **4) 仅检测** | 识别 OS / Python / Node / PM2 / 项目状态(不安装) |
|
|
| **0) 退出** | |
|
|
|
|
### 部署完成后
|
|
|
|
- 访问: `http://<服务器IP>:5100/login` (端口以 `.env` 的 `APP_PORT` 为准)
|
|
- 默认账号: **admin** / **admin123**(可在页面「系统设置」修改)
|
|
- 路径: `/opt/crypto_okx_hub`
|
|
- 日志: `pm2 logs crypto_okx_hub --lines 100`
|
|
|
|
---
|
|
|
|
## 脚本结构
|
|
|
|
```
|
|
deploy/
|
|
├── manage.sh # 入口(自举 + 菜单)
|
|
├── lib/
|
|
│ ├── common.sh # 公共函数 / 环境识别 / 验收
|
|
│ ├── install.sh # 一键部署
|
|
│ ├── uninstall.sh # 一键卸载
|
|
│ ├── update.sh # 更新子菜单
|
|
│ └── doctor.sh # 仅检测
|
|
├── setup_env.sh # venv + pip(被 install 调用)
|
|
└── pull_and_restart.sh # 快速更新
|
|
```
|
|
|
|
---
|
|
|
|
## 前置条件
|
|
|
|
- **Ubuntu 22.04 / 24.04**,用户 **root**
|
|
- 能 `git clone` [crypto_okx_hub](https://git.bz121.com/dekun/crypto_okx_hub.git) 到 `/opt/crypto_okx_hub`
|
|
|
|
---
|
|
|
|
## 分步安装(仍可用)
|
|
|
|
```bash
|
|
cd /opt
|
|
git clone https://git.bz121.com/dekun/crypto_okx_hub.git crypto_okx_hub
|
|
cd /opt/crypto_okx_hub
|
|
bash deploy/setup_env.sh --install-system-deps
|
|
pm2 start ecosystem.config.cjs
|
|
pm2 save && pm2 startup
|
|
```
|
|
|
|
`setup_env.sh` 常用参数:
|
|
|
|
```bash
|
|
bash deploy/setup_env.sh --recreate-venv # 重建虚拟环境
|
|
bash deploy/setup_env.sh --skip-pm2 # 不尝试安装 pm2
|
|
bash deploy/setup_env.sh --skip-env-copy # 不复制 .env.example
|
|
```
|
|
|
|
若脚本报 `pipefail` 错误(CRLF 行尾),先转 LF:
|
|
|
|
```bash
|
|
sed -i 's/\r$//' deploy/manage.sh deploy/lib/*.sh deploy/*.sh
|
|
```
|
|
|
|
---
|
|
|
|
## 环境变量(可选)
|
|
|
|
```bash
|
|
INSTALL_ROOT=/opt/crypto_okx_hub
|
|
GIT_URL=https://git.bz121.com/dekun/crypto_okx_hub.git
|
|
GIT_BRANCH=main
|
|
BACKUP_ROOT=/root/backups
|
|
APP_PORT=5100
|
|
```
|