Remember to set the frequency for replication to Litestream!



This content originally appeared on DEV Community and was authored by Lucian Ghinda

Curious about how I ended up with an invoice nearing $100 for conducting over 20 million Class A operations on Cloudflare R2?

I initiated several Litestream processes across a variety of side projects and forgot to set the sync interval! 🙂 It defaults to 1s

The backup I was handling was more complex than the main production database. It included slight variations in the SQLite file because it automatically queried various external services to check the status of different entities.

Just add:

sync-interval: 4h

to the replica section.

Here is a full example:

dbs:
  - path: /mnt/goodenoughtesting/current/storage/production.sqlite3
    replicas:
      - type: s3
        bucket: $GOOD_ENOUGH_TESTING_BACKUP
        path: production
        access-key-id: $LITESTREAM_ACCESS_KEY_ID
        secret-access-key: $LITESTREAM_SECRET_ACCESS_KEY
        endpoint: $LITESTREAM_REPLICA_ENDPOINT
        region: auto
        sync-interval: 4h


This content originally appeared on DEV Community and was authored by Lucian Ghinda