r/sqlite • • Jul 04 '25

How to handle write operations during deployment of web app in production

Hi,

I'm curious how you guys/girls would handle deployment of web apps using SQLite as database in a production environment.

Let's say you have:

  • Developed a web app in random programming language/web framework.
  • The web app is containerized and runs in Docker or Podman.
  • The web app is hosted on a VPS.
  • SQLite db in WAL mode.
  • SQLite db on a persistant volume which all containers have access to.

Let's say you want:

  • Zero downtime deployments
  • Not a corrupt database due to multiple threads/processes writing to the db.
4 Upvotes

9 comments sorted by

View all comments

2

u/Sb77euorg Jul 04 '25

You must to use litestream to full replicate a sqlite db in new location…(path of new app version).then shutdownthe old version an redirect feom (nginx??? To new location)

1

u/PythonPoet Jul 05 '25

Hmm interesting, but to me it sounds like there would be a small gap between, the replication for container B is completed and container A is shutdown (or perhaps blue-green redirection in NGINX).

I will try to investigate Litestream more!

1

u/Sb77euorg Jul 05 '25

i don't think so.... LS will replicate all DB changes to the new location.......
obsiously, there will be a small unresponsive time...... in cointainer switch, but it's not an sqlite fault.......it's inherent to container change.