Skip to content
Stephan Tietz edited this page Oct 23, 2019 · 36 revisions

Dependencies

  • Rust nightly (strongly recommended to use rustup)
  • OpenSSL (should be available in path, install through your system's package manager or use the prebuilt binaries)
    For Debian, you'll need to install pkg-config and libssl-dev
  • NodeJS (only when compiling the web-vault, install through your system's package manager or use the prebuilt binaries)
  • For MySQL backend on Debian (Buster), you'll need to install libmariadb-dev-compat and libmariadb-dev

Run/Compile

SQlite backend

# Compile with sqlite backend and run
cargo run --features sqlite --release
# or just compile with sqlite (binary located in target/release/bitwarden_rs)
cargo build --features sqlite --release

MySQL backend

# Compile with mysql backend and run
cargo run --features mysql --release
# or just compile with mysql (binary located in target/release/bitwarden_rs)
cargo build --features mysql --release

When run, the server is accessible in http://localhost:8000.

Install the web-vault

A compiled version of the web vault can be downloaded from dani-garcia/bw_web_builds.

If you prefer to compile it manually, follow these steps:

Note: building the Vault needs ~1.5GB of RAM. On systems like a RaspberryPI with 1GB or less, please enable swapping or build it on a more powerful machine and copy the directory from there. This much memory is only needed for building it, running bitwarden_rs with vault needs only about 10MB of RAM.

  • Clone the git repository at bitwarden/web and checkout the latest release tag (e.g. v2.1.1):
# clone the repository
git clone https://github.com/bitwarden/web.git web-vault
cd web-vault
# switch to the latest tag
git checkout "$(git tag | tail -n1)"
  • Download the patch file from dani-garcia/bw_web_builds and copy it to the web-vault folder. To choose the version to use, assuming the web vault is version vX.Y.Z:
    • If there is a patch with version vX.Y.Z, use that one
    • Otherwise, pick the one with the largest version that is still smaller than vX.Y.Z
  • Apply the patch
# In the 'web-vault' directory
git apply vX.Y.Z.patch
  • Then, build the Vault:
npm run sub:init
npm install
npm run dist

Finally copy the contents of the build folder into the destination folder:

  • If you run with cargo run --release, it's bitwarden_rs/web-vault.
  • If you run the compiled binary directly, it's next to the binary, in bitwarden_rs/target/release/web-vault.

Configuration

The available configuration options are documented in the default .env file, and they can be modified by uncommenting the desired options in that file or by setting their respective environment variables. See the Configuration section of this wiki for the main configuration options available.

Note: the environment variables override the values set in the .env file.

How to recreate database schemas for the sqlite backend (for developers)

Install diesel-cli with cargo:

cargo install diesel_cli --no-default-features --features sqlite-bundled

Make sure that the correct path to the database is in the .env file.

If you want to modify the schemas, create a new migration with:

diesel migration generate <name>

Modify the *.sql files, making sure that any changes are reverted in the down.sql file.

Apply the migrations and save the generated schemas as follows:

diesel migration redo

# This step should be done automatically when using diesel-cli > 1.3.0
# diesel print-schema > src/db/sqlite/schema.rs
Clone this wiki locally