Add auto-backup in HOME_ASSISTANT, MATRIX, N8N, PROTONMAIL
This commit is contained in:
parent
c925c6793e
commit
221b1f8b6a
8 changed files with 187 additions and 24 deletions
|
@ -4,8 +4,9 @@ server:
|
||||||
domain: mrdev023.test
|
domain: mrdev023.test
|
||||||
backup:
|
backup:
|
||||||
folder: /backup
|
folder: /backup
|
||||||
cron_expression: "0 2 * * *"
|
cron_expression: "* * * * *"
|
||||||
retention_days: 7
|
retention_days: 7
|
||||||
|
filename_date_format: "%Y-%m-%d"
|
||||||
acme:
|
acme:
|
||||||
email: florian.richer.97@outlook.com
|
email: florian.richer.97@outlook.com
|
||||||
debug: true
|
debug: true
|
||||||
|
|
|
@ -58,12 +58,13 @@ services:
|
||||||
- POSTGRES_HOST=db
|
- POSTGRES_HOST=db
|
||||||
- OVERWRITEPROTOCOL=https
|
- OVERWRITEPROTOCOL=https
|
||||||
|
|
||||||
|
# BACKUP
|
||||||
backup_nextcloud:
|
backup_nextcloud:
|
||||||
image: offen/docker-volume-backup:latest
|
image: offen/docker-volume-backup:latest
|
||||||
restart: always
|
restart: always
|
||||||
environment:
|
environment:
|
||||||
BACKUP_CRON_EXPRESSION: "{{ server.backup.cron_expression }}"
|
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_LATEST_SYMLINK: nextcloud.latest.tar.gz
|
||||||
BACKUP_EXCLUDE_REGEXP: "\\.log$$"
|
BACKUP_EXCLUDE_REGEXP: "\\.log$$"
|
||||||
BACKUP_RETENTION_DAYS: "{{ server.backup.retention_days }}"
|
BACKUP_RETENTION_DAYS: "{{ server.backup.retention_days }}"
|
||||||
|
@ -76,7 +77,7 @@ services:
|
||||||
restart: always
|
restart: always
|
||||||
environment:
|
environment:
|
||||||
BACKUP_CRON_EXPRESSION: "{{ server.backup.cron_expression }}"
|
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_LATEST_SYMLINK: db.latest.tar.gz
|
||||||
BACKUP_EXCLUDE_REGEXP: "\\.log$$"
|
BACKUP_EXCLUDE_REGEXP: "\\.log$$"
|
||||||
BACKUP_RETENTION_DAYS: "{{ server.backup.retention_days }}"
|
BACKUP_RETENTION_DAYS: "{{ server.backup.retention_days }}"
|
||||||
|
|
|
@ -22,5 +22,19 @@ services:
|
||||||
# - "traefik.http.routers.homeassistant-secure.service=homeassistant"
|
# - "traefik.http.routers.homeassistant-secure.service=homeassistant"
|
||||||
- "traefik.http.services.homeassistant.loadbalancer.server.port=8123"
|
- "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:
|
volumes:
|
||||||
home_assistant_config:
|
home_assistant_config:
|
|
@ -24,6 +24,9 @@ services:
|
||||||
- proxy
|
- proxy
|
||||||
volumes:
|
volumes:
|
||||||
- matrix:/data
|
- matrix:/data
|
||||||
|
- mautrix_facebook:/facebook_data
|
||||||
|
- mautrix_instagram:/instagram_data
|
||||||
|
- mautrix_discord:/discord_data
|
||||||
labels:
|
labels:
|
||||||
- "traefik.enable=true"
|
- "traefik.enable=true"
|
||||||
- "traefik.http.routers.matrix-secure.entrypoints=https"
|
- "traefik.http.routers.matrix-secure.entrypoints=https"
|
||||||
|
@ -53,11 +56,106 @@ services:
|
||||||
- "traefik.http.routers.matrix-wellknown.middlewares=cors-headers@docker"
|
- "traefik.http.routers.matrix-wellknown.middlewares=cors-headers@docker"
|
||||||
- "traefik.docker.network=proxy"
|
- "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:
|
volumes:
|
||||||
db:
|
db:
|
||||||
web:
|
|
||||||
matrix:
|
matrix:
|
||||||
|
mautrix_facebook:
|
||||||
|
mautrix_instagram:
|
||||||
|
mautrix_discord:
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
internal:
|
internal:
|
||||||
|
|
|
@ -40,6 +40,33 @@ services:
|
||||||
- DB_POSTGRESDB_USER=n8n
|
- DB_POSTGRESDB_USER=n8n
|
||||||
- DB_POSTGRESDB_PASSWORD=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:
|
volumes:
|
||||||
n8n:
|
n8n:
|
||||||
db:
|
db:
|
||||||
|
|
|
@ -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
|
|
|
@ -12,6 +12,15 @@
|
||||||
dest: protonmail/
|
dest: protonmail/
|
||||||
register: protonmail_copy_files_results
|
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
|
- name: Create protonmail network
|
||||||
community.docker.docker_network:
|
community.docker.docker_network:
|
||||||
name: protonmail
|
name: protonmail
|
||||||
|
@ -29,7 +38,7 @@
|
||||||
state: present
|
state: present
|
||||||
pull: true
|
pull: true
|
||||||
restarted: 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
|
become: true
|
||||||
|
|
||||||
- name: Update or start container
|
- name: Update or start container
|
||||||
|
@ -37,5 +46,5 @@
|
||||||
project_src: protonmail
|
project_src: protonmail
|
||||||
state: present
|
state: present
|
||||||
pull: true
|
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
|
become: true
|
31
roles/protonmail/templates/docker-compose.yml.j2
Normal file
31
roles/protonmail/templates/docker-compose.yml.j2
Normal 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
|
Loading…
Reference in a new issue