From 4936bc48b2f0319e7c6ada79b9d9e4198ae55891 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:23:38 +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 9fd8bb0..8a42ad0 100644
--- a/templates/backup.yaml.j2
+++ b/templates/backup.yaml.j2
@@ -2,7 +2,7 @@ version: "2.1"
 services:
     backup_gitlab:
         image: tecnativa/duplicity:postgres
-        hostname: backup-gitlab
+        hostname: {{ inventory_hostname_short | lower | regex_replace('_','') }}-gitlab
         environment:
             DST: "swift://gitlab_{{ inventory_hostname|lower }}"
             PGDATABASE: "none"
@@ -23,9 +23,11 @@ services:
         command:
             - /etc/periodic/daily/jobrunner
         volumes:
+            - gitlab_backup_cache:/root/.cache/duplicity/
             - gitlab_config:/mnt/backup/src/config:z
             - /var/lib/docker/volumes/gitlab_data/_data/backups/:/mnt/backup/src/data_backups:z
 
 volumes:
+    gitlab_backup_cache:
     gitlab_config:
         external: true
diff --git a/templates/backup2.yaml.j2 b/templates/backup2.yaml.j2
index 9f4e61c..ec54cac 100644
--- a/templates/backup2.yaml.j2
+++ b/templates/backup2.yaml.j2
@@ -2,7 +2,7 @@ version: "2.1"
 services:
     backup_gitlab:
         image: tecnativa/duplicity:postgres
-        hostname: backup-gitlab
+        hostname: {{ inventory_hostname_short | lower | regex_replace('_','') }}-gitlab
         environment:
             DST: "swift://gitlab_{{ inventory_hostname|lower }}"
             PGDATABASE: "none"
@@ -23,9 +23,11 @@ services:
         command:
             - /etc/periodic/daily/jobrunner
         volumes:
+            - gitlab_backup2_cache:/root/.cache/duplicity/
             - gitlab_config:/mnt/backup/src/config:z
             - /var/lib/docker/volumes/gitlab_data/_data/backups/:/mnt/backup/src/data_backups:z
 
 volumes:
+    gitlab_backup2_cache:
     gitlab_config:
         external: true
-- 
GitLab