From 9068dfa00c8dd18e078efbc27748596545bb8d5f Mon Sep 17 00:00:00 2001 From: teutat3s Date: Sun, 25 Aug 2024 03:29:25 +0200 Subject: [PATCH] obs-portal: add backups Restic backups to garage S3 bucket --- modules/obs-portal/default.nix | 25 ++++++++++++++++++ secrets/restic-repo-garage-obs-portal-env.age | Bin 0 -> 2533 bytes secrets/restic-repo-garage-obs-portal.age | Bin 0 -> 2434 bytes secrets/secrets.nix | 2 ++ 4 files changed, 27 insertions(+) create mode 100644 secrets/restic-repo-garage-obs-portal-env.age create mode 100644 secrets/restic-repo-garage-obs-portal.age diff --git a/modules/obs-portal/default.nix b/modules/obs-portal/default.nix index e2733bf..8a15c0c 100644 --- a/modules/obs-portal/default.nix +++ b/modules/obs-portal/default.nix @@ -147,4 +147,29 @@ in }; }; }; + + services.restic.backups.obs-portal-garage = { + paths = [ + "/var/lib/obs-portal/data" + "/tmp/obs-portal-backup.sql" + ]; + timerConfig = { + OnCalendar = "*-*-* 00:30:00 Etc/UTC"; + }; + initialize = true; + passwordFile = config.age.secrets."restic-repo-garage-obs-portal".path; + environmentFile = config.age.secrets."restic-repo-garage-obs-portal-env".path; + repository = "s3:https://buckets.pub.solar/obs-portal-backups"; + backupPrepareCommand = '' + ${pkgs.docker}/bin/docker exec -ti --user postgres obs-portal-db pg_dump obs > /tmp/obs-portal-backup.sql + ''; + backupCleanupCommand = '' + rm /tmp/obs-portal-backup.sql + ''; + pruneOpts = [ + "--keep-daily 7" + "--keep-weekly 4" + "--keep-monthly 3" + ]; + }; } diff --git a/secrets/restic-repo-garage-obs-portal-env.age b/secrets/restic-repo-garage-obs-portal-env.age new file mode 100644 index 0000000000000000000000000000000000000000..ce4f1abdb01c8e971e613082243625d569519ea9 GIT binary patch literal 2533 zcmZ9NN$Bhb9mfS5&sBYoW7ULWLI1=ne3CyWY0t>W}i$l*>?~@^j!p{^dcxK z2*MMDDk8X^To4Z~Ra~mYrB^MLB2o~X9(w4z|KJ0^@8%`Z{iq0}s^4qe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x` I|K)f6A2a1%9{>OV literal 0 HcmV?d00001 diff --git a/secrets/restic-repo-garage-obs-portal.age b/secrets/restic-repo-garage-obs-portal.age new file mode 100644 index 0000000000000000000000000000000000000000..7f81fd012d3df984c949ca2eab27944008cee8a8 GIT binary patch literal 2434 zcmZXWxym#N6^6}(iUkFe56monYu`YH+PAKK?FNJD+V{P?y2Qi_5KN3TF*P-vOwdqF zCNvnGL<|KTknuAZ(3vZE&N;lxNy_{~KBUWQ+Ujxm-nf*|0|7q#@NHeI4|#?X1j4-4 zg5EsKH(T0uqGn&3dwP9-zsaMn3vI(`eFza{L*3(08u4i~6$fC7i6<}^Ld{opYltN? zmV5@&Zg?PI#29$x`w~ILbgPjaoi9}p3s{-9IV|kM_kNT>QEdVmi!?LH59x^GdJ8i`CLi+nguw4s0otk*O(50L2|s{BHbN_ zwiNJzwGN>gL29WwU2P0xwDr{oHxM4Smzcqswui9(~2K8K$EyR+52V?j_()l|eHB5$sq-3k$u- zPg)FTgm8BekuznaoI=SaaCF2nFc+FleYWIyIffi2ScM)yHY^jhqy{xBQPr>{L)>4X zyKp{yV!^J&y}E_Wjjo(t)3|&$TX$^df#vcQw6|8J07SMP&e?gG0?mpm3tPLa4yQdM z4^;@Nh`R%HZLDu|2gIdGL~^cUd1bqo!qag*Nd&r-(~&;j)?A=Fi|SSn30~VOUCbLX zU781{(WM{4pbh2WV2Ll&wwBl^AHB8_@rsdv_^zMyVxMSdtypdm*u}bKGSPP#A`K2d z_=;*n1^PPDDs%Lm+b`H2we+JuRa1P7B0%%Znedkv#G|e2w$by_m_8{Qe(jRue(h(f ztGF5Ulj#3++)9E6vw)Xg1>4qMIon^4-r25qj7+I~9o?*xp(O6kyez?syv93K9xID3 z+8u@lp+9elQQ{Q^4j;5);kn&)T3J;>ncTXAW1+TJoaUyRY|a_d z(I5!WBho|`Sgx9kHzix+N2|(f>&}Qw9g@Om<#Hyudsi&^eF}-;1rz3z0w>t+?CNN5 z0B@KJSwc;g@gtiKL&}=i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