From 68a72dbb1549227a5a24306c6e5dd36f92616a73 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:21:54 +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 a6ddd96..5c22941 100644
--- a/templates/backup.yaml.j2
+++ b/templates/backup.yaml.j2
@@ -2,7 +2,7 @@ version: "2.1"
 services:
     backup_etherpad:
         image: tecnativa/duplicity:postgres
-        hostname: backup-etherpad
+        hostname: {{ inventory_hostname_short | lower | regex_replace('_','') }}-etherpad
         environment:
             DST: "swift://etherpad_{{ inventory_hostname|lower }}"
             PGDATABASE: "{{ pad_db_name }}"
@@ -19,9 +19,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:
             - etherpad_default
             - public
+        volumes:
+            - pad_backup_cache:/root/.cache/duplicity/
         command:
             - /etc/periodic/daily/jobrunner
 
@@ -31,3 +34,6 @@ networks:
     public:
         driver_opts:
             encrypted: 1
+
+volumes:
+    pad_backup_cache:
diff --git a/templates/backup2.yaml.j2 b/templates/backup2.yaml.j2
index 10cc07e..693698a 100644
--- a/templates/backup2.yaml.j2
+++ b/templates/backup2.yaml.j2
@@ -2,7 +2,7 @@ version: "2.1"
 services:
     backup_etherpad:
         image: tecnativa/duplicity:postgres
-        hostname: backup-etherpad
+        hostname: {{ inventory_hostname_short | lower | regex_replace('_','') }}-etherpad
         environment:
             DST: "swift://etherpad_{{ inventory_hostname|lower }}"
             PGDATABASE: "{{ pad_db_name }}"
@@ -19,9 +19,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:
             - etherpad_default
             - public
+        volumes:
+            - pad_backup2_cache:/root/.cache/duplicity/
         command:
             - /etc/periodic/daily/jobrunner
 
@@ -31,3 +34,6 @@ networks:
     public:
         driver_opts:
             encrypted: 1
+
+volumes:
+    pad_backup2_cache:
-- 
GitLab