From d0574da4b11371806d533f5fe2363d630b7bb17c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20-=20Le=20Filament?= <remi@le-filament.com>
Date: Tue, 3 Aug 2021 12:24:54 +0200
Subject: [PATCH] [IMP] add cache and update hostname

---
 templates/backup.yaml.j2  | 4 +++-
 templates/backup2.yaml.j2 | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/templates/backup.yaml.j2 b/templates/backup.yaml.j2
index 549a313..83a8b35 100644
--- a/templates/backup.yaml.j2
+++ b/templates/backup.yaml.j2
@@ -2,7 +2,7 @@ version: "2.1"
 services:
     backup_mattermost:
         image: tecnativa/duplicity:postgres
-        hostname: backup-mattermost
+        hostname: {{ inventory_hostname_short | lower | regex_replace('_','') }}-mattermost
         environment:
             DST: "swift://mattermost_{{ inventory_hostname|lower }}"
             PGDATABASE: "{{ mm_db_name }}"
@@ -20,6 +20,7 @@ services:
             JOB_302_WHAT: "dup remove-all-but-n-full 5 --force $$DST $$@"
             JOB_302_WHEN: "daily"
         volumes:
+            - mattermost_backup_cache:/root/.cache/duplicity/
             - mattermost_config:/mnt/backup/src/config:z
             - mattermost_data:/mnt/backup/src/data:z
             - mattermost_plugins:/mnt/backup/src/plugins:z
@@ -38,6 +39,7 @@ networks:
             encrypted: 1
 
 volumes:
+    mattermost_backup_cache:
     mattermost_config:
         external: true
     mattermost_data:
diff --git a/templates/backup2.yaml.j2 b/templates/backup2.yaml.j2
index 207e3e5..08e89f4 100644
--- a/templates/backup2.yaml.j2
+++ b/templates/backup2.yaml.j2
@@ -2,7 +2,7 @@ version: "2.1"
 services:
     backup_mattermost:
         image: tecnativa/duplicity:postgres
-        hostname: backup-mattermost
+        hostname: {{ inventory_hostname_short | lower | regex_replace('_','') }}-mattermost
         environment:
             DST: "swift://mattermost_{{ inventory_hostname|lower }}"
             PGDATABASE: "{{ mm_db_name }}"
@@ -20,6 +20,7 @@ services:
             JOB_302_WHAT: "dup remove-all-but-n-full 5 --force $$DST $$@"
             JOB_302_WHEN: "daily"
         volumes:
+            - mattermost_backup2_cache:/root/.cache/duplicity/
             - mattermost_config:/mnt/backup/src/config:z
             - mattermost_data:/mnt/backup/src/data:z
             - mattermost_plugins:/mnt/backup/src/plugins:z
@@ -38,6 +39,7 @@ networks:
             encrypted: 1
 
 volumes:
+    mattermost_backup2_cache:
     mattermost_config:
         external: true
     mattermost_data:
-- 
GitLab