Add container to automatically backup DBs

This commit is contained in:
Jake Howard
2022-01-16 16:55:40 +00:00
parent 6c0314b758
commit 5cc552d0eb
14 changed files with 97 additions and 70 deletions

View File

@ -0,0 +1 @@
db_backups_dir: ./backups

View File

@ -0,0 +1,11 @@
version: "2.3"
services:
backup:
image: ghcr.io/realorangeone/db-auto-backup:latest
restart: unless-stopped
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- "{{ db_backups_dir }}:/var/backups"
environment:
- HEALTHCHECKS_ID={{ db_auto_backup_healthchecks_id }}

View File

@ -0,0 +1,4 @@
- name: restart db-auto-backup
shell:
chdir: /opt/db-auto-backup
cmd: "{{ docker_update_command }}"

View File

@ -0,0 +1,17 @@
- name: Create install directory
file:
path: /opt/db-auto-backup
state: directory
owner: "{{ docker_user.name }}"
mode: "{{ docker_compose_directory_mask }}"
become: true
- name: Install compose file
template:
src: files/docker-compose.yml
dest: /opt/db-auto-backup/docker-compose.yml
mode: "{{ docker_compose_file_mask }}"
owner: "{{ docker_user.name }}"
validate: docker-compose -f %s config
notify: restart db-auto-backup
become: true

View File

@ -0,0 +1 @@
db_auto_backup_healthchecks_id: "{{ vault_db_auto_backup_healthchecks_id }}"