From 3a44530844e0693b1d5da7ecc04369b7f4bed0a6 Mon Sep 17 00:00:00 2001 From: Pierre Penninckx Date: Mon, 2 Sep 2024 20:22:53 -0700 Subject: [PATCH] apply Nextcloud expensive migrations on service start (#294) --- modules/services/nextcloud-server.nix | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/modules/services/nextcloud-server.nix b/modules/services/nextcloud-server.nix index d2be7a8..c224ca6 100644 --- a/modules/services/nextcloud-server.nix +++ b/modules/services/nextcloud-server.nix @@ -560,6 +560,17 @@ in This is useful if a deploy failed and you try to redeploy. ''; }; + + alwaysApplyExpensiveMigrations = lib.mkOption { + type = lib.types.bool; + default = true; + description = '' + Run `occ maintenance:repair --include-expensive` on service start. + + Larger instances should disable this and run the command at a convenient time + but Self Host Blocks assumes that it will not be the case for most users. + ''; + }; }; config = lib.mkMerge [ @@ -1007,5 +1018,14 @@ in fi ''; }) + + (lib.mkIf (cfg.enable && cfg.alwaysApplyExpensiveMigrations) { + systemd.services.nextcloud-setup.script = + '' + if [[ -e /var/lib/nextcloud/config/config.php ]]; then + ${occ} maintenance:repair --include-expensive + fi + ''; + }) ]; }