Skip to content

Backs up vaultwarden files and directories automatically (docker container) with notifications (AppRise intregration)

Notifications You must be signed in to change notification settings

johannmx/vaultwarden_backup

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

💾 Vaultwarden Backup + Gotify notifications

Backs up vaultwarden files and directories to tar.xz archives automatically. tar.xz archives can be opened using data compression programs like 7-Zip and WinRAR.

#####Docker image for all platforms, like ARM (Raspberry Pi) Docker Hub

Files and directories that are backed up:

  • db.sqlite3
  • config.json
  • rsa_key.der
  • rsa_key.pem
  • rsa_key.pub.der
  • /attachments
  • /sends

Usage

Automatic Backups

Refer to the docker-compose section below. By default, backing up is automatic.

Manual Backups

Pass manual to docker run or docker-compose as a command.

docker-compose

services:
  vaultwarden:
    # Vaultwarden configuration here.
    image: vaultwarden/server:latest
    container_name: vaultwarden
    restart: always
    environment:
      - WEBSOCKET_ENABLED=true  # Enable WebSocket notifications.
    volumes:
      - /folder-to/bitwarden/data:/data
    ports:
      - 8088:80
      - 3012:3012
  backup:
    image: johannmx/vaultwarden_backup:nightly
    container_name: vaultwarden_backup_gotify
    volumes:
      - /path/to/bitwarden/data:/data:ro # Read-only
      - /path/to/Bitwarden/backup:/backups
      #- /etc/localtime:/etc/localtime:ro # Container uses date from host.
    environment:
      - DELETE_AFTER=30
      - CRON_TIME=0 3 * * * # Runs at 3am.
      - UID=1000
      - GID=1000
      - TZ=America/Argentina/Buenos_Aires # Specify a timezone to use EG Europe/London.
      - GOTIFY_TOKEN=supertoken
      - GOTIFY_SERVER=subdomain.domain.com

Volumes (permissions required)

/data (read)- Vaultwarden's /data directory. Recommend setting mount as read-only.

/backups (write) - Where to store backups to.

Environment Variables

⭐Required, 👍 Recommended

Environment Variable Info
UID ⭐ User ID to run the cron job as.
GID ⭐ Group ID to run the cron job as.
CRON_TIME 👍 When to run (default is every 12 hours). Info [here][cron-format-wiki] and editor [here][cron-editor].
DELETE_AFTER 👍 (exclusive to automatic mode) Delete backups X days old. Requires read and write permissions.
GOTIFY_TOKEN 👍 Gotify Token generated for app.
GOTIFY_SERVER 👍 Endpoint server (subdomain.domain.com) without http/https.

Optional

Environment Variable Info
TZ ¹ Timezone inside the container. Can mount /etc/localtime instead as well (recommended).

¹ See https://en.wikipedia.org/wiki/List_of_tz_database_time_zones for more information

☑️ build docker --platforms

docker buildx create --name mybuilder --use
docker buildx build -t test/vaultwarden_backup:latest --platform linux/amd64,linux/arm64,linux/ppc64le,linux/s390x,linux/386,linux/arm/v7,linux/arm/v6 --push .

Errors

Unexpected timestamp

Mount /etc/localtime (recommend mounting as read-only) or set TZ environment variable.

Info

[cron-format-wiki] https://www.ibm.com/docs/en/db2oc?topic=task-unix-cron-format
[cron-editor]: https://crontab.guru/
[Docker Build Arch]: https://andrewlock.net/creating-multi-arch-docker-images-for-arm64-from-windows/

About

Backs up vaultwarden files and directories automatically (docker container) with notifications (AppRise intregration)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages

  • Shell 77.7%
  • Dockerfile 22.3%