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 + ''; + }) ]; }