Created
October 29, 2019 16:37
-
-
Save ViViDboarder/aa480ac3411f359df80376023bc4e987 to your computer and use it in GitHub Desktop.
bitwarden_rs with backups
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '2' | |
services: | |
main: | |
image: mprasil/bitwarden:1.6.1 | |
volumes_from: | |
- backups | |
environment: | |
DOMAIN: https://bw.mydomain.com | |
WEBSOCKET_ENABLED: 'true' | |
SIGNUPS_ALLOWED: 'true' | |
SMTP_HOST: smtp.mailgun.org | |
SMTP_SSL: 'true' | |
SMTP_FROM: [email protected] | |
SMTP_USERNAME: [email protected] | |
SMTP_PASSWORD: ${MAILGUN_SMTP_PASS} | |
labels: | |
- traefik.docker.network=traefik_default | |
- traefik.web.frontend.rule=Host:bw.mydomain.com | |
- traefik.web.port=80 | |
- traefik.hub.frontend.rule=Host:bw.mydomain.com;Path:/notifications/hub | |
- traefik.hub.port=3012 | |
networks: | |
- traefik_default | |
restart: always | |
backups: | |
build: ./backups | |
hostname: bitwardenbackups | |
volumes: | |
- /data | |
environment: | |
RESTIC_PASSWORD: ${RESTIC_PASSWORD} | |
B2_ACCOUNT_ID: ${B2_ACCOUNT_ID} | |
B2_ACCOUNT_KEY: ${B2_ACCOUNT_KEY} | |
BACKUP_DEST: b2:my-bucket:bitwarden/ | |
DB_PATH: /data/db.sqlite3 | |
CLEANUP_COMMAND: '--prune --keep-last 365' | |
CRON_SCHEDULE: "0 1 * * *" # Daily 01:00 | |
SKIP_ON_START: 'true' | |
RESTORE_ON_EMPTY_START: 'true' | |
labels: | |
- traefik.enabled=false | |
restart: always | |
networks: | |
traefik_default: | |
external: true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# backups/Dockerfile | |
FROM vividboarder/docker-restic-cron | |
MAINTAINER ViViDboarder <[email protected]> | |
# Install SQLite | |
RUN apt-get update \ | |
&& apt-get install -y --no-install-recommends sqlite3 \ | |
&& apt-get clean \ | |
&& rm -rf /var/apt/lists/* | |
# Copy SQLite backup scripts | |
COPY ./scripts /scripts | |
# Env that points to sqlite db | |
ENV DB_PATH /data/db.sqlite3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# backups/scripts/backup/after/post-backup.sh | |
set -e | |
cd /data | |
# Remove backed up copy | |
rm $DB_PATH.bak |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# backups/scripts/restore/after/post-restore.sh | |
set -e | |
cd /data | |
# Restore the backedup database | |
mv $DB_PATH.bak $DB_PATH |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# backups/scripts/backup/before/pre-backup.sh | |
set -e | |
cd /data | |
# Dump the SQLite database | |
sqlite3 $DB_PATH ".backup $DB_PATH.bak" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# backups/scripts/restore/before/pre-restore.sh | |
set -e | |
# Don't really need to do anything here |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment