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
+7
View File
@@ -59,6 +59,10 @@ async def lifespan(app: FastAPI):
logger.exception("LIVE startup reconcile log failed")
engine.ensure_loop()
from .backup import start_auto_backup_task
start_auto_backup_task()
session = bootstrap_session(settings)
try:
await session.start()
@@ -79,6 +83,9 @@ async def lifespan(app: FastAPI):
await engine._task
except Exception:
pass
from .backup import stop_auto_backup_task
await stop_auto_backup_task()
await session.stop()
from .exchange import set_exchange
from .strategy.session import set_session