From 6da0a4b9888c1a2d1d58f932174f79921b21d8fe Mon Sep 17 00:00:00 2001 From: ibizaman Date: Sun, 1 Sep 2024 21:36:33 +0200 Subject: [PATCH] disable nextcloud maintenance mode on service restart --- CHANGELOG.md | 1 + modules/services/nextcloud-server.nix | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 92690b6..9a51426 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ - `shb.authelia.oidcClients.description` -> `shb.authelia.oidcClients.client_name` - `shb.authelia.oidcClients.secret` -> `shb.authelia.oidcClients.client_secret` - `shb.authelia.ldapEndpoint` -> `shb.authelia.ldapHostname` and `shb.authelia.ldapPort` +- Make Nextcloud automatically disable maintenance mode upon service restart. ## User Facing Backwards Compatible Changes diff --git a/modules/services/nextcloud-server.nix b/modules/services/nextcloud-server.nix index ee0208b..8999b6f 100644 --- a/modules/services/nextcloud-server.nix +++ b/modules/services/nextcloud-server.nix @@ -550,6 +550,16 @@ in default = null; example = "debug_me"; }; + + autoDisableMaintenanceModeOnStart = lib.mkOption { + type = lib.types.bool; + default = true; + description = '' + Upon starting the service, disable maintenance mode if set. + + This is useful if a deploy failed and you try to redeploy. + ''; + }; }; config = lib.mkMerge [ @@ -988,5 +998,13 @@ in } ]; }) + (lib.mkIf cfg.autoDisableMaintenanceModeOnStart { + systemd.services.nextcloud-setup.preStart = + lib.mkBefore '' + if [[ -e /var/lib/nextcloud/config/config.php ]]; then + ${occ} maintenance:mode --no-interaction --quiet --off + fi + ''; + }) ]; }