0
0
Fork 0
mirror of https://github.com/dani-garcia/vaultwarden synced 2024-12-15 01:53:43 +01:00
bitwarden_rs/BUILD.md

70 lines
2.2 KiB
Markdown
Raw Normal View History

2018-07-13 11:48:49 +02:00
# Build instructions
## Dependencies
2018-07-09 15:09:30 +02:00
- `Rust nightly` (strongly recommended to use [rustup](https://rustup.rs/))
- `OpenSSL` (should be available in path, install through your system's package manager or use the [prebuilt binaries](https://wiki.openssl.org/index.php/Binaries))
- `NodeJS` (required to build the web-vault, (install through your system's package manager or use the [prebuilt binaries](https://nodejs.org/en/download/))
2018-05-25 17:15:31 +02:00
2018-07-09 15:09:30 +02:00
## Run/Compile
2018-05-25 17:15:31 +02:00
```sh
2018-07-09 15:09:30 +02:00
# Compile and run
2018-05-25 17:15:31 +02:00
cargo run
2018-07-09 15:09:30 +02:00
# or just compile (binary located in target/release/bitwarden_rs)
cargo build --release
2018-05-25 17:15:31 +02:00
```
2018-07-09 15:09:30 +02:00
When run, the server is accessible in [http://localhost:80](http://localhost:80).
2018-05-25 17:15:31 +02:00
2018-07-09 15:09:30 +02:00
### Install the web-vault
Download the latest official release from the [releases page](https://github.com/bitwarden/web/releases) and extract it.
2018-05-25 17:15:31 +02:00
Modify `web-vault/settings.Production.json` to look like this:
```json
{
"appSettings": {
"apiUri": "/api",
"identityUri": "/identity",
"iconsUri": "/icons",
"stripeKey": "",
"braintreeKey": ""
}
}
```
2018-07-09 15:09:30 +02:00
Then, run the following from the `web-vault` directory:
2018-05-25 17:15:31 +02:00
```sh
npm install
npx gulp dist:selfHosted
```
Finally copy the contents of the `web-vault/dist` folder into the `bitwarden_rs/web-vault` folder.
2018-07-09 15:09:30 +02:00
# 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. Look at the README file for the main configuration options available.
Note: the environment variables override the values set in the `.env` file.
## How to recreate database schemas (for developers)
2018-05-25 17:15:31 +02:00
Install diesel-cli with cargo:
```sh
2018-07-09 15:09:30 +02:00
cargo install diesel_cli --no-default-features --features sqlite-bundled
2018-05-25 17:15:31 +02:00
```
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:
2018-07-09 15:09:30 +02:00
```sh
2018-05-25 17:15:31 +02:00
diesel migration redo
2018-07-09 15:09:30 +02:00
# This step should be done automatically when using diesel-cli > 1.3.0
# diesel print-schema > src/db/schema.rs
```