[GH-ISSUE #654] How to run backup sql option introduced in 1.11.0 daily? #441

Closed
opened 2026-03-03 01:29:09 +03:00 by kerem · 13 comments
Owner

Originally created by @ghost on GitHub (Oct 9, 2019).
Original GitHub issue: https://github.com/dani-garcia/vaultwarden/issues/654

Hi,

I noticed that in v1.11.0 there is a backup sql option in admin panel.
Is it possible to run this option daily or using cron inside container?
I don't want to use external container only for bitwarden database backup.
I like backup option in admin panel, but clicking it everyday is pain in the ass :)

Thanks

Originally created by @ghost on GitHub (Oct 9, 2019). Original GitHub issue: https://github.com/dani-garcia/vaultwarden/issues/654 Hi, I noticed that in v1.11.0 there is a backup sql option in admin panel. Is it possible to run this option daily or using cron inside container? I don't want to use external container only for bitwarden database backup. I like backup option in admin panel, but clicking it everyday is pain in the ass :) Thanks
kerem closed this issue 2026-03-03 01:29:09 +03:00
Author
Owner

@mprasil commented on GitHub (Oct 9, 2019):

There is no cron inside so that isn't an option. But I suppose you have to actually back up those files anyway, so maybe you can trigger the API to create backup the same way you trigger regular file backups?

<!-- gh-comment-id:540144961 --> @mprasil commented on GitHub (Oct 9, 2019): There is no cron inside so that isn't an option. But I suppose you have to actually back up those files anyway, so maybe you can trigger the API to create backup the same way you trigger regular file backups?
Author
Owner

@ghost commented on GitHub (Oct 10, 2019):

"But I suppose you have to actually back up those files anyway, so maybe you can trigger the API to create backup the same way you trigger regular file backups?" What?

Currently I am using external container to do db backup.
Found out that with 1.11.0 there is an option to create db backup from admin panel.
Want do trigger this option automaticaly. No API trigger, no external container.

So this option is only for manual backup?
Can you add option to set timeout trigger for this option?

<!-- gh-comment-id:540467525 --> @ghost commented on GitHub (Oct 10, 2019): "But I suppose you have to actually back up those files anyway, so maybe you can trigger the API to create backup the same way you trigger regular file backups?" What? Currently I am using external container to do db backup. Found out that with 1.11.0 there is an option to create db backup from admin panel. Want do trigger this option automaticaly. No API trigger, no external container. So this option is only for manual backup? Can you add option to set timeout trigger for this option?
Author
Owner

@BlackDex commented on GitHub (Oct 10, 2019):

It probably is easier to just run in a cron the .backup command on the database it self.
Or try to create a curl/wget command to run this command via the admin panel.

But then still as @mprasil stated. You want to have that backup somewhere off-site instead of the same location as the database is.

<!-- gh-comment-id:540777905 --> @BlackDex commented on GitHub (Oct 10, 2019): It probably is easier to just run in a cron the .backup command on the database it self. Or try to create a curl/wget command to run this command via the admin panel. But then still as @mprasil stated. You want to have that backup somewhere off-site instead of the same location as the database is.
Author
Owner

@mprasil commented on GitHub (Oct 11, 2019):

"But I suppose you have to actually back up those files anyway, so maybe you can trigger the API to create backup the same way you trigger regular file backups?" What?

Apologies for not being clear. Yeah as @Haxy89 explained you probably want the files somewhere off the host. So I was just suggesting that if you have something in place to backup the files to some off-host location, maybe it can trigger the backup call before doing the actual file backup.

I think we could add some option to do backups on schedule, but it's non-trivial change as we'd have to implement cron-like functionality for that.

<!-- gh-comment-id:540976854 --> @mprasil commented on GitHub (Oct 11, 2019): > "But I suppose you have to actually back up those files anyway, so maybe you can trigger the API to create backup the same way you trigger regular file backups?" What? Apologies for not being clear. Yeah as @Haxy89 explained you probably want the files somewhere off the host. So I was just suggesting that if you have something in place to backup the files to some off-host location, maybe it can trigger the backup call before doing the actual file backup. I think we could add some option to do backups on schedule, but it's non-trivial change as we'd have to implement cron-like functionality for that.
Author
Owner

@BlackDex commented on GitHub (Oct 11, 2019):

@mprasil Within the container it could be possible to have a default cronjob or something which does this. And then according to a docker env it does this or not. Building in a cron like feature to bitwarden_rs it self is out of the scope i think.

Maybe an easy trigger/api call to execute the .backup command is nice, but that would be it in my opinion. Or maybe even an option to let it download that backup during that call. That is something which could be nice i think.

<!-- gh-comment-id:540983566 --> @BlackDex commented on GitHub (Oct 11, 2019): @mprasil Within the container it could be possible to have a default cronjob or something which does this. And then according to a docker env it does this or not. Building in a cron like feature to bitwarden_rs it self is out of the scope i think. Maybe an easy trigger/api call to execute the .backup command is nice, but that would be it in my opinion. Or maybe even an option to let it download that backup during that call. That is something which could be nice i think.
Author
Owner

@ghost commented on GitHub (Oct 11, 2019):

So what is the purpose of this new "Backup Database" button?
Backup is created next to db file, user have to manualy click "Backup Database" and then manually move backup file somewhere else. It does not make sense

<!-- gh-comment-id:540985218 --> @ghost commented on GitHub (Oct 11, 2019): So what is the purpose of this new "Backup Database" button? Backup is created next to db file, user have to manualy click "Backup Database" and then manually move backup file somewhere else. It does not make sense
Author
Owner

@BlackDex commented on GitHub (Oct 11, 2019):

Well the purpose is to create a backup of the current database state.
You can use this for instance before you update the container, or just daily.
But it will create the backup right next to the live database file.

Also, i tested something just yet and come across a bug which i just fixed in a PR #660.

<!-- gh-comment-id:541005480 --> @BlackDex commented on GitHub (Oct 11, 2019): Well the purpose is to create a backup of the current database state. You can use this for instance before you update the container, or just daily. But it will create the backup right next to the live database file. Also, i tested something just yet and come across a bug which i just fixed in a PR #660.
Author
Owner

@mprasil commented on GitHub (Oct 11, 2019):

So what is the purpose of this new "Backup Database" button?

It is a backup, it's just not best practice to leave the backups on the same machine as live data, because if something happened to the machine itself, you'd lose both backup and live data. But bitwarden_rs can only do so much for you.

@BlackDex I think incorporating cron is a bit too much. We'd have to add some sort of init daemon and other moving parts inside the container. Considering the long term plan is to remove the sqlite3 binary and use built in functionality of sqlite library to do the backups, this would be step in the wrong direction.

I think the docker way of doing things is set of small containers each doing its thing. There are images that do cron well. The practical overhead of running two separate containers is barely more than running a separate process.

<!-- gh-comment-id:541016544 --> @mprasil commented on GitHub (Oct 11, 2019): > So what is the purpose of this new "Backup Database" button? It is a backup, it's just not best practice to leave the backups on the same machine as live data, because if something happened to the machine itself, you'd lose both backup and live data. But `bitwarden_rs` can only do so much for you. @BlackDex I think incorporating cron is a bit too much. We'd have to add some sort of init daemon and other moving parts inside the container. Considering the long term plan is to remove the `sqlite3` binary and use built in functionality of `sqlite` library to do the backups, this would be step in the wrong direction. I think the docker way of doing things is set of small containers each doing its thing. There are images that do cron well. The practical overhead of running two separate containers is barely more than running a separate process.
Author
Owner

@BlackDex commented on GitHub (Oct 11, 2019):

That could be a nice option to write a wiki about.
A cron docker, which does the backups, and moves that backup file to some other volume maybe.

But i agree, adding cron features to bitwarden it self is a bad idea.
And isn't there a way to execute a command to sqlite via diesel now?
Which eliminates the needed external binary?

<!-- gh-comment-id:541017897 --> @BlackDex commented on GitHub (Oct 11, 2019): That could be a nice option to write a wiki about. A cron docker, which does the backups, and moves that backup file to some other volume maybe. But i agree, adding cron features to bitwarden it self is a bad idea. And isn't there a way to execute a command to sqlite via diesel now? Which eliminates the needed external binary?
Author
Owner

@mprasil commented on GitHub (Oct 11, 2019):

There is an option to do that we just need to wait until the version bubbles up in dependencies.

<!-- gh-comment-id:541020801 --> @mprasil commented on GitHub (Oct 11, 2019): There is an option to do that we just need to [wait until the version bubbles up in dependencies](https://github.com/dani-garcia/bitwarden_rs/issues/596#issuecomment-536491833).
Author
Owner

@mprasil commented on GitHub (Oct 11, 2019):

There's nice 3rd party image that people can use for backups. We link it from our wiki. I think this is the best option and it doesn't even use the API call. I suppose that's what @Haxy89 was using so far?

<!-- gh-comment-id:541022240 --> @mprasil commented on GitHub (Oct 11, 2019): There's nice [3rd party image](https://gitlab.com/1O/bitwarden_rs-backup) that people can use for backups. We link it from our [wiki](https://github.com/dani-garcia/bitwarden_rs/wiki/Backing-up-your-vault). I think this is the best option and it doesn't even use the API call. I suppose that's what @Haxy89 was using so far?
Author
Owner

@ghost commented on GitHub (Oct 11, 2019):

Yes, i was using this image but saw this „great” build in new option to do backups thinking it is doing the same

<!-- gh-comment-id:541022839 --> @ghost commented on GitHub (Oct 11, 2019): Yes, i was using this image but saw this „great” build in new option to do backups thinking it is doing the same
Author
Owner

@mprasil commented on GitHub (Oct 14, 2019):

I'm going to close this as it's unlikely that we integrate cron inside the image or bitwarden_rs itself. I think the way you do it now is good easy and automated option.

<!-- gh-comment-id:541555023 --> @mprasil commented on GitHub (Oct 14, 2019): I'm going to close this as it's unlikely that we integrate cron inside the image or bitwarden_rs itself. I think the way you do it now is good easy and automated option.
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#441
No description provided.