From f3a56262bdb4637d43d31673b0f3349b789486e2 Mon Sep 17 00:00:00 2001 From: TheWanderingCrow Date: Sun, 26 Jan 2025 08:41:18 -0500 Subject: [PATCH] enable backups for bookstack --- modules/users/overseer/services/bookstack.nix | 20 +++++++++++++++++++ modules/users/overseer/setup.nix | 1 + 2 files changed, 21 insertions(+) diff --git a/modules/users/overseer/services/bookstack.nix b/modules/users/overseer/services/bookstack.nix index bbccecf..2d8f448 100644 --- a/modules/users/overseer/services/bookstack.nix +++ b/modules/users/overseer/services/bookstack.nix @@ -1,5 +1,9 @@ +let + volumePath = "/overseer/services"; +in { lib, + pkgs, config, ... }: @@ -7,6 +11,22 @@ lib.mkIf config.user.overseer.enable { sops.secrets."bookstack/key" = { owner = "bookstack"; }; + + services.restic.backups.bookstack = { + user = "root"; + timerConfig = { + OnCalendar = "daily"; + Persistent = true; + }; + backupPrepareCommand = "${pkgs.mariadb}/bin/mysqldump -u root bookstack > ${volumePath}/tmp/bookstack.sql"; + backupCleanupCommand = "rm ${volumePath}/tmp/bookstack.sql"; + paths = [ + "/var/lib/bookstack" + "${volumePath}/tmp/bookstack.sql" + ]; + repositoryFile = config.sops.secrets."restic/url".path; + passwordFile = config.sops.secrets."restic/key".path; + }; services.bookstack = { enable = true; diff --git a/modules/users/overseer/setup.nix b/modules/users/overseer/setup.nix index 5eb25f9..0024eaf 100644 --- a/modules/users/overseer/setup.nix +++ b/modules/users/overseer/setup.nix @@ -12,6 +12,7 @@ in # Base dir systemd.tmpfiles.rules = [ "d ${volumePath}" + "D ${volumePath}/tmp - - - 30m" ]; # NGINX Ports