diff --git a/group_vars/all.yml b/group_vars/all.yml index 794e1ea..4292928 100644 --- a/group_vars/all.yml +++ b/group_vars/all.yml @@ -2,6 +2,10 @@ # Global configuration server: domain: mrdev023.test + backup: + folder: /backup + cron_expression: "0 2 * * *" + retention_days: 7 acme: email: florian.richer.97@outlook.com debug: true diff --git a/roles/cloud/templates/docker-compose.yml.j2 b/roles/cloud/templates/docker-compose.yml.j2 index 5446e08..cb3eaa0 100644 --- a/roles/cloud/templates/docker-compose.yml.j2 +++ b/roles/cloud/templates/docker-compose.yml.j2 @@ -58,6 +58,32 @@ services: - POSTGRES_HOST=db - OVERWRITEPROTOCOL=https + 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_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: "%Y-%m-%d-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: nextcloud: db: