Aller au contenu
#0309
SqliteCron

A consistent backup of a live warehouse is one POST

Twelve pipelines write to warehouse.db around the clock. You want a nightly copy you'd trust to restore from, and you don't want to stop twelve pipelines to get it.

A cron entry POSTs /api/v1/sqlite/maintenance?db=warehouse.db&timeout=300 with {"op":"vacuum_into","dest_path":"backups/warehouse-2026-08-21.db"}. The service runs VACUUM INTO directly on its connection, fenced from the concurrent query handlers, and writes a compacted, transactionally consistent copy to a path it refuses to overwrite. Five-minute ceiling for the big ones. The pipelines keep writing the whole time.

A second cron POSTs {"op":"quick_check"} against the new file and pages you if the result isn't ok.

No read replica, no sqlite3 .backup from a shell you have to SSH into, no hoping the cp landed between transactions.

The backup doesn't ask the writers to pause. It asks the database for a moment.