Add DB+.env auto backup with download and upload restore in Settings.

Backups land under /root/eth_hedge_backups; restore accepts zip body for new-server migration and restarts the process.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-07-26 23:05:58 +08:00
parent 9d3b36826c
commit 2b348854fe
9 changed files with 946 additions and 25 deletions
+14
View File
@@ -5,6 +5,20 @@
---
## 2026-07-26 — 自动备份 / 下载 / 上传恢复
### 变更
1. **自动备份**:默认开启,间隔 24h,保留 14 份;落盘目录优先 `/root/eth_hedge_backups`(可用 `BACKUP_DIR` 覆盖)。内容含 `hedge.db` + `.env`
2. **系统设置 → 备份恢复**:立即备份、服务器列表下载、上传 zip 恢复(确认串 `RESTORE`)。
3. **新服务器迁移**:新机部署后上传旧机备份即可覆盖库与环境变量;恢复后进程退出由 PM2 拉起。有持仓时禁止恢复。
### 测试
- `pytest`:含 `test_backup` 等全量
---
## 2026-07-26 — LIVE 达标含估平仓费;手动/紧急全平进休息
### 变更