[GH-ISSUE #1518] No support for litestream (sqlite streaming replication) #990

Closed
opened 2026-03-03 02:05:20 +03:00 by kerem · 2 comments
Owner

Originally created by @James-Quigley on GitHub (Mar 20, 2021).
Original GitHub issue: https://github.com/dani-garcia/vaultwarden/issues/1518

Subject of the issue

Attempting to use litestream corrupts the sqlite database. It would be very useful to have this support to make for really easy database backups. Litestream has a tips/tricks page for getting your application to support litestream

Deployment environment

  • bitwarden_rs version: 1.19.0
  • Install method: Docker image

  • Clients used:

  • Reverse proxy and version:

  • MySQL/MariaDB or PostgreSQL version:

  • Other relevant details:

Steps to reproduce

Run bitwarden_rs, run litestream replicate

Expected behaviour

No database corruption

Actual behaviour

Database corruption

Troubleshooting data

Originally created by @James-Quigley on GitHub (Mar 20, 2021). Original GitHub issue: https://github.com/dani-garcia/vaultwarden/issues/1518 <!-- # ### NOTE: Please update to the latest version of bitwarden_rs before reporting an issue! This saves you and us a lot of time and troubleshooting. See: * https://github.com/dani-garcia/bitwarden_rs/issues/1180 * https://github.com/dani-garcia/bitwarden_rs/wiki/Updating-the-bitwarden-image # ### --> <!-- Please fill out the following template to make solving your problem easier and faster for us. This is only a guideline. If you think that parts are unnecessary for your issue, feel free to remove them. Remember to hide/redact personal or confidential information, such as passwords, IP addresses, and DNS names as appropriate. --> ### Subject of the issue <!-- Describe your issue here. --> Attempting to use [litestream](https://litestream.io/) corrupts the sqlite database. It would be very useful to have this support to make for really easy database backups. Litestream has a [tips/tricks page](https://litestream.io/tips/) for getting your application to support litestream ### Deployment environment <!-- ========================================================================================= Preferably, use the `Generate Support String` button on the admin page's Diagnostics tab. That will auto-generate most of the info requested in this section. ========================================================================================= --> <!-- The version number, obtained from the logs (at startup) or the admin diagnostics page --> <!-- This is NOT the version number shown on the web vault, which is versioned separately from bitwarden_rs --> <!-- Remember to check if your issue exists on the latest version first! --> * bitwarden_rs version: 1.19.0 <!-- How the server was installed: Docker image, OS package, built from source, etc. --> * Install method: Docker image * Clients used: <!-- web vault, desktop, Android, iOS, etc. (if applicable) --> * Reverse proxy and version: <!-- if applicable --> * MySQL/MariaDB or PostgreSQL version: <!-- if applicable --> * Other relevant details: ### Steps to reproduce <!-- Tell us how to reproduce this issue. What parameters did you set (differently from the defaults) and how did you start bitwarden_rs? --> Run bitwarden_rs, run litestream replicate ### Expected behaviour <!-- Tell us what you expected to happen --> No database corruption ### Actual behaviour <!-- Tell us what actually happened --> Database corruption ### Troubleshooting data <!-- Share any log files, screenshots, or other relevant troubleshooting data -->
kerem 2026-03-03 02:05:20 +03:00
Author
Owner

@BlackDex commented on GitHub (Mar 20, 2021):

This is more a feature request then an issue.

To have this supported we probably need to add a new configuration parameter or something special to the database url.
So, something like after the database file DATABASE_URL=/data/db.sqlite3;busy_timeout=5000,synchronous=NORMAL could be an option.

That way people can also change more PRAGMA settings if they really want.

<!-- gh-comment-id:803271211 --> @BlackDex commented on GitHub (Mar 20, 2021): This is more a feature request then an issue. To have this supported we probably need to add a new configuration parameter or something special to the database url. So, something like after the database file `DATABASE_URL=/data/db.sqlite3;busy_timeout=5000,synchronous=NORMAL` could be an option. That way people can also change more PRAGMA settings if they really want.
Author
Owner

@jjlin commented on GitHub (Mar 20, 2021):

I would go further -- this is all feature request, zero issue.

I'm not sure what exactly is meant by "database corruption", but https://litestream.io/tips/ only seems to say that WAL mode is required, which bitwarden_rs already uses by default. The other settings seem to be for better performance (the PRAGMA synchronous setting) or better robustness in the main application (the PRAGMA busy_timeout setting). So this could well be a bug in Litestream instead. (I personally wouldn't entrust my backup regimen primarily to a program that's only been released for 3 months, but if you want to, it's your funeral.)

If bitwarden_rs were to provide more user control over database init, it would probably be better to provide a new config item like DATABASE_INIT_FILE that points to a file containing SQL statements to run on startup, then use diesel::sql_query to run each non-blank/comment line. This would provide people with yet another way to shoot themselves in the foot, though.

<!-- gh-comment-id:803484312 --> @jjlin commented on GitHub (Mar 20, 2021): I would go further -- this is all feature request, zero issue. I'm not sure what exactly is meant by "database corruption", but https://litestream.io/tips/ only seems to say that WAL mode is required, which bitwarden_rs already uses by default. The other settings seem to be for better performance (the `PRAGMA synchronous` setting) or better robustness in the main application (the `PRAGMA busy_timeout` setting). So this could well be a bug in Litestream instead. (I personally wouldn't entrust my backup regimen primarily to a program that's only been released for 3 months, but if you want to, it's your funeral.) If bitwarden_rs were to provide more user control over database init, it would probably be better to provide a new config item like `DATABASE_INIT_FILE` that points to a file containing SQL statements to run on startup, then use `diesel::sql_query` to run each non-blank/comment line. This would provide people with yet another way to shoot themselves in the foot, though.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/vaultwarden#990
No description provided.