Begin remove backup from docker + Debian support
This commit is contained in:
parent
e026113bb7
commit
7fe8837098
31 changed files with 82 additions and 565 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,2 +1,3 @@
|
||||||
|
group_vars/all.yml
|
||||||
work/image.qcow2
|
work/image.qcow2
|
||||||
work/inventory.yaml
|
work/inventory.yaml
|
|
@ -1,38 +1,13 @@
|
||||||
##
|
##
|
||||||
# Global configuration
|
# Global configuration
|
||||||
server:
|
server:
|
||||||
domain: mrdev023.test
|
domain: mrdev023.fr
|
||||||
ssh_port: 22
|
ssh_port: 7943
|
||||||
backup:
|
work_dir: /mnt/work
|
||||||
folder: /backup
|
|
||||||
cron_expression: "* * * * *"
|
|
||||||
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
|
||||||
|
|
||||||
# Other
|
# Other
|
||||||
protonmail:
|
protonmail:
|
||||||
initialized: false
|
initialized: true
|
||||||
|
|
||||||
restore:
|
|
||||||
cloud:
|
|
||||||
nextcloud_archive: false
|
|
||||||
db_archive: false
|
|
||||||
home_assistant:
|
|
||||||
home_assistant_config_archive: false
|
|
||||||
matrix:
|
|
||||||
db_archive: false
|
|
||||||
matrix_archive: false
|
|
||||||
mautrix_facebook_archive: false
|
|
||||||
mautrix_instagram_archive: false
|
|
||||||
mautrix_discord_archive: false
|
|
||||||
n8n:
|
|
||||||
n8n_archive: false
|
|
||||||
db_archive: false
|
|
||||||
protonmail:
|
|
||||||
protonmail_archive: false
|
|
||||||
traefik:
|
|
||||||
prometheus_archive: false
|
|
||||||
grafana_archive: false
|
|
||||||
|
|
13
group_vars/all.yml.sample
Normal file
13
group_vars/all.yml.sample
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
##
|
||||||
|
# Global configuration
|
||||||
|
server:
|
||||||
|
domain: mrdev023.test
|
||||||
|
ssh_port: 22
|
||||||
|
work_dir: /mnt/test
|
||||||
|
acme:
|
||||||
|
email: test@test.fr
|
||||||
|
debug: true
|
||||||
|
|
||||||
|
# Other
|
||||||
|
protonmail:
|
||||||
|
initialized: false
|
19
playbook.yml
19
playbook.yml
|
@ -4,14 +4,13 @@
|
||||||
|
|
||||||
roles:
|
roles:
|
||||||
- { role: docker, tags: ["docker"] }
|
- { role: docker, tags: ["docker"] }
|
||||||
- { role: volume_restore, tags: ["volume_restore"] }
|
|
||||||
- { role: ssh, tags: ["ssh"] }
|
- { role: ssh, tags: ["ssh"] }
|
||||||
- { role: traefik, tags: ["traefik"] }
|
# - { role: traefik, tags: ["traefik"] }
|
||||||
- { role: whoami, tags: ["whoami"] }
|
# - { role: whoami, tags: ["whoami"] }
|
||||||
- { role: protonmail, tags: ["protonmail"] }
|
# - { role: protonmail, tags: ["protonmail"] }
|
||||||
- { role: cloud, tags: ["cloud"] }
|
# - { role: cloud, tags: ["cloud"] }
|
||||||
- { role: home_assistant, tags: ["home_assistant"] }
|
# - { role: home_assistant, tags: ["home_assistant"] }
|
||||||
- { role: n8n, tags: ["n8n"] }
|
# - { role: n8n, tags: ["n8n"] }
|
||||||
- { role: matrix, tags: ["matrix"] }
|
# - { role: matrix, tags: ["matrix"] }
|
||||||
- { role: iptables, tags: ["iptables"] }
|
# - { role: iptables, tags: ["iptables"] }
|
||||||
- { role: clean, tags: ["clean"] }
|
# - { role: clean, tags: ["clean"] }
|
||||||
|
|
|
@ -4,8 +4,4 @@
|
||||||
name: base
|
name: base
|
||||||
|
|
||||||
- ansible.builtin.import_tasks: cron.yml
|
- ansible.builtin.import_tasks: cron.yml
|
||||||
name: cron
|
name: cron
|
||||||
|
|
||||||
- ansible.builtin.import_tasks: restore.yml
|
|
||||||
name: restore
|
|
||||||
when: restore.cloud.nextcloud_archive and restore.cloud.db_archive
|
|
|
@ -1,43 +0,0 @@
|
||||||
---
|
|
||||||
|
|
||||||
- name: Copy archives
|
|
||||||
ansible.builtin.copy:
|
|
||||||
src: "{{ item.src }}"
|
|
||||||
dest: "{{ item.dest }}"
|
|
||||||
loop:
|
|
||||||
- { src: '{{ restore.cloud.nextcloud_archive }}', dest: 'cloud_nextcloud.tar.gz' }
|
|
||||||
- { src: '{{ restore.cloud.db_archive }}', dest: 'cloud_db.tar.gz' }
|
|
||||||
|
|
||||||
- name: Stop nextcloud container
|
|
||||||
community.docker.docker_compose:
|
|
||||||
project_src: cloud
|
|
||||||
state: absent
|
|
||||||
become: true
|
|
||||||
|
|
||||||
- name: Restore backup
|
|
||||||
community.docker.docker_container:
|
|
||||||
name: volume_restore
|
|
||||||
image: volume_restore:latest
|
|
||||||
auto_remove: yes
|
|
||||||
tty: true
|
|
||||||
volumes:
|
|
||||||
- "{{ item.path }}:/backup/archive.tar.gz"
|
|
||||||
- "{{ item.volume }}:/backup/dest"
|
|
||||||
loop:
|
|
||||||
- { path: './cloud_nextcloud.tar.gz', volume: 'cloud_nextcloud' }
|
|
||||||
- { path: './cloud_db.tar.gz', volume: 'cloud_db' }
|
|
||||||
become: true
|
|
||||||
|
|
||||||
- name: Start nextcloud container
|
|
||||||
community.docker.docker_compose:
|
|
||||||
project_src: cloud
|
|
||||||
state: present
|
|
||||||
become: true
|
|
||||||
|
|
||||||
- name: Remove archive
|
|
||||||
ansible.builtin.file:
|
|
||||||
path: "{{ item.path }}"
|
|
||||||
state: absent
|
|
||||||
loop:
|
|
||||||
- { path: 'cloud_nextcloud.tar.gz' }
|
|
||||||
- { path: 'cloud_db.tar.gz' }
|
|
|
@ -58,33 +58,6 @@ services:
|
||||||
- POSTGRES_HOST=db
|
- POSTGRES_HOST=db
|
||||||
- OVERWRITEPROTOCOL=https
|
- OVERWRITEPROTOCOL=https
|
||||||
|
|
||||||
# BACKUP
|
|
||||||
backup_nextcloud:
|
|
||||||
image: offen/docker-volume-backup:latest
|
|
||||||
restart: always
|
|
||||||
environment:
|
|
||||||
BACKUP_CRON_EXPRESSION: "{{ server.backup.cron_expression }}"
|
|
||||||
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 }}"
|
|
||||||
volumes:
|
|
||||||
- nextcloud:/backup:ro
|
|
||||||
- {{ server.backup.folder }}/cloud:/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 }}/cloud:/archive
|
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
nextcloud:
|
nextcloud:
|
||||||
db:
|
db:
|
||||||
|
|
35
roles/docker/tasks/debian.yml
Normal file
35
roles/docker/tasks/debian.yml
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
---
|
||||||
|
- name: Install required packages
|
||||||
|
ansible.builtin.apt:
|
||||||
|
name:
|
||||||
|
- apt-transport-https
|
||||||
|
- ca-certificates
|
||||||
|
- curl
|
||||||
|
- gnupg
|
||||||
|
- lsb-release
|
||||||
|
state: present
|
||||||
|
update_cache: yes
|
||||||
|
|
||||||
|
- name: Add Docker GPG key
|
||||||
|
ansible.builtin.apt_key:
|
||||||
|
url: https://download.docker.com/linux/{{ mydistribution }}/gpg
|
||||||
|
state: present
|
||||||
|
|
||||||
|
- name: Add Docker repository
|
||||||
|
ansible.builtin.apt_repository:
|
||||||
|
repo: "deb [arch=amd64] https://download.docker.com/linux/{{ mydistribution }} {{ ansible_distribution_release }} stable"
|
||||||
|
state: present
|
||||||
|
update_cache: yes
|
||||||
|
|
||||||
|
- name: Install Docker Engine
|
||||||
|
ansible.builtin.apt:
|
||||||
|
name:
|
||||||
|
- docker-ce
|
||||||
|
- docker-ce-cli
|
||||||
|
- containerd.io
|
||||||
|
- docker-buildx-plugin
|
||||||
|
- docker-compose-plugin
|
||||||
|
- docker-compose
|
||||||
|
- python3-docker
|
||||||
|
state: latest
|
||||||
|
update_cache: true
|
|
@ -1,7 +1,4 @@
|
||||||
---
|
---
|
||||||
- name: set mydistribution
|
|
||||||
ansible.builtin.set_fact:
|
|
||||||
mydistribution: "{{ 'rhel' if (ansible_distribution == 'Red Hat Enterprise Linux') else (ansible_distribution | lower) }}"
|
|
||||||
|
|
||||||
- name: Add signing key
|
- name: Add signing key
|
||||||
ansible.builtin.rpm_key:
|
ansible.builtin.rpm_key:
|
||||||
|
@ -29,9 +26,3 @@
|
||||||
- python-docker
|
- python-docker
|
||||||
state: latest
|
state: latest
|
||||||
update_cache: true
|
update_cache: true
|
||||||
|
|
||||||
- name: Start Docker
|
|
||||||
ansible.builtin.service:
|
|
||||||
name: "docker"
|
|
||||||
enabled: true
|
|
||||||
state: started
|
|
|
@ -1,4 +1,20 @@
|
||||||
---
|
---
|
||||||
- ansible.builtin.import_tasks: install.yml
|
- name: set mydistribution
|
||||||
|
ansible.builtin.set_fact:
|
||||||
|
mydistribution: "{{ ansible_distribution | lower }}"
|
||||||
|
|
||||||
|
- ansible.builtin.import_tasks: fedora.yml
|
||||||
name: base
|
name: base
|
||||||
become: true
|
become: true
|
||||||
|
when: mydistribution == "fedora"
|
||||||
|
|
||||||
|
- ansible.builtin.import_tasks: debian.yml
|
||||||
|
name: base
|
||||||
|
become: true
|
||||||
|
when: mydistribution == "debian"
|
||||||
|
|
||||||
|
- name: Start Docker
|
||||||
|
ansible.builtin.service:
|
||||||
|
name: "docker"
|
||||||
|
enabled: true
|
||||||
|
state: started
|
||||||
|
|
|
@ -2,7 +2,3 @@
|
||||||
|
|
||||||
- ansible.builtin.import_tasks: base.yml
|
- ansible.builtin.import_tasks: base.yml
|
||||||
name: base
|
name: base
|
||||||
|
|
||||||
- ansible.builtin.import_tasks: restore.yml
|
|
||||||
name: restore
|
|
||||||
when: restore.home_assistant.home_assistant_config_archive
|
|
|
@ -1,40 +0,0 @@
|
||||||
---
|
|
||||||
|
|
||||||
- name: Copy archives
|
|
||||||
ansible.builtin.copy:
|
|
||||||
src: "{{ item.src }}"
|
|
||||||
dest: "{{ item.dest }}"
|
|
||||||
loop:
|
|
||||||
- { src: '{{ restore.home_assistant.home_assistant_config_archive }}', dest: 'home_assistant_home_assistant_config.tar.gz' }
|
|
||||||
|
|
||||||
- name: Stop nextcloud container
|
|
||||||
community.docker.docker_compose:
|
|
||||||
project_src: home_assistant
|
|
||||||
state: absent
|
|
||||||
become: true
|
|
||||||
|
|
||||||
- name: Restore backup
|
|
||||||
community.docker.docker_container:
|
|
||||||
name: volume_restore
|
|
||||||
image: volume_restore:latest
|
|
||||||
auto_remove: yes
|
|
||||||
tty: true
|
|
||||||
volumes:
|
|
||||||
- "{{ item.path }}:/backup/archive.tar.gz"
|
|
||||||
- "{{ item.volume }}:/backup/dest"
|
|
||||||
loop:
|
|
||||||
- { path: './home_assistant_home_assistant_config.tar.gz', volume: 'home_assistant_home_assistant_config' }
|
|
||||||
become: true
|
|
||||||
|
|
||||||
- name: Start nextcloud container
|
|
||||||
community.docker.docker_compose:
|
|
||||||
project_src: home_assistant
|
|
||||||
state: present
|
|
||||||
become: true
|
|
||||||
|
|
||||||
- name: Remove archive
|
|
||||||
ansible.builtin.file:
|
|
||||||
path: "{{ item.path }}"
|
|
||||||
state: absent
|
|
||||||
loop:
|
|
||||||
- { path: 'home_assistant_home_assistant_config.tar.gz' }
|
|
|
@ -22,19 +22,5 @@ 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:
|
|
@ -2,7 +2,3 @@
|
||||||
|
|
||||||
- ansible.builtin.import_tasks: base.yml
|
- ansible.builtin.import_tasks: base.yml
|
||||||
name: base
|
name: base
|
||||||
|
|
||||||
- ansible.builtin.import_tasks: restore.yml
|
|
||||||
name: restore
|
|
||||||
when: restore.matrix.db_archive and restore.matrix.matrix_archive and restore.matrix.mautrix_facebook_archive and restore.matrix.mautrix_instagram_archive and restore.matrix.mautrix_discord_archive
|
|
|
@ -1,52 +0,0 @@
|
||||||
---
|
|
||||||
|
|
||||||
- name: Copy archives
|
|
||||||
ansible.builtin.copy:
|
|
||||||
src: "{{ item.src }}"
|
|
||||||
dest: "{{ item.dest }}"
|
|
||||||
loop:
|
|
||||||
- { src: '{{ restore.matrix.db_archive }}', dest: 'matrix_db.tar.gz' }
|
|
||||||
- { src: '{{ restore.matrix.matrix_archive }}', dest: 'matrix_matrix.tar.gz' }
|
|
||||||
- { src: '{{ restore.matrix.mautrix_facebook_archive }}', dest: 'matrix_mautrix_facebook.tar.gz' }
|
|
||||||
- { src: '{{ restore.matrix.mautrix_instagram_archive }}', dest: 'matrix_mautrix_instagram.tar.gz' }
|
|
||||||
- { src: '{{ restore.matrix.mautrix_discord_archive }}', dest: 'matrix_mautrix_discord.tar.gz' }
|
|
||||||
|
|
||||||
- name: Stop nextcloud container
|
|
||||||
community.docker.docker_compose:
|
|
||||||
project_src: matrix
|
|
||||||
state: absent
|
|
||||||
become: true
|
|
||||||
|
|
||||||
- name: Restore backup
|
|
||||||
community.docker.docker_container:
|
|
||||||
name: volume_restore
|
|
||||||
image: volume_restore:latest
|
|
||||||
auto_remove: yes
|
|
||||||
tty: true
|
|
||||||
volumes:
|
|
||||||
- "{{ item.path }}:/backup/archive.tar.gz"
|
|
||||||
- "{{ item.volume }}:/backup/dest"
|
|
||||||
loop:
|
|
||||||
- { path: './matrix_db.tar.gz', volume: 'matrix_db' }
|
|
||||||
- { path: './matrix_matrix.tar.gz', volume: 'matrix_matrix' }
|
|
||||||
- { path: './matrix_mautrix_facebook.tar.gz', volume: 'matrix_mautrix_facebook' }
|
|
||||||
- { path: './matrix_mautrix_instagram.tar.gz', volume: 'matrix_mautrix_instagram' }
|
|
||||||
- { path: './matrix_mautrix_discord.tar.gz', volume: 'matrix_mautrix_discord' }
|
|
||||||
become: true
|
|
||||||
|
|
||||||
- name: Start nextcloud container
|
|
||||||
community.docker.docker_compose:
|
|
||||||
project_src: matrix
|
|
||||||
state: present
|
|
||||||
become: true
|
|
||||||
|
|
||||||
- name: Remove archive
|
|
||||||
ansible.builtin.file:
|
|
||||||
path: "{{ item.path }}"
|
|
||||||
state: absent
|
|
||||||
loop:
|
|
||||||
- { path: 'matrix_db.tar.gz' }
|
|
||||||
- { path: 'matrix_matrix.tar.gz' }
|
|
||||||
- { path: 'matrix_mautrix_facebook.tar.gz' }
|
|
||||||
- { path: 'matrix_mautrix_instagram.tar.gz' }
|
|
||||||
- { path: 'matrix_mautrix_discord.tar.gz' }
|
|
|
@ -56,100 +56,6 @@ 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:
|
||||||
matrix:
|
matrix:
|
||||||
|
|
|
@ -3,6 +3,3 @@
|
||||||
- ansible.builtin.import_tasks: base.yml
|
- ansible.builtin.import_tasks: base.yml
|
||||||
name: base
|
name: base
|
||||||
|
|
||||||
- ansible.builtin.import_tasks: restore.yml
|
|
||||||
name: restore
|
|
||||||
when: restore.n8n.n8n_archive and restore.n8n.db_archive
|
|
||||||
|
|
|
@ -1,43 +0,0 @@
|
||||||
---
|
|
||||||
|
|
||||||
- name: Copy archives
|
|
||||||
ansible.builtin.copy:
|
|
||||||
src: "{{ item.src }}"
|
|
||||||
dest: "{{ item.dest }}"
|
|
||||||
loop:
|
|
||||||
- { src: '{{ restore.n8n.n8n_archive }}', dest: 'n8n_n8n.tar.gz' }
|
|
||||||
- { src: '{{ restore.n8n.db_archive }}', dest: 'n8n_db.tar.gz' }
|
|
||||||
|
|
||||||
- name: Stop nextcloud container
|
|
||||||
community.docker.docker_compose:
|
|
||||||
project_src: home_assistant
|
|
||||||
state: absent
|
|
||||||
become: true
|
|
||||||
|
|
||||||
- name: Restore backup
|
|
||||||
community.docker.docker_container:
|
|
||||||
name: volume_restore
|
|
||||||
image: volume_restore:latest
|
|
||||||
auto_remove: yes
|
|
||||||
tty: true
|
|
||||||
volumes:
|
|
||||||
- "{{ item.path }}:/backup/archive.tar.gz"
|
|
||||||
- "{{ item.volume }}:/backup/dest"
|
|
||||||
loop:
|
|
||||||
- { path: './n8n_n8n.tar.gz', volume: 'n8n_n8n' }
|
|
||||||
- { path: './n8n_db.tar.gz', volume: 'n8n_db' }
|
|
||||||
become: true
|
|
||||||
|
|
||||||
- name: Start nextcloud container
|
|
||||||
community.docker.docker_compose:
|
|
||||||
project_src: home_assistant
|
|
||||||
state: present
|
|
||||||
become: true
|
|
||||||
|
|
||||||
- name: Remove archive
|
|
||||||
ansible.builtin.file:
|
|
||||||
path: "{{ item.path }}"
|
|
||||||
state: absent
|
|
||||||
loop:
|
|
||||||
- { path: 'n8n_n8n.tar.gz' }
|
|
||||||
- { path: 'n8n_db.tar.gz' }
|
|
|
@ -40,33 +40,6 @@ 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:
|
||||||
|
|
|
@ -2,7 +2,3 @@
|
||||||
|
|
||||||
- ansible.builtin.import_tasks: base.yml
|
- ansible.builtin.import_tasks: base.yml
|
||||||
name: base
|
name: base
|
||||||
|
|
||||||
- ansible.builtin.import_tasks: restore.yml
|
|
||||||
name: restore
|
|
||||||
when: restore.protonmail.protonmail_archive
|
|
|
@ -1,40 +0,0 @@
|
||||||
---
|
|
||||||
|
|
||||||
- name: Copy archives
|
|
||||||
ansible.builtin.copy:
|
|
||||||
src: "{{ item.src }}"
|
|
||||||
dest: "{{ item.dest }}"
|
|
||||||
loop:
|
|
||||||
- { src: '{{ restore.protonmail.protonmail_archive }}', dest: 'protonmail_protonmail.tar.gz' }
|
|
||||||
|
|
||||||
- name: Stop nextcloud container
|
|
||||||
community.docker.docker_compose:
|
|
||||||
project_src: home_assistant
|
|
||||||
state: absent
|
|
||||||
become: true
|
|
||||||
|
|
||||||
- name: Restore backup
|
|
||||||
community.docker.docker_container:
|
|
||||||
name: volume_restore
|
|
||||||
image: volume_restore:latest
|
|
||||||
auto_remove: yes
|
|
||||||
tty: true
|
|
||||||
volumes:
|
|
||||||
- "{{ item.path }}:/backup/archive.tar.gz"
|
|
||||||
- "{{ item.volume }}:/backup/dest"
|
|
||||||
loop:
|
|
||||||
- { path: './protonmail_protonmail.tar.gz', volume: 'protonmail_protonmail' }
|
|
||||||
become: true
|
|
||||||
|
|
||||||
- name: Start nextcloud container
|
|
||||||
community.docker.docker_compose:
|
|
||||||
project_src: home_assistant
|
|
||||||
state: present
|
|
||||||
become: true
|
|
||||||
|
|
||||||
- name: Remove archive
|
|
||||||
ansible.builtin.file:
|
|
||||||
path: "{{ item.path }}"
|
|
||||||
state: absent
|
|
||||||
loop:
|
|
||||||
- { path: 'protonmail_protonmail.tar.gz' }
|
|
|
@ -7,7 +7,7 @@
|
||||||
group: root
|
group: root
|
||||||
mode: u=rwx,g=rx,o=rx
|
mode: u=rwx,g=rx,o=rx
|
||||||
loop:
|
loop:
|
||||||
- { src: 'port.conf.j2', dest: '/etc/ssh/ssh_config.d/99-port.conf' }
|
- { src: 'port.conf.j2', dest: '/etc/ssh/sshd_config.d/99-port.conf' }
|
||||||
register: iptables_templates_results
|
register: iptables_templates_results
|
||||||
become: yes
|
become: yes
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
# Change default port of ssh config
|
# Change default port of ssh config
|
||||||
|
|
||||||
|
ListenAddress 0.0.0.0
|
||||||
Port {{ server.ssh_port }}
|
Port {{ server.ssh_port }}
|
||||||
|
|
|
@ -2,7 +2,3 @@
|
||||||
|
|
||||||
- ansible.builtin.import_tasks: base.yml
|
- ansible.builtin.import_tasks: base.yml
|
||||||
name: base
|
name: base
|
||||||
|
|
||||||
- ansible.builtin.import_tasks: restore.yml
|
|
||||||
name: restore
|
|
||||||
when: restore.traefik.prometheus_archive and restore.traefik.grafana_archive
|
|
||||||
|
|
|
@ -1,43 +0,0 @@
|
||||||
---
|
|
||||||
|
|
||||||
- name: Copy archives
|
|
||||||
ansible.builtin.copy:
|
|
||||||
src: "{{ item.src }}"
|
|
||||||
dest: "{{ item.dest }}"
|
|
||||||
loop:
|
|
||||||
- { src: '{{ restore.traefik.prometheus_archive }}', dest: 'traefik_prometheus.tar.gz' }
|
|
||||||
- { src: '{{ restore.traefik.grafana_archive }}', dest: 'traefik_grafana.tar.gz' }
|
|
||||||
|
|
||||||
- name: Stop nextcloud container
|
|
||||||
community.docker.docker_compose:
|
|
||||||
project_src: home_assistant
|
|
||||||
state: absent
|
|
||||||
become: true
|
|
||||||
|
|
||||||
- name: Restore backup
|
|
||||||
community.docker.docker_container:
|
|
||||||
name: volume_restore
|
|
||||||
image: volume_restore:latest
|
|
||||||
auto_remove: yes
|
|
||||||
tty: true
|
|
||||||
volumes:
|
|
||||||
- "{{ item.path }}:/backup/archive.tar.gz"
|
|
||||||
- "{{ item.volume }}:/backup/dest"
|
|
||||||
loop:
|
|
||||||
- { path: './traefik_prometheus.tar.gz', volume: 'traefik_prometheus' }
|
|
||||||
- { path: './traefik_grafana.tar.gz', volume: 'traefik_grafana' }
|
|
||||||
become: true
|
|
||||||
|
|
||||||
- name: Start nextcloud container
|
|
||||||
community.docker.docker_compose:
|
|
||||||
project_src: home_assistant
|
|
||||||
state: present
|
|
||||||
become: true
|
|
||||||
|
|
||||||
- name: Remove archive
|
|
||||||
ansible.builtin.file:
|
|
||||||
path: "{{ item.path }}"
|
|
||||||
state: absent
|
|
||||||
loop:
|
|
||||||
- { path: 'traefik_prometheus.tar.gz' }
|
|
||||||
- { path: 'traefik_grafana.tar.gz' }
|
|
|
@ -115,33 +115,6 @@ services:
|
||||||
volumes:
|
volumes:
|
||||||
- ./config/dynamic_conf.yaml:/usr/local/apache2/htdocs/dynamic_conf.yaml
|
- ./config/dynamic_conf.yaml:/usr/local/apache2/htdocs/dynamic_conf.yaml
|
||||||
|
|
||||||
# BACKUP
|
|
||||||
backup_prometheus:
|
|
||||||
image: offen/docker-volume-backup:latest
|
|
||||||
restart: always
|
|
||||||
environment:
|
|
||||||
BACKUP_CRON_EXPRESSION: "{{ server.backup.cron_expression }}"
|
|
||||||
BACKUP_FILENAME: "{{ server.backup.filename_date_format }}-prometheus.tar.gz"
|
|
||||||
BACKUP_LATEST_SYMLINK: prometheus.latest.tar.gz
|
|
||||||
BACKUP_EXCLUDE_REGEXP: "\\.log$$"
|
|
||||||
BACKUP_RETENTION_DAYS: "{{ server.backup.retention_days }}"
|
|
||||||
volumes:
|
|
||||||
- prometheus:/backup:ro
|
|
||||||
- {{ server.backup.folder }}/traefik:/archive
|
|
||||||
|
|
||||||
backup_grafana:
|
|
||||||
image: offen/docker-volume-backup:latest
|
|
||||||
restart: always
|
|
||||||
environment:
|
|
||||||
BACKUP_CRON_EXPRESSION: "{{ server.backup.cron_expression }}"
|
|
||||||
BACKUP_FILENAME: "{{ server.backup.filename_date_format }}-grafana.tar.gz"
|
|
||||||
BACKUP_LATEST_SYMLINK: grafana.latest.tar.gz
|
|
||||||
BACKUP_EXCLUDE_REGEXP: "\\.log$$"
|
|
||||||
BACKUP_RETENTION_DAYS: "{{ server.backup.retention_days }}"
|
|
||||||
volumes:
|
|
||||||
- grafana:/backup:ro
|
|
||||||
- {{ server.backup.folder }}/traefik:/archive
|
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
providers:
|
providers:
|
||||||
internal:
|
internal:
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
FROM alpine:latest
|
|
||||||
|
|
||||||
RUN apk add --update --no-cache tar
|
|
||||||
|
|
||||||
RUN mkdir -p /backup/dest
|
|
||||||
|
|
||||||
COPY ./extract.sh /usr/bin/extract
|
|
||||||
|
|
||||||
RUN chmod +x /usr/bin/extract
|
|
||||||
|
|
||||||
CMD ["restore"]
|
|
|
@ -1,5 +0,0 @@
|
||||||
# HOW TO USE IT
|
|
||||||
|
|
||||||
```
|
|
||||||
docker run -v [PATH_TO_ARCHIVE]:/backup/archive.tar.gz -v [DIST_VOLUME]:/backup/dest volume_restore:latest
|
|
||||||
```
|
|
|
@ -1,3 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
rm -rf /backup/dest*
|
|
||||||
tar -xf /backup/archive.tar.gz --strip-components=1 -C /backup/dest
|
|
|
@ -1,18 +0,0 @@
|
||||||
---
|
|
||||||
|
|
||||||
- name: Copy conf
|
|
||||||
ansible.builtin.copy:
|
|
||||||
backup: true
|
|
||||||
src: .
|
|
||||||
dest: volume_restore/
|
|
||||||
register: volume_restore_copy
|
|
||||||
|
|
||||||
- name: Build image
|
|
||||||
community.docker.docker_image:
|
|
||||||
name: volume_restore
|
|
||||||
tag: latest
|
|
||||||
build:
|
|
||||||
path: volume_restore
|
|
||||||
source: build
|
|
||||||
become: yes
|
|
||||||
when: volume_restore_copy.changed
|
|
|
@ -1,4 +0,0 @@
|
||||||
---
|
|
||||||
|
|
||||||
- ansible.builtin.import_tasks: base.yml
|
|
||||||
name: base
|
|
Loading…
Reference in a new issue