From 3ac327a750bbf7d56943788319200de34f732719 Mon Sep 17 00:00:00 2001 From: teutat3s Date: Sun, 3 Dec 2023 13:11:25 +0100 Subject: [PATCH] feat: backup matrix-synapse, matrix-appservice-irc, mautrix-telegram to storagebox --- hosts/nachtigall/apps/matrix/synapse.nix | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/hosts/nachtigall/apps/matrix/synapse.nix b/hosts/nachtigall/apps/matrix/synapse.nix index 0999038b..8425880f 100644 --- a/hosts/nachtigall/apps/matrix/synapse.nix +++ b/hosts/nachtigall/apps/matrix/synapse.nix @@ -222,4 +222,25 @@ in { config.services.matrix-synapse.package.plugins.matrix-synapse-shared-secret-auth ]; }; + + services.restic.backups.matrix-synapse-storagebox = { + paths = [ + "/var/lib/matrix-synapse" + "/var/lib/matrix-appservice-irc" + "/var/lib/mautrix-telegram" + "/tmp/matrix-synapse-backup.sql" + ]; + timerConfig = { + OnCalendar = "*-*-* 05:00:00 Etc/UTC"; + }; + initialize = true; + passwordFile = config.age.secrets."restic-repo-storagebox".path; + repository = "sftp:u377325@u377325.your-storagebox.de:/backups"; + backupPrepareCommand = '' + ${pkgs.sudo}/bin/sudo -u postgres ${pkgs.postgresql}/bin/pg_dump -d matrix > /tmp/matrix-synapse-backup.sql + ''; + backupCleanupCommand = '' + rm /tmp/matrix-synapse-backup.sql + ''; + }; }