Browse Source

add restic to stereodon, using rsyncable pigz

lesion 2 years ago
parent
commit
b2a32a8b9e
3 changed files with 18 additions and 5 deletions
  1. 14 4
      backup.yml
  2. 3 0
      inventory.yml
  3. 1 1
      roles/stable/restic/templates/restic-backup.service.j2

+ 14 - 4
backup.yml

@@ -1,9 +1,19 @@
 ---
-## FRONTEND
-- name: Test backup
+- name: Mastodon backup
   hosts: mastodon
   roles: ['stable/restic']
   vars:
+    restic_dump_compression_enabled: true
     restic_databases:
-      - {name: 'mastodon', dump_command: sudo -Hiu postgres pg_dump -Fc mastodon}
-    restic_folders: ['/var/lib/redis/dump.rdb','/home/mastodon/live/.env.production']
+      - {name: 'mastodon', dump_command: sudo -Hiu postgres pg_dump -Z0 -Fc mastodon}
+    restic_folders: ['/var/lib/redis/dump.rdb','/home/mastodon/live/.env.production']
+
+- name: Stereodon Backup
+  hosts: stereodon
+  roles: ['stable/restic']
+  vars:
+    restic_dump_compression_enabled: true
+    restic_databases:
+      - {name: 'stereodon', dump_command: sudo -Hiu postgres pg_dump -Z0 -Fc mastodon}
+    restic_folders: ['/var/lib/redis/dump.rdb','/home/mastodon/live/.env.production']
+

+ 3 - 0
inventory.yml

@@ -13,6 +13,9 @@ cicles:
 mastodon:
   hosts: cisti.mastodon
 
+stereodon:
+  hosts: cisti.stereodon
+
 farma:
   hosts: cisti.farma
 

+ 1 - 1
roles/stable/restic/templates/restic-backup.service.j2

@@ -32,7 +32,7 @@ ExecStart={{ restic_path }} backup --verbose {{ folder }}
 {% endfor -%}
 
 {% for database in restic_databases %}
-ExecStart=/bin/sh -c "{{ database.dump_command }} {{ '| pigz |' if restic_dump_compression_enabled else '|' }} {{ restic_path }} backup --verbose --stdin --stdin-filename {{ database.name }}{{ '.sql.gz' if restic_dump_compression_enabled else '.sql' }}"
+ExecStart=/bin/sh -c "{{ database.dump_command }} {{ '| pigz --rsyncable |' if restic_dump_compression_enabled else '|' }} {{ restic_path }} backup --verbose --stdin --stdin-filename {{ database.name }}{{ '.sql.gz' if restic_dump_compression_enabled else '.sql' }}"
 {% endfor -%}
 
 {% if restic_forget %}