commit 7fe02e3d09b15df8c37927baa1b5c4b56d8363c6 Author: stan220 Date: Tue Mar 4 12:02:35 2025 +0300 init diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..c1e2c64 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,12 @@ +# EditorConfig is awesome: https://EditorConfig.org + +# top-most EditorConfig file +root = true + +[*] +indent_style = space +indent_size = 4 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..3ba03b4 --- /dev/null +++ b/.env.example @@ -0,0 +1,8 @@ +# Caddy +DOMAIN = "https://" +EMAIL = "@" + +# Duplicati +DUPLICATI__TZ = UTC +DUPLICATI__SETTINGS_ENCRYPTION_KEY = "" +DUPLICATI__WEBSERVICE_PASSWORD = "" diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5c404bc --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.history/ + +.env diff --git a/Caddyfile b/Caddyfile new file mode 100644 index 0000000..a9a1a07 --- /dev/null +++ b/Caddyfile @@ -0,0 +1,27 @@ +{$DOMAIN}:443 { + log { + level INFO + output file {$LOG_FILE} { + roll_size 10MB + roll_keep 10 + } + } + + # Use the ACME HTTP-01 challenge to get a cert for the configured domain. + tls {$EMAIL} + + # This setting may have compatibility issues with some browsers + # (e.g., attachment downloading on Firefox). Try disabling this + # if you encounter issues. + encode gzip + + # Notifications redirected to the WebSocket server + reverse_proxy /notifications/hub vaultwarden:3012 + + # Proxy everything else to Rocket + reverse_proxy vaultwarden:80 { + # Send the true remote IP to Rocket, so that vaultwarden can put this in the + # log, so that fail2ban can ban the correct IP. + header_up X-Real-IP {remote_host} + } +} diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..d775232 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,46 @@ +services: + vaultwarden: + image: vaultwarden/server:1.33.2 + container_name: vaultwarden + restart: always + environment: + WEBSOCKET_ENABLED: "true" + volumes: + - ./vw-data:/data + + caddy: + image: caddy:2.9.1-alpine + container_name: caddy + restart: always + ports: + - 80:80 # Needed for the ACME HTTP-01 challenge. + - 443:443 + volumes: + - ./Caddyfile:/etc/caddy/Caddyfile:ro + - ./caddy-config:/config + - ./caddy-data:/data + environment: + DOMAIN: ${DOMAIN} + EMAIL: ${EMAIL} + LOG_FILE: "/data/access.log" + env_file: + - .env + + duplicati: + image: lscr.io/linuxserver/duplicati:2.1.0 + container_name: duplicati + restart: unless-stopped + environment: + PUID: 1000 + PGID: 1000 + TZ: ${DUPLICATI__TZ} + SETTINGS_ENCRYPTION_KEY: ${DUPLICATI__SETTINGS_ENCRYPTION_KEY} + DUPLICATI__WEBSERVICE_PASSWORD: ${DUPLICATI__WEBSERVICE_PASSWORD} + volumes: + - /duplicati/config:/config + - /duplicati/backups:/backups + - /duplicati/source:/source + ports: + - 8200:8200 + env_file: + - .env diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..f506c1a --- /dev/null +++ b/readme.md @@ -0,0 +1,32 @@ +# About +Bitwarden server with automated backup bundle. +Based on personal self-hosted password management service for Vaultwarden(Bitwarden) +Docker composer installation guide for Vaultwarden(https://github.com/dani-garcia/vaultwarden) + +##### Usages: +* [Vaultwarden](https://github.com/dani-garcia/vaultwarden) An alternative server implementation of the Bitwarden Client API, written in Rust and compatible with official Bitwarden clients +* [Caddy](https://github.com/caddyserver/caddy) Tool to support HTTPS +* [Duplicati](https://github.com/duplicati/duplicati) Convenient backup client with encryption and support for all possible storage methods (Google Drive, Dropbox, FTP, etc) + +# Prerequisites +Ubuntu\Debian with installed Docker, Docker Compose. + +```bash +curl https://get.docker.com | bash +``` + +Other docker platforms have not been tested, but they should work with minimal improvements. + +# Getting Started +* Create and login user `bitwarden` +``` +adduser bitwarden +usermod -aG docker bitwarden +su - bitwarden +``` +* Clone this repository to your home folder: `git clone https://github.com/stan220/vaultwarden-bundle && cd "$(basename "$_" .git)"` +* Rename `.env.example` to `.env` and fillup with your custom values + `cp .env.example .env` +* Run `docker compose up -d` + +Checkout your domain in browser, also for backup open domain with 8200 port