docker icon indicating copy to clipboard operation
docker copied to clipboard

Adding feasibility check for updates before replacing the nextcloud files

Open SnowMB opened this issue 5 years ago • 3 comments

I'm creating this issue to collect all the other issues related to broken updates that try to skip a major release.

Nextcloud does not support skipping a major release while updating. So going from 13->15 will not work without including version 14: 13->14->15.

The problem is, that the entrypoint script correctly detects that the image version is greater, but does not check if the upgrade is feasible. So it overwrites the Nextcloud files (including version.php) and does not fail until running the occ upgrade command run_as 'php /var/www/html/occ upgrade'.

Upgrading fails and the container exits, but the user can't go back to his initial state because the Nextcloud source files are already replaced. He also can't trigger a proper update from 13->14 because the upgrade detection is broken (version.php now falsely claims version 15).

#597 in my opinion does not enough, but is a good start to at least document that Nextcloud might break when updating. However a check should be introduced to protect the Nextcloud install in that case. I think it is no problem, that running the new containers fails, but the Nextcloud instance should be unharmed.

related issues: #616 #605 #585 #722

SnowMB avatar Jan 23 '19 12:01 SnowMB

To repair broken upgrades (a broken upgrade in that sense that a new nextcloud version is copied over the older one, but the ooc::upgrade failed), we could introduce a flag that allows downgrades (copy the older nextcloud version over the newer one in /var/www/html). So users could at least repair their setup by simply going back to their previous version or to the correct upgrade path.

This could also fix broken installs that time out on the rsync copy. Or let's the user decide to recopy the nextcloud files if he suspects an error.

SnowMB avatar Mar 19 '19 06:03 SnowMB

Fixed

I pieced a dozen old threads together and came up with a detailed solution: https://nicolasbouliane.com/blog/nextcloud-docker-upgrade-error

tl;dr: If you're stuck in that situation, do this:

  1. Find your old version in config/config.php
  2. Put that version everywhere in version.php
  3. Roll back the docker image to that old version
  4. Upgrade the image one major version at a time
  5. Turn off maintenance mode

nicbou avatar Dec 10 '20 19:12 nicbou

See also https://github.com/nextcloud/docker/issues/1129 and https://github.com/nextcloud/server/issues/2270

There is a workaround for it in https://github.com/nextcloud/docker/pull/1304

J0WI avatar Feb 02 '22 23:02 J0WI