Skip to content

Add Litestream retention policy#40

Merged
retlehs merged 2 commits intomainfrom
litestream-retention
Mar 19, 2026
Merged

Add Litestream retention policy#40
retlehs merged 2 commits intomainfrom
litestream-retention

Conversation

@retlehs
Copy link
Member

@retlehs retlehs commented Mar 19, 2026

Summary

  • Add retention: 24h and snapshot-interval: 24h to both Litestream configs (local dev + Ansible template)
  • Without these settings, Litestream keeps all WAL segments indefinitely — the R2 bucket grew to ~2.5GB in 1.5 hrs within despite a <200MB database
  • After deploy, old generations will be cleaned up automatically and the bucket should stabilize at ~400-600MB

Test plan

  • Deploy and restart the service
  • Verify Litestream logs show snapshot creation and retention enforcement
  • Monitor R2 bucket size over 24-48h to confirm it shrinks

🤖 Generated with Claude Code

Without retention settings, Litestream keeps all WAL segments and
snapshots indefinitely. This caused the R2 bucket to grow to ~2.5GB
despite the database being under 200MB.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@retlehs retlehs requested a review from swalkinshaw March 19, 2026 06:01
@retlehs
Copy link
Member Author

retlehs commented Mar 19, 2026

Happy to adjust retention to further than 24 hrs (and snapshot-interval to less than 24 hrs) since R2 storage is cheap, but there's currently no retention policy in place

@retlehs retlehs merged commit 2e743fc into main Mar 19, 2026
7 checks passed
@retlehs retlehs deleted the litestream-retention branch March 19, 2026 15:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants