My Hosting Platform Runs on Two SQLite Files. Here's How I Back Them Up and Bring Them Back.
Описание и применение
Руководство по резервному копированию и восстановлению платформы agentic-hosting, использующей два файла SQLite, включая создание резервных копий, хранение ключа master.key, резервное копирование Docker‑томов и настройку cron‑задачи.
Задача
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.dbas 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.dbto 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