2018-02-10 00:00:55 +00:00
|
|
|
## Easy setup (Docker)
|
|
|
|
Install Docker to your system and then, from the project root, run:
|
2018-05-07 19:33:54 +00:00
|
|
|
```sh
|
2018-02-10 00:00:55 +00:00
|
|
|
# Build the docker image:
|
|
|
|
docker build -t dani/bitwarden_rs .
|
|
|
|
|
|
|
|
# Run the docker image with a docker volume:
|
|
|
|
docker volume create bw_data
|
2018-02-17 00:13:02 +00:00
|
|
|
docker run --name bitwarden_rs -t --init --rm --mount source=bw_data,target=/data -p 8000:80 dani/bitwarden_rs
|
|
|
|
```
|
|
|
|
|
|
|
|
#### Other possible Docker options
|
|
|
|
|
|
|
|
To run the container in the background, add the `-d` parameter.
|
|
|
|
|
|
|
|
To check the logs when in background, run `docker logs bitwarden_rs`
|
|
|
|
|
|
|
|
To stop the container in background, run `docker stop bitwarden_rs`
|
2018-02-10 00:00:55 +00:00
|
|
|
|
2018-02-17 00:13:02 +00:00
|
|
|
To make sure the container is restarted automatically, add the `--restart unless-stopped` parameter
|
|
|
|
|
|
|
|
To run the image with a host bind, change the `--mount` parameter to:
|
|
|
|
```
|
|
|
|
--mount type=bind,source=<absolute_path>,target=/data
|
2018-02-10 00:00:55 +00:00
|
|
|
```
|
2018-02-17 00:13:02 +00:00
|
|
|
Where <absolute_path> is an absolute path in the hosts file system (e.g. C:\bitwarden\data)
|
|
|
|
|
2018-02-10 00:00:55 +00:00
|
|
|
|
|
|
|
## How to compile bitwarden_rs
|
|
|
|
Install `rust nightly`, in Windows the recommended way is through `rustup`.
|
|
|
|
|
2018-05-07 19:33:54 +00:00
|
|
|
Install the `openssl` library, in Windows the best option is Microsoft's `vcpkg`,
|
2018-02-10 00:00:55 +00:00
|
|
|
on other systems use their respective package managers.
|
|
|
|
|
|
|
|
Then run:
|
2018-05-07 19:33:54 +00:00
|
|
|
```sh
|
2018-04-24 18:53:12 +00:00
|
|
|
cargo run
|
2018-02-10 00:00:55 +00:00
|
|
|
# or
|
|
|
|
cargo build
|
|
|
|
```
|
|
|
|
|
2018-04-24 20:38:23 +00:00
|
|
|
## How to install the web-vault locally
|
2018-04-18 11:44:28 +00:00
|
|
|
If you're using docker image, you can just update `VAULT_VERSION` variable in Dockerfile and rebuild the image.
|
|
|
|
|
2018-02-10 00:00:55 +00:00
|
|
|
Install `node.js` and either `yarn` or `npm` (usually included with node)
|
2018-02-17 00:13:02 +00:00
|
|
|
|
2018-02-10 00:00:55 +00:00
|
|
|
Clone the web-vault outside the project:
|
|
|
|
```
|
|
|
|
git clone https://github.com/bitwarden/web.git web-vault
|
|
|
|
```
|
|
|
|
|
2018-02-17 17:48:42 +00:00
|
|
|
Modify `web-vault/settings.Production.json` to look like this:
|
2018-02-10 00:00:55 +00:00
|
|
|
```json
|
|
|
|
{
|
|
|
|
"appSettings": {
|
|
|
|
"apiUri": "/api",
|
|
|
|
"identityUri": "/identity",
|
|
|
|
"iconsUri": "/icons",
|
|
|
|
"stripeKey": "",
|
|
|
|
"braintreeKey": ""
|
|
|
|
}
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
Then, run the following from the `web-vault` dir:
|
2018-05-07 19:33:54 +00:00
|
|
|
```sh
|
2018-02-10 00:00:55 +00:00
|
|
|
# With yarn (recommended)
|
|
|
|
yarn
|
|
|
|
yarn gulp dist:selfHosted
|
|
|
|
|
|
|
|
# With npm
|
|
|
|
npm install
|
|
|
|
npx gulp dist:selfHosted
|
|
|
|
```
|
|
|
|
|
|
|
|
Finally copy the contents of the `web-vault/dist` folder into the `bitwarden_rs/web-vault` folder.
|
|
|
|
|
|
|
|
## How to recreate database schemas
|
|
|
|
Install diesel-cli with cargo:
|
2018-05-07 19:33:54 +00:00
|
|
|
```sh
|
2018-06-12 15:24:29 +00:00
|
|
|
cargo install diesel_cli --no-default-features --features sqlite-bundled
|
2018-02-10 00:00:55 +00: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>
|
|
|
|
```
|
|
|
|
|
2018-02-17 00:13:02 +00:00
|
|
|
Modify the *.sql files, making sure that any changes are reverted in the down.sql file.
|
2018-02-10 00:00:55 +00:00
|
|
|
|
|
|
|
Apply the migrations and save the generated schemas as follows:
|
2018-06-12 15:24:29 +00:00
|
|
|
```sh
|
2018-02-10 00:00:55 +00:00
|
|
|
diesel migration redo
|
2018-06-12 15:24:29 +00:00
|
|
|
|
|
|
|
# This step should be done automatically when using diesel-cli > 1.3.0
|
|
|
|
# diesel print-schema > src/db/schema.rs
|
2018-02-10 00:00:55 +00:00
|
|
|
```
|