backup-services/bitwarden
Daniel Legt 5c1a416b60 Readme and License
+ MIT License
+ Project README.md
+ Bitwarden Backup Script README
2024-01-18 15:15:36 +01:00
..
README.md Readme and License 2024-01-18 15:15:36 +01:00
bitwarden_backup.sh Google Drive Update 2024-01-18 14:59:47 +01:00
config.example.sh Google Drive Update 2024-01-18 14:59:47 +01:00

README.md

About

This script has been written to backup a vaultwarden docker-compose instance, this is how I run my own service on my own server, this backup script will target the data folder and of course will also use sqlite to create a .backup of the db.sqlite3 file, to ensure safety.

Requirements

gdrive

gdrive is a command line application for interacting with Google Drive.

Overview

Environment: Docker Compose

Docker Compose File:

version: '3'

services:
  bitwarden:
    image: vaultwarden/server:latest
    ports:
      - 127.0.0.1:90:80
      - 127.0.0.1:91:3012
    user: "${UID}:${GID}"
    volumes:
      - ./data:/data
    restart: unless-stopped
    environment:
      WEBSOCKET_ENABLED: 'true'
      SMTP_HOST: "smtp.gmail.com"
      SMTP_FROM: "xxx@local.lan"
      SMTP_PORT: 587
      SMTP_SECURITY: "starttls"
      SMTP_USERNAME: "xxx@local.lan"
      SMTP_PASSWORD: "xxx"
      DOMAIN: "https://pass.yourdomain.lan"

Directory Structure

/path/to/your/service
├── data
│   ├── attachments
│   ├── db.sqlite3 # Your important database
│   ├── db.sqlite3-shm
│   ├── db.sqlite3-wal
│   ├── icon_cache
│   ├── rsa_key.pem
│   ├── rsa_key.pub.pem
│   ├── sends
│   └── tmp
└── docker-compose.yaml

Restoration Procedure

Simply unzip the backup file, plop the docker-compose with the correct parameters into the same folder and run it, it should pick right back where it was, but in case the database did get corrupt or broken because the backup was running during an operation, simply remote the db.sqlite3-sh and db.sqlite3-wa files, and replace the db.sqplite3 with the one from the zip's top-level, this should work just fine.

Worst case scenario, restore the database from a different point and it will definitely work.