forked from dadatuputi/bitwarden_gcloud
-
Notifications
You must be signed in to change notification settings - Fork 1
/
docker-compose.yml
137 lines (131 loc) · 3.93 KB
/
docker-compose.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
version: "3"
services:
vaultwarden:
# Standard Bitwarden is very resource-heavy and cannot run on micro cloud instances
# Vaultwarden is a Rust (mostly) feature-complete implementation of Bitwarden
# https://github.com/dani-garcia/vaultwarden
image: vaultwarden/server:latest-alpine
restart: always
container_name: vaultwarden
depends_on:
- proxy
volumes:
- ${PWD}/vaultwarden:/data
- ${PWD}/utilities/backup.sh:/backup.sh:ro
environment:
- LOG_FILE=/data/vaultwarden.log
- WEBSOCKET_ENABLED=true # required for websockets
- SHOW_PASSWORD_HINT=false
- DOMAIN=https://${DOMAIN} # DOMAIN is set in .env but doesn't have protocol prefix
- SMTP_FROM_NAME=Vaultwarden (${DOMAIN})
- IP_HEADER=CF-Connecting-IP
- ADMIN_TOKEN # Value-less variables are set in .env
- SIGNUPS_ALLOWED
- SMTP_HOST
- SMTP_FROM
- SMTP_PORT
- SMTP_SECURITY
- SMTP_USERNAME
- SMTP_PASSWORD
- PUSH_ENABLED
- PUSH_INSTALLATION_ID
- PUSH_INSTALLATION_KEY
- YUBICO_CLIENT_ID
- YUBICO_SECRET_KEY
- YUBICO_SERVER
- ORG_CREATION_USERS
- BACKUP
- BACKUP_DAYS
- BACKUP_DIR
- BACKUP_EMAIL_FROM_NAME
- BACKUP_ENCRYPTION_KEY
- BACKUP_EMAIL_TO
- BACKUP_EMAIL_NOTIFY
- BACKUP_RCLONE_CONF
- BACKUP_RCLONE_DEST
networks:
- cloudflared
command: >
sh -c 'if [ -n "$BACKUP" ];
then
apk --update --no-cache add sqlite
ln -sf /proc/1/fd/1 /var/log/backup.log &&
sed -i "/ash \\/backup\\.sh /d" /etc/crontabs/root &&
echo "$BACKUP_SCHEDULE ash /backup.sh $BACKUP" >> /etc/crontabs/root &&
crond -d 8;
fi &&
exec /start.sh'
proxy:
# HAProxy to wrap all services and provide SSL if needed
image: haproxy:alpine
restart: always
container_name: proxy
volumes:
- ${PWD}/haproxy:/usr/local/etc/haproxy:ro
networks:
- cloudflared
cloudflared:
# Cloudflared is a proxy tunnel that allows you to expose local services to the internet
image: cloudflare/cloudflared
container_name: cloudflared
restart: always
command: tunnel --no-autoupdate run --token ${CF_TUNNEL_TOKEN}
depends_on:
- vaultwarden
networks:
- cloudflared
fail2ban:
# Implements fail2ban functionality, banning ips that
# try to bruteforce your vault
# https://github.com/dani-garcia/vaultwarden/wiki/Fail2Ban-Setup
# https://github.com/crazy-max/docker-fail2ban
image: crazymax/fail2ban:latest
restart: always
container_name: fail2ban
depends_on:
- vaultwarden
volumes:
- ${PWD}/fail2ban:/data
- ${PWD}/vaultwarden:/vaultwarden:ro
environment:
- F2B_DB_PURGE_AGE=30d
- F2B_LOG_TARGET=/data/fail2ban.log
- F2B_LOG_LEVEL=INFO
- F2B_IPTABLES_CHAIN=INPUT
- SSMTP_HOST=${SMTP_HOST}
- SSMTP_PORT=${SMTP_PORT}
- SSMTP_USER=${SMTP_USERNAME}
- SSMTP_PASSWORD=${SMTP_PASSWORD}
- SSMTP_HOSTNAME=Vaultwarden (${DOMAIN})
- SSMTP_TLS=${SMTP_TLS}
- SSMTP_FROM=${SMTP_FROM}
- SSMTP_TO=${SMTP_ADMIN}
- SSMTP_STARTTLS=YES
- PUID
- PGID
- CF_USER
- CF_TOKEN
- TZ
networks:
- cloudflared
watchtower:
# Watchtower will pull down your new image, gracefully shut down your existing container
# and restart it with the same options that were used when it was deployed initially
# https://github.com/containrrr/watchtower
image: containrrr/watchtower
restart: always
container_name: watchtower
depends_on:
- vaultwarden
volumes:
- /var/run/docker.sock:/var/run/docker.sock
environment:
- WATCHTOWER_CLEANUP=true
- WATCHTOWER_SCHEDULE
- TZ
networks:
- cloudflared
networks:
cloudflared:
name: cloudflared
external: true