From f1aa9639f5b01a5f0d83d6d359fd4c65b4e66287 Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Fri, 17 Apr 2026 23:33:24 -0400 Subject: [PATCH] Complete documentation of the Nextcloud upgrade process --- services/nextcloud/upgrading.md | 34 +++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/services/nextcloud/upgrading.md b/services/nextcloud/upgrading.md index 4033d07..a17e721 100644 --- a/services/nextcloud/upgrading.md +++ b/services/nextcloud/upgrading.md @@ -1,16 +1,30 @@ -Steps to upgrade Nextcloud from one version to another. +Steps to upgrade Nextcloud from one major version to the next. -1. Put the Nextcloud instance into maintenance mode - docker exec --user www-data nextcloud-app-1 php occ maintenance:mode --on +1. Put the Nextcloud instance into maintenance mode + docker exec --user www-data nextcloud-app-1 php occ maintenance:mode --on - Note that 'docker exec' is used to run commands within the Nextcloud docker container; and '--user www-data' is used to run as the user that owns all of the Nextcloud files. + Note that 'docker exec' is used to run commands within the Nextcloud docker container; and '--user www-data' is used to run as the user that owns all of the Nextcloud files. +2. Back up the Nextcloud container's files to a location outside the container's mounted volume. 'rsync' is recommended: -2. Back up the Nextcloud container's files to a location outside the container's mounted volume. 'rsync' is recommended: + rsync -Aavx /mnt/storage/appdata/nextcloud/www/ / - rsync -Aavx /mnt/storage/appdata/nextcloud/www/ / + rsync should be run as root. rsync with these options should preserve file ownership & permissions. + +3. Back up MariaDB database: - rsync should be run as root. rsync with these options should preserve file ownership & permissions + docker exec nextcloud-db-container-name mysqldump --single-transaction -h localhost -u nextcloud_user -pnextcloud_password nextcloud_db_name > nextcloud-sqlbkp_$(date +"%Y%m%d").bak +4. Alternatively, if the Nextcloud files and database are stored in a ZFS dataset, take a ZFS snapshot of the relevant dataset(s). -3. Back up MariaDB database: - - docker exec nextcloud-db-container-name mysqldump --single-transaction -h localhost -u nextcloud_user -pnextcloud_password nextcloud_db_name > nextcloud-sqlbkp_$(date +"%Y%m%d").bak +5. Bring the Nextcloud instance down: + sudo docker compose down +6. Edit the compose.yaml file and change the tag on the Nextcloud image to the next major version number. +7. Pull the next version of the Nextcloud image: + sudo docker compose pull +8. Bring up the Nextcloud instance: + sudo docker compose up -d +9. Wait a minute or so and bring up the Nextcloud web client in your browser. Open the Administrative Settings Overview page and check for any issues. +10. If the Overview page recommends any occ commands: + * Put the instance into maintenance mode : docker exec -u www-data nextcloud-app-1 php occ maintenance:mode --on + * Run the occ commands recommended (for example, docker exec -u www-data nextcloud-app-1 php occ db:add-missing-indices) + * Take the instance out of maintenance mode: docker exec -u www-data nextcloud-app-1 php occ maintenance:mode --off + \ No newline at end of file