1
0
Fork 0

Add auto-backup in HOME_ASSISTANT, MATRIX, N8N, PROTONMAIL

This commit is contained in:
Florian RICHER 2023-05-20 19:48:18 +02:00
parent c925c6793e
commit 221b1f8b6a
8 changed files with 187 additions and 24 deletions

View file

@ -4,8 +4,9 @@ server:
domain: mrdev023.test
backup:
folder: /backup
cron_expression: "0 2 * * *"
cron_expression: "* * * * *"
retention_days: 7
filename_date_format: "%Y-%m-%d"
acme:
email: florian.richer.97@outlook.com
debug: true

View file

@ -58,12 +58,13 @@ services:
- POSTGRES_HOST=db
- OVERWRITEPROTOCOL=https
# BACKUP
backup_nextcloud:
image: offen/docker-volume-backup:latest
restart: always
environment:
BACKUP_CRON_EXPRESSION: "{{ server.backup.cron_expression }}"
BACKUP_FILENAME: "%Y-%m-%d-nextcloud.tar.gz"
BACKUP_FILENAME: "{{ server.backup.filename_date_format }}-nextcloud.tar.gz"
BACKUP_LATEST_SYMLINK: nextcloud.latest.tar.gz
BACKUP_EXCLUDE_REGEXP: "\\.log$$"
BACKUP_RETENTION_DAYS: "{{ server.backup.retention_days }}"
@ -76,7 +77,7 @@ services:
restart: always
environment:
BACKUP_CRON_EXPRESSION: "{{ server.backup.cron_expression }}"
BACKUP_FILENAME: "%Y-%m-%d-db.tar.gz"
BACKUP_FILENAME: "{{ server.backup.filename_date_format }}-db.tar.gz"
BACKUP_LATEST_SYMLINK: db.latest.tar.gz
BACKUP_EXCLUDE_REGEXP: "\\.log$$"
BACKUP_RETENTION_DAYS: "{{ server.backup.retention_days }}"

View file

@ -22,5 +22,19 @@ services:
# - "traefik.http.routers.homeassistant-secure.service=homeassistant"
- "traefik.http.services.homeassistant.loadbalancer.server.port=8123"
# BACKUP
backup_home_assistant_config:
image: offen/docker-volume-backup:latest
restart: always
environment:
BACKUP_CRON_EXPRESSION: "{{ server.backup.cron_expression }}"
BACKUP_FILENAME: "{{ server.backup.filename_date_format }}-home-assistant-config.tar.gz"
BACKUP_LATEST_SYMLINK: home-assistant-config.latest.tar.gz
BACKUP_EXCLUDE_REGEXP: "\\.log$$"
BACKUP_RETENTION_DAYS: "{{ server.backup.retention_days }}"
volumes:
- home_assistant_config:/backup:ro
- {{ server.backup.folder }}/home_assistant:/archive
volumes:
home_assistant_config:

View file

@ -24,6 +24,9 @@ services:
- proxy
volumes:
- matrix:/data
- mautrix_facebook:/facebook_data
- mautrix_instagram:/instagram_data
- mautrix_discord:/discord_data
labels:
- "traefik.enable=true"
- "traefik.http.routers.matrix-secure.entrypoints=https"
@ -52,12 +55,107 @@ services:
- "traefik.http.routers.matrix-wellknown.tls.certresolver=sslResolver"
- "traefik.http.routers.matrix-wellknown.middlewares=cors-headers@docker"
- "traefik.docker.network=proxy"
# BRIDGE
mautrix-facebook:
container_name: mautrix-facebook
image: dock.mau.dev/mautrix/facebook:v0.4.1
restart: unless-stopped
networks:
- internal
volumes:
- mautrix_facebook:/data
mautrix-instagram:
container_name: mautrix-instagram
image: dock.mau.dev/mautrix/instagram:v0.2.3
restart: unless-stopped
networks:
- internal
volumes:
- mautrix_instagram:/data
mautrix-discord:
container_name: mautrix-discord
image: dock.mau.dev/mautrix/discord:v0.2.0
restart: unless-stopped
networks:
- internal
volumes:
- mautrix_discord:/data
# BACKUP
backup_db:
image: offen/docker-volume-backup:latest
restart: always
environment:
BACKUP_CRON_EXPRESSION: "{{ server.backup.cron_expression }}"
BACKUP_FILENAME: "{{ server.backup.filename_date_format }}-db.tar.gz"
BACKUP_LATEST_SYMLINK: db.latest.tar.gz
BACKUP_EXCLUDE_REGEXP: "\\.log$$"
BACKUP_RETENTION_DAYS: "{{ server.backup.retention_days }}"
volumes:
- db:/backup:ro
- {{ server.backup.folder }}/matrix:/archive
backup_matrix:
image: offen/docker-volume-backup:latest
restart: always
environment:
BACKUP_CRON_EXPRESSION: "{{ server.backup.cron_expression }}"
BACKUP_FILENAME: "{{ server.backup.filename_date_format }}-matrix.tar.gz"
BACKUP_LATEST_SYMLINK: matrix.latest.tar.gz
BACKUP_EXCLUDE_REGEXP: "\\.log$$"
BACKUP_RETENTION_DAYS: "{{ server.backup.retention_days }}"
volumes:
- matrix:/backup:ro
- {{ server.backup.folder }}/matrix:/archive
backup_mautrix_facebook:
image: offen/docker-volume-backup:latest
restart: always
environment:
BACKUP_CRON_EXPRESSION: "{{ server.backup.cron_expression }}"
BACKUP_FILENAME: "{{ server.backup.filename_date_format }}-mautrix-facebook.tar.gz"
BACKUP_LATEST_SYMLINK: mautrix-facebook.latest.tar.gz
BACKUP_EXCLUDE_REGEXP: "\\.log$$"
BACKUP_RETENTION_DAYS: "{{ server.backup.retention_days }}"
volumes:
- mautrix_facebook:/backup:ro
- {{ server.backup.folder }}/matrix:/archive
backup_mautrix_instagram:
image: offen/docker-volume-backup:latest
restart: always
environment:
BACKUP_CRON_EXPRESSION: "{{ server.backup.cron_expression }}"
BACKUP_FILENAME: "{{ server.backup.filename_date_format }}-mautrix-instagram.tar.gz"
BACKUP_LATEST_SYMLINK: mautrix-instagram.latest.tar.gz
BACKUP_EXCLUDE_REGEXP: "\\.log$$"
BACKUP_RETENTION_DAYS: "{{ server.backup.retention_days }}"
volumes:
- mautrix_instagram:/backup:ro
- {{ server.backup.folder }}/matrix:/archive
backup_mautrix_discord:
image: offen/docker-volume-backup:latest
restart: always
environment:
BACKUP_CRON_EXPRESSION: "{{ server.backup.cron_expression }}"
BACKUP_FILENAME: "{{ server.backup.filename_date_format }}-mautrix-discord.tar.gz"
BACKUP_LATEST_SYMLINK: mautrix-discord.latest.tar.gz
BACKUP_EXCLUDE_REGEXP: "\\.log$$"
BACKUP_RETENTION_DAYS: "{{ server.backup.retention_days }}"
volumes:
- mautrix_discord:/backup:ro
- {{ server.backup.folder }}/matrix:/archive
volumes:
db:
web:
matrix:
mautrix_facebook:
mautrix_instagram:
mautrix_discord:
networks:
internal:

View file

@ -40,6 +40,33 @@ services:
- DB_POSTGRESDB_USER=n8n
- DB_POSTGRESDB_PASSWORD=n8n
# BACKUP
backup_n8n:
image: offen/docker-volume-backup:latest
restart: always
environment:
BACKUP_CRON_EXPRESSION: "{{ server.backup.cron_expression }}"
BACKUP_FILENAME: "{{ server.backup.filename_date_format }}-n8n.tar.gz"
BACKUP_LATEST_SYMLINK: n8n.latest.tar.gz
BACKUP_EXCLUDE_REGEXP: "\\.log$$"
BACKUP_RETENTION_DAYS: "{{ server.backup.retention_days }}"
volumes:
- n8n:/backup:ro
- {{ server.backup.folder }}/n8n:/archive
backup_db:
image: offen/docker-volume-backup:latest
restart: always
environment:
BACKUP_CRON_EXPRESSION: "{{ server.backup.cron_expression }}"
BACKUP_FILENAME: "{{ server.backup.filename_date_format }}-db.tar.gz"
BACKUP_LATEST_SYMLINK: db.latest.tar.gz
BACKUP_EXCLUDE_REGEXP: "\\.log$$"
BACKUP_RETENTION_DAYS: "{{ server.backup.retention_days }}"
volumes:
- db:/backup:ro
- {{ server.backup.folder }}/n8n:/archive
volumes:
n8n:
db:

View file

@ -1,18 +0,0 @@
version: '3'
services:
protonmail-bridge:
image: shenxn/protonmail-bridge
restart: always
container_name: protonmail-bridge
networks:
- protonmail
volumes:
- protonmail:/root
volumes:
protonmail:
networks:
protonmail:
external: true

View file

@ -12,6 +12,15 @@
dest: protonmail/
register: protonmail_copy_files_results
- name: Copy template conf
ansible.builtin.template:
backup: true
src: "{{ item.src }}"
dest: "protonmail/{{ item.dest }}"
loop:
- { src: 'docker-compose.yml.j2', dest: 'docker-compose.yml' }
register: protonmail_copy_templates_results
- name: Create protonmail network
community.docker.docker_network:
name: protonmail
@ -29,7 +38,7 @@
state: present
pull: true
restarted: true
when: protonmail.initialized and protonmail_copy_files_results.changed
when: protonmail.initialized and (protonmail_copy_templates_results.changed or protonmail_copy_files_results.changed)
become: true
- name: Update or start container
@ -37,5 +46,5 @@
project_src: protonmail
state: present
pull: true
when: protonmail.initialized and not protonmail_copy_files_results.changed
when: protonmail.initialized and not protonmail_copy_templates_results.changed and not protonmail_copy_files_results.changed
become: true

View file

@ -0,0 +1,31 @@
version: '3'
services:
protonmail-bridge:
image: shenxn/protonmail-bridge
restart: always
container_name: protonmail-bridge
networks:
- protonmail
volumes:
- protonmail:/root
backup_protonmail:
image: offen/docker-volume-backup:latest
restart: always
environment:
BACKUP_CRON_EXPRESSION: "{{ server.backup.cron_expression }}"
BACKUP_FILENAME: "{{ server.backup.filename_date_format }}-protonmail.tar.gz"
BACKUP_LATEST_SYMLINK: protonmail.latest.tar.gz
BACKUP_EXCLUDE_REGEXP: "\\.log$$"
BACKUP_RETENTION_DAYS: "{{ server.backup.retention_days }}"
volumes:
- protonmail:/backup:ro
- {{ server.backup.folder }}/protonmail:/archive
volumes:
protonmail:
networks:
protonmail:
external: true