Files
MoFin/docs/QUICKSTART.md
T

95 lines
2.3 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.
# MoFin — 快速操作手册
> 生产环境: Linux 192.168.1.246 | 端口: API 8899 / Dashboard 8899
---
## 日常检查
```bash
# 打开 Dashboard 看全局
http://192.168.1.246:8899
# 命令行快速状态
ssh hmo@192.168.1.246 "curl -s http://127.0.0.1:8899/api/services | python3 -m json.tool | head -20"
```
---
## Dashboard
```bash
# 查看状态
ssh hmo@192.168.1.246 "sudo systemctl status mofin-dashboard"
# 重启
ssh hmo@192.168.1.246 "sudo systemctl restart mofin-dashboard"
# 查看日志(API+Dashboard 一体,日志走 journald
ssh hmo@192.168.1.246 "sudo journalctl -u mofin-dashboard -n 50"
```
---
## MoFin API
> ⚠️ API 与 Dashboard 已合并为 `mofin-dashboard.service`:8899),无独立 mofin-api 服务。
```bash
# 查看状态(用 mofin-dashboard
ssh hmo@192.168.1.246 "sudo systemctl status mofin-dashboard"
# 重启(用 mofin-dashboard
ssh hmo@192.168.1.246 "sudo systemctl restart mofin-dashboard"
# 测试 API
curl http://192.168.1.246:8899/api/portfolio
```
---
## 健康检查
```bash
# 查看定时任务
ssh hmo@192.168.1.246 "crontab -l | grep health"
# 手动运行(无输出 = 全正常)
ssh hmo@192.168.1.246 "cd ~/MoFin && python3 agents_health_check.py"
# 查看最近报告
ssh hmo@192.168.1.246 "cat ~/MoFin/gateway/temp/last_health_check.json | python3 -m json.tool"
```
---
## 部署更新
> 正确工作流:**本地开发 → push Gitea → 246 pull 部署**(不直接在 246 上改代码,避免 deploy_guard 拦截)
```bash
# 1. 本地开发环境提交并推送(D:\...\projects\MoFin
git add . && git commit -m '说明'
git push origin master
# 2. 246 部署:拉取最新代码
ssh hmo@192.168.1.246 "cd ~/MoFin && git pull --rebase"
# 3. 重启受影响的服务
ssh hmo@192.168.1.246 "sudo systemctl restart mofin-dashboard"
# 4. 验证
ssh hmo@192.168.1.246 "curl -s http://127.0.0.1:8899/api/health"
```
---
## 常见问题
| 现象 | 操作 |
|------|------|
| Dashboard 不响应 | `ssh hmo@246 sudo systemctl restart mofin-dashboard` |
| F Tab 定时任务显示"未部署" | `ssh hmo@246 crontab -l \| grep health` 确认 |
| MoFin API 不响应 | `ssh hmo@246 sudo systemctl restart mofin-dashboard`API+Dashboard 一体)|
| 数据库查询失败 | `ssh hmo@246 'ls -la /home/hmo/MoFin/data/mofin.db'` |