Reorganized build instructions

pull/68/head
Daniel García 6 years ago
parent c5dd1a03be
commit b1d1926249

@ -1,25 +1,22 @@
## How to compile bitwarden_rs ## Manual Setup (Advanced)
Install `rust nightly`, in Windows the recommended way is through `rustup`. ### Dependencies
- `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/))
Install the `openssl` library, in Windows the best option is Microsoft's `vcpkg`,
on other systems use their respective package managers.
Then run: ## Run/Compile
```sh ```sh
# Compile and run
cargo run cargo run
# or # or just compile (binary located in target/release/bitwarden_rs)
cargo build cargo build --release
``` ```
## How to install the web-vault locally When run, the server is accessible in [http://localhost:80](http://localhost:80).
If you're using docker image, you can just update `VAULT_VERSION` variable in Dockerfile and rebuild the image.
Install `node.js` and either `yarn` or `npm` (usually included with node) ### Install the web-vault
Download the latest official release from the [releases page](https://github.com/bitwarden/web/releases) and extract it.
Clone the web-vault outside the project:
```
git clone https://github.com/bitwarden/web.git web-vault
```
Modify `web-vault/settings.Production.json` to look like this: Modify `web-vault/settings.Production.json` to look like this:
```json ```json
@ -34,23 +31,23 @@ Modify `web-vault/settings.Production.json` to look like this:
} }
``` ```
Then, run the following from the `web-vault` dir: Then, run the following from the `web-vault` directory:
```sh ```sh
# With yarn (recommended)
yarn
yarn gulp dist:selfHosted
# With npm
npm install npm install
npx gulp dist:selfHosted npx gulp dist:selfHosted
``` ```
Finally copy the contents of the `web-vault/dist` folder into the `bitwarden_rs/web-vault` folder. Finally copy the contents of the `web-vault/dist` folder into the `bitwarden_rs/web-vault` folder.
## How to recreate database schemas # 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)
Install diesel-cli with cargo: Install diesel-cli with cargo:
```sh ```sh
cargo install diesel_cli --no-default-features --features sqlite-bundled # Or use only sqlite to use the system version cargo install diesel_cli --no-default-features --features sqlite-bundled
``` ```
Make sure that the correct path to the database is in the `.env` file. Make sure that the correct path to the database is in the `.env` file.
@ -63,7 +60,9 @@ diesel migration generate <name>
Modify the *.sql files, making sure that any changes are reverted in the down.sql file. 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: Apply the migrations and save the generated schemas as follows:
``` ```sh
diesel migration redo diesel migration redo
diesel print-schema > src/db/schema.rs
# This step should be done automatically when using diesel-cli > 1.3.0
# diesel print-schema > src/db/schema.rs
``` ```
Loading…
Cancel
Save