From fca8f6cb4c9b94bf1986ff93730aeded9fb3a46d Mon Sep 17 00:00:00 2001 From: Antoine Martin Date: Tue, 2 Feb 2021 18:09:10 +0100 Subject: [PATCH] gitea: use own backup solution --- services/gitea.nix | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/services/gitea.nix b/services/gitea.nix index 1010afd..b481a5c 100644 --- a/services/gitea.nix +++ b/services/gitea.nix @@ -56,11 +56,10 @@ in { other.SHOW_FOOTER_VERSION = false; }; - dump = { - enable = true; - # Borg backup starts at midnight so create dump before - interval = "*-*-* 23:40:00"; - }; + # NixOS module uses `gitea dump` to backup repositories and the database, + # but it produces a single .zip file that's not very borg-backup friendly. + # I configure my backup system manually below. + dump.enable = false; database = { type = "postgres"; @@ -69,8 +68,19 @@ in { }; }; + # FIXME: Borg *could* be backing up files while they're being edited by + # gitea, so it may produce corrupt files in the snapshot if I push stuff + # around midnight. I'm not sure how `gitea dump` handles this either, + # though. my.services.borg-backup = mkIf cfg.enable { - paths = [ config.services.gitea.dump.backupDir ]; + paths = [ + config.services.gitea.lfs.contentDir + config.services.gitea.repositoryRoot + ]; + }; + + services.postgresqlBackup = mkIf my.services.postgresql-backup.enable { + databases = [ "gitea" ]; }; services.nginx = {