Skip to content

Commit 819327c

Browse files
committed
Initial commit
0 parents  commit 819327c

File tree

10 files changed

+153
-0
lines changed

10 files changed

+153
-0
lines changed

.env

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
NGINX_PORT=80
2+
VIRTUAL_HOST=vaultwarden.wsl
3+
4+
ROOT_PATH=.
5+
6+
WEBSOCKET_ENABLED=true
7+
SIGNUPS_ALLOWED=true
8+
ADMIN_TOKEN=admin123

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/.idea/*
2+
/Data/Vaultwarden/*
3+
/Data/Vaultwarden-Backup/*
4+
5+
!/Data/Vaultwarden/.gitkeep
6+
!/Data/Vaultwarden-Backup/.gitkeep

Data/Vaultwarden-Backup/.gitkeep

Whitespace-only changes.

Data/Vaultwarden/.gitkeep

Whitespace-only changes.

Docker/nginx/Dockerfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
FROM nginx:1.21.4-alpine
2+
3+
ADD default.conf.template /default.conf.template
4+
ADD run_nginx.sh /run_nginx.sh
5+
6+
RUN chmod +x /run_nginx.sh

Docker/nginx/default.conf.template

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
server {
2+
listen ${NGINX_PORT};
3+
server_name localhost;
4+
5+
client_body_temp_path /tmp/nginx;
6+
client_max_body_size 128M;
7+
8+
location / {
9+
proxy_pass http://vaultwarden;
10+
proxy_set_header Host $host;
11+
proxy_set_header X-Real-IP $remote_addr;
12+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
13+
proxy_set_header X-Forwarded-Proto $scheme;
14+
}
15+
16+
location /notifications/hub {
17+
proxy_pass http://vaultwarden:3012;
18+
proxy_set_header Upgrade $http_upgrade;
19+
proxy_set_header Connection "upgrade";
20+
}
21+
22+
location /notifications/hub/negotiate {
23+
proxy_pass http://vaultwarden:80;
24+
}
25+
}

Docker/nginx/run_nginx.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/sh
2+
3+
set -e
4+
set -u
5+
6+
envsubst '${NGINX_PORT}' < /default.conf.template > /etc/nginx/conf.d/default.conf
7+
8+
nginx -g "daemon off;"

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2021 Enes Erk
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# vaultwarden-server
2+
3+
This repository helps to host your own [vaultwarden](https://github.com/dani-garcia/vaultwarden) instance on your server or a raspberry-pi.
4+
5+
## Usage
6+
7+
Edit your settings in the `.env` file.
8+
9+
Start the containers with
10+
11+
```shell
12+
docker-compose up -d --build nginx
13+
```
14+
15+
:warning: You have to install a custom [nginx-proxy](https://github.com/erkenes/nginx-proxy) as well.
16+
17+
## Settings
18+
19+
In the docker-compose.yml file the admin-token is disabled. If this setting is disabled you are not able to open the admin page (`yourhost.local/admin`).

docker-compose.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
version: '3.5'
2+
3+
services:
4+
vaultwarden:
5+
image: vaultwarden/server:latest #swap tag to raspberry to run on a raspberry pi
6+
container_name: vaultwarden
7+
expose:
8+
- "80"
9+
- "3012"
10+
volumes:
11+
- ${ROOT_PATH}/Data/Vaultwarden:/data
12+
restart: on-failure
13+
environment:
14+
WEBSOCKET_ENABLED: ${WEBSOCKET_ENABLED}
15+
SIGNUPS_ALLOWED: ${SIGNUPS_ALLOWED}
16+
# ADMIN_TOKEN: ${ADMIN_TOKEN}
17+
networks:
18+
- "vaultwarden"
19+
20+
nginx:
21+
build: './Docker/nginx'
22+
container_name: nginx
23+
links:
24+
- "vaultwarden"
25+
- "vw_backup"
26+
environment:
27+
NGINX_PORT: "${NGINX_PORT}"
28+
VIRTUAL_HOST: "${VIRTUAL_HOST}"
29+
command: /bin/sh -c "/run_nginx.sh"
30+
restart: on-failure
31+
networks:
32+
- "vaultwarden"
33+
- "nginx-proxy"
34+
35+
vw_backup:
36+
image: bruceforce/bw_backup:latest #swap tag to rpi3 to run on a raspberry pi
37+
container_name: vw_backup
38+
restart: on-failure
39+
depends_on:
40+
- vaultwarden
41+
volumes:
42+
- ${ROOT_PATH}/Data/Vaultwarden:/data
43+
- ${ROOT_PATH}/Data/Vaultwarden-Backup:/backup
44+
- /etc/timezone:/etc/timezone:ro
45+
- /etc/localtime:/etc/localtime:ro
46+
environment:
47+
- DB_FILE=/data/db.sqlite3
48+
- BACKUP_FILE=/backup/backup.sqlite3
49+
- BACKUP_FILE_PERMISSIONS=700
50+
- CRON_TIME=0 1 * * *
51+
- TIMESTAMP=false
52+
- UID=0
53+
- GID=0
54+
55+
networks:
56+
nginx-proxy:
57+
external: true
58+
name: "nginx-proxy"
59+
vaultwarden:
60+
driver: bridge

0 commit comments

Comments
 (0)