Skip to content

Commit

Permalink
Merge pull request #68 from BlackDex/update-vault-and-scripts
Browse files Browse the repository at this point in the history
Update web-vault to v2022.05.0 and misc changes
  • Loading branch information
dani-garcia authored Jun 4, 2022
2 parents 7be49c3 + 6529f1d commit 9121922
Show file tree
Hide file tree
Showing 16 changed files with 605 additions and 80 deletions.
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
# Local build artifacts
builds
docker_builds
web-vault

# Documentation
*.md
*.txt

# Other
.github
Makefile
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
echo "set-output name=DOCKER_TAG::testing"
echo "::set-output name=DOCKER_TAG::testing"
fi
- name: Build and push
uses: docker/build-push-action@a66e35b9cbcf4ad0ea91ffcaf7bbad63ad9e0229 # v2.7.0
with:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
builds/
docker_builds/
web-vault/

*.tar.gz
Expand Down
14 changes: 7 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,27 @@
# docker rm $image_id

FROM node:16-bullseye as build
RUN node -v && npm -v
RUN node --version && npm --version

# Prepare the folder to enable non-root, otherwise npm will refuse to run the postinstall
RUN mkdir /vault
RUN chown node:node /vault
USER node

# Can be a tag, release, but prefer a commit hash because it's not changeable
# https://github.com/bitwarden/web/commit/$VAULT_VERSION
# https://github.com/bitwarden/web/commit/${VAULT_VERSION}
#
# Using https://github.com/bitwarden/web/releases/tag/v2.28.1
ARG VAULT_VERSION=78a7181fe5afa677220d69c6ebb2d6c0a5b83729
# Using https://github.com/bitwarden/web/releases/tag/2022.05.0
ARG VAULT_VERSION=ec80782d8f2ec593adf4f2d874fc8b97783c9d33

RUN git clone https://github.com/bitwarden/web.git /vault
WORKDIR /vault

RUN git checkout "$VAULT_VERSION" && \
git submodule update --recursive --init
RUN git -c advice.detachedHead=false checkout "${VAULT_VERSION}" && \
git submodule update --recursive --init --force

COPY --chown=node:node patches /patches
COPY --chown=node:node apply_patches.sh /apply_patches.sh
COPY --chown=node:node scripts/apply_patches.sh /apply_patches.sh

RUN bash /apply_patches.sh

Expand Down
51 changes: 51 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
SHELL := bash
.ONESHELL:
.SHELLFLAGS := -eu -o pipefail -c
.DELETE_ON_ERROR:

help:
@echo "Use either: clean, checkout, build, patch-web-vault, generate-patch, tar, or full"
@echo "Or for docker builds use: docker or docker-extract"
.PHONY: help

clean:
rm -rvf "./web-vault"
rm -rvf "./builds"
rm -rvf "./docker_builds"
.PHONY: clean

checkout:
./scripts/checkout_web_vault.sh
.PHONY: checkout

patch-web-vault:
./scripts/patch_web_vault.sh
.PHONY: patch-web-vault

generate-patch:
./scripts/generate_patch_file.sh
.PHONY: generate-patch

build:
./scripts/build_web_vault.sh
.PHONY: checkout

tar:
./scripts/tar_web_vault.sh
.PHONY: tar

full: checkout patch-web-vault build tar
.PHONY: full

docker:
docker build -t bw_web_vault .
.PHONY: docker

docker-extract: docker
@docker rm bw_web_vault_extract || true
@docker create --name bw_web_vault_extract bw_web_vault
@mkdir -vp docker_builds
@docker cp bw_web_vault_extract:/bw_web_vault.tar.gz ./docker_builds/bw_web_vault.tar.gz
@docker cp bw_web_vault_extract:/web-vault ./docker_builds/web-vault
@docker rm bw_web_vault_extract || true
.PHONY: docker-extract
40 changes: 38 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,54 @@
[![GPL-3.0 Licensed](https://img.shields.io/github/license/dani-garcia/bw_web_builds.svg)](https://github.com/dani-garcia/bw_web_builds/blob/master/LICENSE.txt)
[![Matrix Chat](https://img.shields.io/matrix/vaultwarden:matrix.org.svg?logo=matrix)](https://matrix.to/#/#vaultwarden:matrix.org)

**This project is not associated with the [Bitwarden](https://bitwarden.com/) project nor 8bit Solutions LLC.**

#### ⚠️**IMPORTANT**⚠️: When using this server, please report any bugs or suggestions to us directly (look at the bottom of this page for ways to get in touch), regardless of whatever clients you are using (mobile, desktop, browser...). DO NOT use the official support channels.

---

<br>

This is a repository to store the builds of the [Bitwarden web vault](https://github.com/bitwarden/web) with the patches to make it work with [vaultwarden](https://github.com/dani-garcia/vaultwarden)

To create a patch you need to modify the original sources from [Bitwarden web vault](https://github.com/bitwarden/web) and execute:

```bash
git diff --submodule=diff
git --no-pager diff --submodule=diff --no-color --minimal
```

This is needed because there are patches within the jslib submodule which with a default `git diff` are not shown.

## Building the web-vault
To build the web-vault you need either node and npm installed or use Docker.

### Using node and npm
For a quick and easy local build you could run:
```bash
make full
```

That will generate a `tar.gz` file within the `builds` directory which you can extract and use with the `WEB_VAULT_FOLDER` environment variable.

### Using Docker
Or via the usage of Docker:
```bash
make docker-extract
```

That will extract the `tar.gz` and files generated via Docker into the `docker_builds` directory.

### More information
For more information see: [Install the web-vault](https://github.com/dani-garcia/vaultwarden/wiki/Building-binary#install-the-web-vault)

### Pre-build
The builds are available in the [releases page](https://github.com/dani-garcia/bw_web_builds/releases), and can be replicated with the scripts in this repo.

_*Note, that this project is not associated with the [Bitwarden](https://bitwarden.com/) project nor 8bit Solutions LLC._
<br>

## Get in touch
To ask a question, offer suggestions or new features or to get help configuring or installing the software, please [use the forum](https://vaultwarden.discourse.group/).

If you spot any bugs or crashes with vaultwarden itself, please [create an issue](https://github.com/dani-garcia/vaultwarden/issues/). Make sure there aren't any similar issues open, though!

If you prefer to chat, we're usually hanging around at [#vaultwarden:matrix.org](https://matrix.to/#/#vaultwarden:matrix.org) room on Matrix. Feel free to join us!
63 changes: 0 additions & 63 deletions package_web_vault.sh

This file was deleted.

1 change: 1 addition & 0 deletions package_web_vault.sh
Loading

0 comments on commit 9121922

Please sign in to comment.