Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

My Hosting Platform Runs on Two SQLite Files. Here's How I Back Them Up and Bring Them Back.

说明与用途

使用两个 SQLite 文件存储状态的 agentic‑hosting 平台的备份与恢复步骤指南,涵盖数据库备份、密钥管理、Docker 卷备份和离线传输。

问题

How to reliably back up and restore a hosting platform that stores its state in two SQLite files while it is running.

结果

Following the steps yields a robust backup strategy that captures all critical data, allows quick restoration on a fresh server, and keeps secrets separate from database backups.

工作流

  • 1. Run ah backup /var/lib/ah/ah.db as user ah to create gzipped copies of ah.db and ah-metering.db in /var/lib/ah/backups, keeping the 10 newest.
  • 2. Store the master.key securely outside the backup directory (e.g., a secrets manager).
  • 3. Copy Docker volumes (ah-db-*) and the local registry images to a separate backup location.
  • 4. Set up a cron job: 17 * * * * ah /usr/local/bin/ah backup /var/lib/ah/ah.db to run hourly.
  • 5. Create an rsync script or agent prompt to copy /var/lib/ah/backups/ and master.key to an off‑site backup host, and alert if the newest backup is >2 hours old.
  • 6. On a new server, install agentic-hosting, copy /etc/default/ah, the master.key, the .db.gz files, and restore Docker volumes and registry images.
  • 7. Start agentic-hosting and verify the state is restored.

证据

ah backup creates gzipped copies of ah.db and ah-metering.db in /var/lib/ah/backups, keeping the 10 newest.

来源

The master key is the big one. Secrets in ah.db are encrypted with it, and ah backup never writes it into a backup.

来源

If you rotate the key with ah rotate-key, older backups still need the old key.

来源

  • 记录日期: 2026-10-27T15:11:12.144Z