Initial standalone crypto_okx with one-click deploy.
Add deploy/manage.sh bootstrap for git.bz121.com/dekun/crypto_okx and point docs at this repo. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,101 @@
|
||||
# crypto_okx 环境一键部署(Ubuntu / root /opt)
|
||||
|
||||
在 **`/opt/crypto_okx`** 下以 **root** 部署独立 OKX 期权/对冲服务,使用 **PM2** 常驻.
|
||||
|
||||
仓库: [https://git.bz121.com/dekun/crypto_okx.git](https://git.bz121.com/dekun/crypto_okx.git)
|
||||
|
||||
完整步骤见根目录 **[部署文档.md](../部署文档.md)**.
|
||||
|
||||
---
|
||||
|
||||
## 一键部署管理器(推荐)
|
||||
|
||||
新服务器**无需先 clone**,一条命令进入菜单:
|
||||
|
||||
```bash
|
||||
curl -fsSL https://git.bz121.com/dekun/crypto_okx/raw/branch/main/deploy/manage.sh | bash
|
||||
```
|
||||
|
||||
已安装机器:
|
||||
|
||||
```bash
|
||||
bash /opt/crypto_okx/deploy/manage.sh
|
||||
```
|
||||
|
||||
### 菜单
|
||||
|
||||
| 选项 | 功能 |
|
||||
|------|------|
|
||||
| **1) 一键部署** | 环境识别 + 系统依赖 + Node/PM2 + venv + 密钥 + 启动 `crypto_okx` |
|
||||
| **2) 一键卸载** | 备份 `.env` → 停 PM2 → 移走目录 |
|
||||
| **3) 更新** | 快速更新 / 依赖更新 |
|
||||
| **4) 仅检测** | 识别 OS / Python / Node / PM2 / 项目状态(不安装) |
|
||||
| **0) 退出** | |
|
||||
|
||||
### 部署完成后
|
||||
|
||||
- 访问: `http://<服务器IP>:5004` (端口以 `.env` 的 `APP_PORT` 为准)
|
||||
- 默认入口: `/options`
|
||||
- 登录账号: **admin**(密码见 `.env` 的 `APP_PASSWORD`,首次脚本可写成 `admin123`)
|
||||
|
||||
---
|
||||
|
||||
## 脚本结构
|
||||
|
||||
```
|
||||
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](https://git.bz121.com/dekun/crypto_okx.git) 到 `/opt/crypto_okx`
|
||||
|
||||
---
|
||||
|
||||
## 分步安装(仍可用)
|
||||
|
||||
```bash
|
||||
cd /opt
|
||||
git clone https://git.bz121.com/dekun/crypto_okx.git crypto_okx
|
||||
cd /opt/crypto_okx
|
||||
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
|
||||
```
|
||||
|
||||
若在 Windows 编辑过脚本后报 `pipefail` 错误,先转 LF:
|
||||
|
||||
```bash
|
||||
sed -i 's/\r$//' deploy/manage.sh deploy/lib/*.sh deploy/*.sh
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 环境变量(可选)
|
||||
|
||||
```bash
|
||||
INSTALL_ROOT=/opt/crypto_okx
|
||||
GIT_URL=https://git.bz121.com/dekun/crypto_okx.git
|
||||
GIT_BRANCH=main
|
||||
BACKUP_ROOT=/root/backups
|
||||
```
|
||||
Reference in New Issue
Block a user