Files
gold_monitor/docs/deploy.md
T

86 lines
1.5 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.
# 部署文档(gold_monitor)
## 1. 目标
在局域网 Ubuntu 上部署 **gold_monitor** 中控:
- Web 登录、下载中心、账户/机器标注、交易复盘
- API:激活、成交上报、K 线缓存
- **PM2** 常驻,端口 **5800**
## 2. 一键交互部署(推荐)
新机 root:
```bash
curl -fsSL https://git.bz121.com/dekun/gold_monitor/raw/branch/main/deploy/manage.sh | bash
```
菜单:
1. 一键部署
2. 一键卸载
3. 更新
0. 退出
已安装后再次进入:
```bash
bash /opt/gold_monitor/deploy/manage.sh
```
## 3. 部署后检查
```bash
pm2 status
pm2 logs gold_monitor --lines 100
curl -s http://127.0.0.1:5800/health
```
浏览器:`http://<服务器IP>:5800`
默认账号:`admin` / `admin123` → 立即修改 `/opt/gold_monitor/.env` 中 `ADMIN_PASSWORD` 与 `FLASK_SECRET_KEY`,然后:
```bash
pm2 restart gold_monitor
```
## 4. 放置通用 exe
```bash
# 将打包好的通用客户端拷到
/opt/gold_monitor/releases/黄金市价辅助.exe
```
网页「下载中心」即可提供下载。未放置时,下载接口会给出说明文件。
## 5. 防火墙(可选)
```bash
ufw allow 5800/tcp
ufw reload
```
## 6. 更新
```bash
bash /opt/gold_monitor/deploy/manage.sh
# 选 3) 更新
```
或:
```bash
cd /opt/gold_monitor && git pull --ff-only
pm2 restart gold_monitor
```
## 7. 备份
重要路径:
- `/opt/gold_monitor/.env`
- `/opt/gold_monitor/data/`
- `/opt/gold_monitor/releases/`
卸载脚本会尝试备份 `.env` 与 `data` 到 `/opt/gold_monitor_backup_<时间戳>/`。