Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a CLI feature to backup the SQLite DB #4906

Merged
merged 2 commits into from
Sep 1, 2024

Conversation

BlackDex
Copy link
Collaborator

@BlackDex BlackDex commented Aug 30, 2024

Many users request to add the sqlite3 binary to the container image. This isn't really ideal as that might bring in other dependencies and will only bloat the image. There main reason is to create a backup of the database.

While there already was a feature within the admin interface to do so (or by using the admin API call), this might not be easy.

This PR adds several ways to generate a backup.

  1. By calling the Vaultwarden binary with the backup command like:
  • /vaultwarden backup
  • docker exec -it vaultwarden /vaultwarden backup
  1. By sending the USR1 signal to the running process like:
  • kill -s USR1 $(pidof vaultwarden)
  • killall -s USR1 vaultwarden

This should help users to more easily create backups of there SQLite database.

Also added the Web-Vault version number when using -v/--version to the output.

src/main.rs Outdated Show resolved Hide resolved
src/db/mod.rs Outdated Show resolved Hide resolved
Many users request to add the sqlite3 binary to the container image.
This isn't really ideal as that might bring in other dependencies and will only bloat the image.
There main reason is to create a backup of the database.

While there already was a feature within the admin interface to do so (or by using the admin API call), this might not be easy.

This PR adds several ways to generate a backup.
1. By calling the Vaultwarden binary with the `backup` command like:
  - `/vaultwarden backup`
  - `docker exec -it vaultwarden /vaultwarden backup`
2. By sending the USR1 signal to the running process like:
  - `kill -s USR1 $(pidof vaultwarden)
  - `killall -s USR1 vaultwarden)

This should help users to more easily create backups of there SQLite database.

Also added the Web-Vault version number when using `-v/--version` to the output.

Signed-off-by: BlackDex <black.dex@gmail.com>
Signed-off-by: BlackDex <black.dex@gmail.com>
@dani-garcia dani-garcia merged commit e9acd8b into dani-garcia:main Sep 1, 2024
5 checks passed
@BlackDex BlackDex deleted the add-cli-backup-for-sqlite branch September 20, 2024 10:49
@git-anish
Copy link

Hi @dani-garcia @BlackDex

Quick question about the new update: it only covers SQLite right? I'm wondering if this would be enough to recover from a complete loss of a Vaultwarden deployment?

Currently, I'm running ttionya/vaultwarden-backup to maintain backups in case I need to spin up the server again. It covers

  • config.json
  • rsa_key*
  • Attachments
  • Sent Data: sends
  • SQLite database

@BlackDex
Copy link
Collaborator Author

BlackDex commented Oct 4, 2024

It only covers the database currently.
Mainly because people wanted the SQLite binary inside the container.

So i would suggest to keep using that tool.

@git-anish
Copy link

It only covers the database currently. Mainly because people wanted the SQLite binary inside the container.

So i would suggest to keep using that tool.

Makes complete sense, thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants