Files

61 lines
1.6 KiB
Markdown
Raw Permalink 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.
# Ubuntu 服务器环境说明
## 系统要求
| 项 | 要求 |
|----|------|
| OS | Ubuntu **22.04 / 24.04** LTS |
| 用户 | **root**(与 crypto_monitor 部署习惯一致) |
| 内存 | 建议 ≥ 1GB |
| 磁盘 | 建议 ≥ 10GB(含 K 线缓存增长) |
| 网络 | 局域网内 Windows 交易机可访问 5800 |
## 安装路径与进程
| 项 | 值 |
|----|-----|
| 代码 | `/opt/gold_monitor` |
| 虚拟环境 | `/opt/gold_monitor/.venv` |
| 数据 | `/opt/gold_monitor/data/gold_monitor.db` |
| 发布包 | `/opt/gold_monitor/releases/` |
| 进程名 | PM2 `gold_monitor` |
| 绑定 | `0.0.0.0:5800` |
## 依赖
一键脚本会安装:
- `git` `curl` `ca-certificates`
- `python3` `python3-venv` `python3-pip`
- Node.js 20.x + 全局 `pm2`
- Python 包:见仓库根 `requirements.txt`(Flask、gunicorn、dotenv)
## PM2
```bash
pm2 status
pm2 logs gold_monitor
pm2 restart gold_monitor
pm2 save
```
开机自启由 `deploy/lib/install.sh` 尝试执行 `pm2 startup`。
## 环境变量
文件:`/opt/gold_monitor/.env`(由 `.env.example` 生成)
| 变量 | 说明 |
|------|------|
| `FLASK_SECRET_KEY` | Session 密钥 |
| `ADMIN_USER` / `ADMIN_PASSWORD` | 网页登录 |
| `HOST` / `PORT` | 默认 `0.0.0.0` / `5800` |
| `PUBLIC_BASE_URL` | 对外访问根 URL(激活展示用) |
| `DATABASE_URL` | 默认 SQLite 文件路径 |
## 与交易机关系
- Ubuntu **不替代** Windows 上的 MT5。
- 交易机运行通用 exe → 连本机 MT5 → API 上报到 Ubuntu。
- 复盘浏览器访问 Ubuntu:5800 即可,不必在交易机上开网页服务。