From 5fc1b7ae743fe25744289744e99cf7434d6b0331 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Sun, 7 Feb 2021 20:43:15 +0000 Subject: [PATCH] services: gitea: add state to backup Because I think `restic` will not deal with the compressed format of `gitea`'s native `dump` command, I set up a manual backup. This could lead to potentially corrupted data if I happen to backup at the exact same time as a push to a repository. However given the frequency of backups planned, I assume that most of them will be fine. --- services/gitea.nix | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/services/gitea.nix b/services/gitea.nix index 19551a6..7ccacee 100644 --- a/services/gitea.nix +++ b/services/gitea.nix @@ -38,6 +38,11 @@ in type = "postgres"; # Automatic setup user = "git"; # User needs to be the same as gitea user }; + + # NixOS module uses `gitea dump` to backup repositories and the database, + # but it produces a single .zip file that's not very backup friendly. + # I configure my backup system manually below. + dump.enable = false; }; users.users.git = { @@ -61,5 +66,12 @@ in locations."/".proxyPass = "http://localhost:${toString cfg.port}/"; }; + + my.services.backup = { + paths = [ + config.services.gitea.lfs.contentDir + config.services.gitea.repositoryRoot + ]; + }; }; }