Using litestream with Cloudfare R2
While reading a blog post named https://avi.im/blag/2024/sqlite-bad-rep/ I came across a project called Litestream. Litestream is a replicating engine for Sqlite:
Continuously stream SQLite changes to AWS S3, Azure Blob Storage, Google Cloud Storage, SFTP, or NFS. Quickly recover to the point of failure if your server goes down.
I have a bucket at Cloudfare R2 that I wanted to use to store images with Captain, my AI written blog-engine.
Here the configuration I used to get it to work
dbs:
- path: /home/{{ ansible_user }}/mydb.db
replicas:
- type: s3
endpoint: https://<account_id>.r2.cloudflarestorage.com
region: weur
path: db
bucket: my-bucket
access-key-id: ""
secret-access-key: ""