Files
lianghua/docs/DEPLOY_LINUX.md
T

52 lines
2.0 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.
# Linux B/S 部署(linux-web 分支)
架构:Linux 服务器常驻执行「实时抓取 + 分析」(采集引擎每 60s 一轮),
分析事件经 **WebSocket** 实时推送到所有已连接的 Web 仪表盘(浏览器打开即看,无需刷新)。
```
采集引擎 TimelineCollector(后台线程)
├─ 盘前:美股隔夜收盘 → 实证先验(skill)预估今日跳空/日内概率
├─ 盘中:东财7x24快讯入库 → 关键词告警 → 上证实时点位
└─ 盘后:龙虎榜入库 → 收盘日报
│ 事件回调(每条:新快讯/盘中点位/告警/日报…)
aiohttp 服务(端口 8100
├─ GET / Web 仪表盘(深色,事件流实时上屏)
├─ GET /api/recent 最近事件 JSON
├─ GET /api/stats 连接数/缓冲统计
└─ WS /ws 实时广播(断线自动重连)
```
## 部署步骤
```bash
sudo mkdir -p /opt && cd /opt
sudo git clone -b linux-web <仓库地址> a_stock_timeline
cd a_stock_timeline
python3 -m venv venv
venv/bin/pip install -r requirements.txt
sudo cp deploy/a-stock-timeline.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable --now a-stock-timeline
# 查看实时日志
journalctl -u a-stock-timeline -f
```
浏览器访问 `http://<服务器IP>:8100`(生产建议前置 nginx 做 TLS/域名)。
## 数据说明
- 数据库:`/opt/a_stock_timeline/data/a_stock.db`SQLite,与 C 端同 schema
- 事件流水:`data/realtime_feed.jsonl`(重启后自动回放最近 200 条到新连接的客户端)
- 实证先验:`docs/overnight_transmission.md`(由 windows-desktop 分支的
`src/analysis/mine_patterns.py` 挖掘生成,拷贝到 docs/ 即可被服务端加载)
## 与 C 端(windows-desktop 分支)的关系
- 共享:fetcher/storage/分析引擎与全部实证口径
- 差异:C 端入口为 `start_realtime.bat` + 控制台输出 + Windows 数据路径;
linux-web 端入口为 `python -m src.web.server`,事件走 WebSocket 广播,路径全部相对化