diff --git a/Changing-persistent-data-location.md b/Changing-persistent-data-location.md new file mode 100644 index 0000000..5df72ae --- /dev/null +++ b/Changing-persistent-data-location.md @@ -0,0 +1,58 @@ +## /data prefix: + +By default all persistent data is saved under `/data`, you can override this path by setting the `DATA_FOLDER` env variable: + +```sh +docker run -d --name bitwarden \ + -e DATA_FOLDER=/persistent \ + -v /bw-data/:/persistent/ \ + -p 80:80 \ + mprasil/bitwarden:latest +``` + +Notice, that you need to adapt your volume mount accordingly. + +## database name and location + +Default is `$DATA_FOLDER/db.sqlite3`, you can change the path specifically for database using `DATABASE_URL` variable: + +```sh +docker run -d --name bitwarden \ + -e DATABASE_URL=/database/bitwarden.sqlite3 \ + -v /bw-data/:/data/ \ + -v /bw-database/:/database/ \ + -p 80:80 \ + mprasil/bitwarden:latest +``` + +Note, that you need to remember to mount the volume for both database and other persistent data if they are different. + +## attachments location + +Default is `$DATA_FOLDER/attachments`, you can change the path using `ATTACHMENTS_FOLDER` variable: + +```sh +docker run -d --name bitwarden \ + -e ATTACHMENTS_FOLDER=/attachments \ + -v /bw-data/:/data/ \ + -v /bw-attachments/:/attachments/ \ + -p 80:80 \ + mprasil/bitwarden:latest +``` + +Note, that you need to remember to mount the volume for both attachments and other persistent data if they are different. + +## icons cache + +Default is `$DATA_FOLDER/icon_cache`, you can change the path using `ICON_CACHE_FOLDER` variable: + +```sh +docker run -d --name bitwarden \ + -e ICON_CACHE_FOLDER=/icon_cache \ + -v /bw-data/:/data/ \ + -v /icon_cache/ \ + -p 80:80 \ + mprasil/bitwarden:latest +``` + +Note, that in the above example we don't mount the volume locally, which means it won't be persisted during the upgrade unless you use intermediate data container using `--volumes-from`. This will impact performance as bitwarden will have to re-download the icons on restart, but might save you from having stale icons in cache as they are not automatically cleaned. \ No newline at end of file