From 7dfbf755e13903c1106ceb5150b10c200b4accb2 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:22:53 +0200
Subject: [PATCH] [IMP] add cache and update hostname

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

diff --git a/templates/backup.yaml.j2 b/templates/backup.yaml.j2
index d704d02..32a557b 100644
--- a/templates/backup.yaml.j2
+++ b/templates/backup.yaml.j2
@@ -5,7 +5,7 @@ services:
             context: .
             dockerfile: Dockerfile-mysql
         image: filament/duplicity:mysql
-        hostname: backup-framadate
+        hostname: {{ inventory_hostname_short | lower | regex_replace('_','') }}-framadate
         environment:
             DST: "swift://framadate_{{ inventory_hostname|lower }}"
             MYSQL_DATABASE: "{{ date_db_user }}"
@@ -23,9 +23,12 @@ services:
             JOB_300_WHAT: "backup --full-if-older-than 6D"
             JOB_302_WHAT: "dup remove-all-but-n-full 5 --force $$DST $$@"
             JOB_302_WHEN: "daily"
+            OPTIONS: "--allow-source-mismatch"
         networks:
             - framadate_default
             - public
+        volumes:
+            - date_backup_cache:/root/.cache/duplicity/
         command:
             - /etc/periodic/daily/jobrunner
 
@@ -35,3 +38,6 @@ networks:
     public:
         driver_opts:
             encrypted: 1
+
+volumes:
+    date_backup_cache:
diff --git a/templates/backup2.yaml.j2 b/templates/backup2.yaml.j2
index 0d67efc..df531ec 100644
--- a/templates/backup2.yaml.j2
+++ b/templates/backup2.yaml.j2
@@ -5,7 +5,7 @@ services:
             context: .
             dockerfile: Dockerfile-mysql
         image: filament/duplicity:mysql
-        hostname: backup-framadate
+        hostname: {{ inventory_hostname_short | lower | regex_replace('_','') }}-framadate
         environment:
             DST: "swift://framadate_{{ inventory_hostname|lower }}"
             MYSQL_DATABASE: "{{ date_db_user }}"
@@ -23,9 +23,12 @@ services:
             JOB_300_WHAT: "backup --full-if-older-than 6D"
             JOB_302_WHAT: "dup remove-all-but-n-full 5 --force $$DST $$@"
             JOB_302_WHEN: "daily"
+            OPTIONS: "--allow-source-mismatch"
         networks:
             - framadate_default
             - public
+        volumes:
+            - date_backup2_cache:/root/.cache/duplicity/
         command:
             - /etc/periodic/daily/jobrunner
 
@@ -35,3 +38,6 @@ networks:
     public:
         driver_opts:
             encrypted: 1
+
+volumes:
+    date_backup2_cache:
-- 
GitLab