How-to: Maintenance Mode for Nextcloud in UCS

Maintenance Mode for Nextcloud in UCS

Overview

When upgrading Nextcloud in a Univention Corporate Server (UCS) environment, it is recommended to enable maintenance mode beforehand. This prevents users from accessing the application during the update, thereby avoiding data inconsistencies or unexpected errors.
This article describes the safest way to update Nextcloud when it is running as a Univention App in a Docker container.


Step 1: Identify the Running Container

Check which Nextcloud container is currently running:

root@nc001:~# docker ps
CONTAINER ID   IMAGE                                               COMMAND                  CREATED        STATUS       PORTS                                     NAMES
55a25fb4010f   docker.software-univention.de/nextcloud:29.0.11-0   "/bin/sh -c /usr/sbi…"   5 months ago   Up 4 weeks   0.0.0.0:40000->80/tcp, :::40000->80/tcp   clever_chaplygin

Step 2: Enable Maintenance Mode

Before starting the upgrade, enable maintenance mode to prevent user access:

univention-app shell nextcloud sudo -u www-data /var/www/html/occ maintenance:mode --on

Maintenance mode enabled

Verify that it is enabled:

univention-app shell nextcloud sudo -u www-data /var/www/html/occ maintenance:mode

Maintenance mode is currently enabled

Step 3: Update the App Center and Upgrade Nextcloud

First, update the Univention App Center:

univention-app update

Then upgrade the Nextcloud application:

univention-app upgrade nextcloud


Step 4: Verify the Upgrade

After the upgrade is complete, check the installed Nextcloud version:

root@nc001:~# univention-app info
UCS: 5.0-10 errata1294
Installed: nextcloud=30.0.15-0
Upgradable: 

Confirm that a new container is running with the updated version:

root@nc001:~# docker ps
CONTAINER ID   IMAGE                                               COMMAND                  CREATED         STATUS         PORTS                                     NAMES
2988ae3333db   docker.software-univention.de/nextcloud:30.0.15-0   "/bin/sh -c /usr/sbi…"   4 minutes ago   Up 4 minutes   0.0.0.0:40000->80/tcp, :::40000->80/tcp   intelligent_joliot

Step 5: Disable Maintenance Mode

Once the upgrade is complete and verified, disable maintenance mode to allow users to access Nextcloud again:

univention-app shell nextcloud sudo -u www-data /var/www/html/occ maintenance:mode --off

Maintenance mode disabled

Conclusion

By enabling and disabling maintenance mode during a Nextcloud upgrade in UCS, administrators can ensure a safe and consistent update process without user interruptions or data corruption.

1 Like