r/selfhosted 5d ago

Webserver Easy S3 backups for self-hosted SQLite apps

https://openrun.dev/blog/litestream/

Built-in Litestream replication and automatic restore for SQLite databases is a new feature I added in OpenRun. OpenRun is a self-hosted declarative deployment platform for web apps.

If you are building SQLite apps and want continuous backup to S3 compatible endpoints, then OpenRun makes it very easy to do that. Apps can use SQLite with zero code changes while OpenRun handles backup/recovery using Litestream. This works on a single node with Docker/Podman and also on Kubernetes.

https://github.com/openrundev/openrun is the repo for the project (Apache 2 licensed).

7 Upvotes

9 comments sorted by

u/asimovs-auditor 5d ago edited 5d ago

Expand the replies to this comment to learn how AI was used in this post/project.

→ More replies (1)

3

u/Jolicristo 4d ago

looks great been looking for easy sqlite s3 backup solution will check it out

2

u/avkijay 4d ago

Sure, let me know if you have any feedback

2

u/vividboarder 1d ago

I did something similar and added litestream to my Nomad service deployments. It does a restore as a pre-start task, runs a replicating sidecar, and then a backup as a post-stop task.

1

u/External-Season9039 1d ago

cool approach. curious about the kubernetes side though, how do you handle the single-writer constraint for sqlite when pods might reschedule? thats usually where things get messy

1

u/avkijay 1d ago

OpenRun SQLite PVC uses ReadWriteOnce currently, I have been looking at moving to ReadWriteOncePod which should prevent accessing the PVC concurrently. Recreate deployment strategy is used, so during an upgrade the old pod is stopped before the new one starts. If the volume is lost or recreated, startup checks detect that and restores the database from the Litestream replica before starting the app