| ▲ | Running SQLite Apps on Docker and Kubernetes with Litestream(openrun.dev) | ||||||||||||||||
| 21 points by ajayvk 2 hours ago | 10 comments | |||||||||||||||||
| ▲ | ajayvk 2 hours ago | parent | next [-] | ||||||||||||||||
Built-in Litestream replication and automatic restore is a new feature I added in OpenRun (a self-hosted deployment platform for web apps). Apps can use SQLite with zero code changes while OpenRun handles backup/recovery. This works on a single node with Docker/Podman and also on Kubernetes. | |||||||||||||||||
| ▲ | sighansen an hour ago | parent | prev | next [-] | ||||||||||||||||
I use the same stack to run my apps! sqlite as Database backen on ephemeral pods. On initialisation, the pod restores the current litestream backup from object storage. No persistent volumes needed. No issues so far. | |||||||||||||||||
| |||||||||||||||||
| ▲ | ltbarcly3 an hour ago | parent | prev | next [-] | ||||||||||||||||
I'm going to pass. | |||||||||||||||||
| |||||||||||||||||
| ▲ | ddm4rketer an hour ago | parent | prev [-] | ||||||||||||||||
The ephemeral-pod-plus-restore-on-init pattern works right up until it doesn't, and the failure is quiet, so "no issues so far" is unfortunately consistent with both a correct setup and one that is going to bite. Litestream assumes a single writer. It replicates one SQLite file's WAL to object storage; it is not multi-master. If you ever end up with two pods writing, you get two databases diverging and replicating over the top of each other, and nothing errors. You find out when you notice writes going missing. The two ways people get there without meaning to: - replicas gets bumped above 1, sometimes by an HPA nobody remembered was on. - RollingUpdate. It briefly runs old and new pods together, which is enough. Recreate avoids it at the cost of a restart gap. The other thing worth knowing is that replication is asynchronous with a default sync interval of one second, so a hard pod kill can lose whatever was written since the last sync. Fine for a lot of workloads. Not fine if the thing has quietly become a durable transaction log for something that matters. LiteFS was the answer for genuinely multi-node, though I would check its current maintenance status before building on it. | |||||||||||||||||
| |||||||||||||||||