Server: How to restore from backup?

Created on 4 Oct 2018  路  16Comments  路  Source: bitwarden/server

How to restore from backup?
I have backuped the folders:

attachments
mssql
env

What is to do on the new system?
Just copie and replace the folders and restart bitwarden did not work for me.

Thanks in advance.

Most helpful comment

Okay, thanks for the feedback. I have reinstalled in between without backup and imported the user data manually...
Next time (hopefully there is no such thing) I will try it.
In general I find that such an important topic as Backup and Restore is unfortunately not described enough in the documentation.

All 16 comments

Just copie and replace the folders and restart bitwarden did not work for me.

Why didn't it work? What are the errors?

If i try to login it takes very long and ends with an error:

An error has occurred.
An unexpected error has occurred.

What are the server errors?

The nginx error.log from /bwdata/logs/nginx shows this:

2018/10/04 14:23:01 [error] 29#29: *115 connect() failed (113: No route to host) while connecting to upstream, client: 192.168.178.15, server: my.domain.tld, request: "POST /identity/connect/token HTTP/1.0", upstream: "http://172.22.0.4:5000/connect/token", host: "my.domain.tld", referrer: "https://my.domain.tld/"

Any ideas?

Would need more information from the server logs. The error log you provided doesn't really give any clues. Look at the identity container logs.

Under /bwdata/logs/identity/Identity there is only one file 20181004.txt with one sing line:

2018-10-04 07:36:36.225 +00:00 [Information] Validating premium license for user bb345be6-74b8-4fa2-8fa1-a96d00f27790("my@domai n.de").

Or do you mean another log?

What about api container?

This is the API Log from today:

2018-10-05 00:00:00.010 +00:00 [Information] It's alive!
2018-10-05 00:00:00.011 +00:00 [Information] Finished job "AliveJob" at 10/05/2018 00:00:00.
2018-10-05 00:00:00.014 +00:00 [Information] Starting job "ValidateUsersJob" at 10/05/2018 00:00:00.
2018-10-05 00:00:00.444 +00:00 [Information] Validating premium for 0 users.
2018-10-05 00:00:00.448 +00:00 [Information] Checking to restore premium for 2 users.
2018-10-05 00:00:00.454 +00:00 [Information] Finished job "ValidateUsersJob" at 10/05/2018 00:00:00.
2018-10-05 00:30:00.003 +00:00 [Information] Starting job "ValidateOrganizationsJob" at 10/05/2018 00:30:00.
2018-10-05 00:30:01.365 +00:00 [Information] Validating licenses for 0 organizations.
2018-10-05 00:30:01.370 +00:00 [Information] Finished job "ValidateOrganizationsJob" at 10/05/2018 00:30:01.
2018-10-05 01:00:00.003 +00:00 [Information] Starting job "AliveJob" at 10/05/2018 01:00:00.
2018-10-05 01:00:00.004 +00:00 [Information] It's alive!
2018-10-05 01:00:00.004 +00:00 [Information] Finished job "AliveJob" at 10/05/2018 01:00:00.
2018-10-05 02:00:00.002 +00:00 [Information] Starting job "AliveJob" at 10/05/2018 02:00:00.
2018-10-05 02:00:00.002 +00:00 [Information] It's alive!
2018-10-05 02:00:00.002 +00:00 [Information] Finished job "AliveJob" at 10/05/2018 02:00:00.
2018-10-05 03:00:00.002 +00:00 [Information] Starting job "AliveJob" at 10/05/2018 03:00:00.
2018-10-05 03:00:00.002 +00:00 [Information] It's alive!
2018-10-05 03:00:00.002 +00:00 [Information] Finished job "AliveJob" at 10/05/2018 03:00:00.
2018-10-05 04:00:00.002 +00:00 [Information] Starting job "AliveJob" at 10/05/2018 04:00:00.
2018-10-05 04:00:00.002 +00:00 [Information] It's alive!
2018-10-05 04:00:00.002 +00:00 [Information] Finished job "AliveJob" at 10/05/2018 04:00:00.
2018-10-05 05:00:00.091 +00:00 [Information] Starting job "AliveJob" at 10/05/2018 05:00:00.
2018-10-05 05:00:00.290 +00:00 [Information] It's alive!
2018-10-05 05:00:00.290 +00:00 [Information] Finished job "AliveJob" at 10/05/2018 05:00:00.
2018-10-05 06:00:00.001 +00:00 [Information] Starting job "AliveJob" at 10/05/2018 06:00:00.
2018-10-05 06:00:00.002 +00:00 [Information] It's alive!
2018-10-05 06:00:00.002 +00:00 [Information] Finished job "AliveJob" at 10/05/2018 06:00:00.
2018-10-05 06:00:00.007 +00:00 [Information] Starting job "ValidateUsersJob" at 10/05/2018 06:00:00.
2018-10-05 06:00:00.348 +00:00 [Information] Validating premium for 0 users.
2018-10-05 06:00:00.354 +00:00 [Information] Checking to restore premium for 2 users.
2018-10-05 06:00:00.362 +00:00 [Information] Finished job "ValidateUsersJob" at 10/05/2018 06:00:00.
2018-10-05 07:00:00.003 +00:00 [Information] Starting job "AliveJob" at 10/05/2018 07:00:00.
2018-10-05 07:00:00.004 +00:00 [Information] It's alive!
2018-10-05 07:00:00.005 +00:00 [Information] Finished job "AliveJob" at 10/05/2018 07:00:00.
2018-10-05 08:00:00.002 +00:00 [Information] Starting job "AliveJob" at 10/05/2018 08:00:00.
2018-10-05 08:00:00.002 +00:00 [Information] It's alive!
2018-10-05 08:00:00.002 +00:00 [Information] Finished job "AliveJob" at 10/05/2018 08:00:00.
2018-10-05 09:00:00.003 +00:00 [Information] Starting job "AliveJob" at 10/05/2018 09:00:00.
2018-10-05 09:00:00.004 +00:00 [Information] It's alive!
2018-10-05 09:00:00.004 +00:00 [Information] Finished job "AliveJob" at 10/05/2018 09:00:00.
2018-10-05 10:00:00.004 +00:00 [Information] Starting job "AliveJob" at 10/05/2018 10:00:00.
2018-10-05 10:00:00.005 +00:00 [Information] It's alive!
2018-10-05 10:00:00.006 +00:00 [Information] Finished job "AliveJob" at 10/05/2018 10:00:00.
2018-10-05 11:00:00.002 +00:00 [Information] Starting job "AliveJob" at 10/05/2018 11:00:00.
2018-10-05 11:00:00.020 +00:00 [Information] It's alive!
2018-10-05 11:00:00.020 +00:00 [Information] Finished job "AliveJob" at 10/05/2018 11:00:00.
2018-10-05 12:00:00.004 +00:00 [Information] Starting job "AliveJob" at 10/05/2018 12:00:00.
2018-10-05 12:00:00.005 +00:00 [Information] It's alive!
2018-10-05 12:00:00.006 +00:00 [Information] Finished job "AliveJob" at 10/05/2018 12:00:00.
2018-10-05 12:00:00.009 +00:00 [Information] Starting job "ValidateUsersJob" at 10/05/2018 12:00:00.
2018-10-05 12:00:00.342 +00:00 [Information] Validating premium for 0 users.
2018-10-05 12:00:00.350 +00:00 [Information] Checking to restore premium for 2 users.
2018-10-05 12:00:00.358 +00:00 [Information] Finished job "ValidateUsersJob" at 10/05/2018 12:00:00.
2018-10-05 12:30:00.005 +00:00 [Information] Starting job "ValidateOrganizationsJob" at 10/05/2018 12:30:00.
2018-10-05 12:30:00.325 +00:00 [Information] Validating licenses for 0 organizations.
2018-10-05 12:30:00.326 +00:00 [Information] Finished job "ValidateOrganizationsJob" at 10/05/2018 12:30:00.
2018-10-05 13:00:00.002 +00:00 [Information] Starting job "AliveJob" at 10/05/2018 13:00:00.
2018-10-05 13:00:00.003 +00:00 [Information] It's alive!
2018-10-05 13:00:00.004 +00:00 [Information] Finished job "AliveJob" at 10/05/2018 13:00:00.

Did you try to log in or so something that would generate an error?

yes

Nothing i can do?

Not sure. With the information provided I do not see the issue.

I had a similar problem with the restore (I use docker).
Maybe it helps if you do the install with the previous installation id and key (you found both (globalSettings__installation__id & globalSettings__installation__key) in your backupfolder/env/global.override.env)

Okay, thanks for the feedback. I have reinstalled in between without backup and imported the user data manually...
Next time (hopefully there is no such thing) I will try it.
In general I find that such an important topic as Backup and Restore is unfortunately not described enough in the documentation.

Restoring bwdata isn't sufficient to restore the vault database, at least when database_docker_volume: true which is the default configuration. The live database is stored on the docker_mssql_data Docker volume. On my mac, I see

$ docker volume inspect docker_mssql_data
[
    {
        "CreatedAt": "2019-06-03T05:41:16Z",
        "Driver": "local",
        "Labels": {
            "com.docker.compose.project": "docker",
            "com.docker.compose.version": "1.23.2",
            "com.docker.compose.volume": "mssql_data"
        },
        "Mountpoint": "/var/lib/docker/volumes/docker_mssql_data/_data",
        "Name": "docker_mssql_data",
        "Options": null,
        "Scope": "local"
    }
]

but /var/lib/docker/ is relative to the vm, not the mac filesystem. In any case, to backup/restore one can create a temporary container with the volume docker_mssql_data bind-mounted:

$ ./bitwarden.sh stop

# backup
$ docker run --rm -v docker_mssql_data:/mssql_data -v $(pwd)/bwdata/mssql/:/host alpine sh -c 'tar czvf /host/docker_mssql_data.tgz -C /mssql_data .'

# simulate data loss
$ docker volume rm docker_mssql_data
$ docker volume create docker_mssql_data

# restore
$ docker run --rm -v docker_mssql_data:/mssql_data -v $(pwd)/bwdata/mssql/:/host alpine sh -c 'tar xzvf /host/docker_mssql_data.tgz -C /mssql_data'

$ ./bitwarden.sh start
Was this page helpful?
0 / 5 - 0 ratings