Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Image deletes everything when upgrade.exclude does not exist #1967

Closed
HyggesAlpaka opened this issue Apr 14, 2023 · 3 comments
Closed

Image deletes everything when upgrade.exclude does not exist #1967

HyggesAlpaka opened this issue Apr 14, 2023 · 3 comments
Labels
data persistence Volumes, bind mounts, etc. enhancement feature: upgrading Upgrading an existing deployment to a new image/NC version

Comments

@HyggesAlpaka
Copy link

Is:

  • I wanted to migrate existing Nextcloud Instanz to Docker
  • Nextcloud Instanz was hosted directly on the Server
  • I mounted the Nextcloud Instanz folder into the container
  • Everything was deleted (I had Backups...so luckily not that big of a problem in that case)

Root-Cause:

  • docker-entrypoint.sh deletes stuff for a proper update, when the Version of the Image an the installed version mismatches
  • docker-entrypoint.sh uses upgrade.exclude to exclude folders for deletion such as /data
  • When upgrade.exclude doesn't exists everything is deleted

Should:

  • docker-entrypoint.sh fails when upgrade.exclude doesn't exists
@joshtrichards
Copy link
Member

Ugh. Agreed. Sounds like you discovered this the hard way!

We should add a check for the file's existence anywhere above here:

rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/nextcloud/ /var/www/html/

I wonder if it's also worth making sure that, at a minimum, the six entries we ship in that list are simply always in there. In effect always including these ones:

https://github.com/nextcloud/docker/blob/master/upgrade.exclude#L1-L6

...by hard coding them in the entrypoint and then making the /upgrade.exclude file additive only. 🤔

@joshtrichards joshtrichards added feature: upgrading Upgrading an existing deployment to a new image/NC version good first issue labels Oct 25, 2023
@joshtrichards joshtrichards changed the title Image deletes everything when upgrade.exclude does not exists Image deletes everything when upgrade.exclude does not exist Oct 25, 2023
@joshtrichards
Copy link
Member

joshtrichards commented Oct 25, 2023

  • I mounted the Nextcloud Instanz folder into the container
  • Everything was deleted (I had Backups...so luckily not that big of a problem in that case)
    Root-Cause:

Wait, are you sure you didn't just mount your old (source) "Nextcloud Instanz folder" underneath /var/www/html (i.e. /var/www/html/foo)? It would have been deleted, but not due to a missing /upgrade.exclude. Rather because the unexpected folder ( /var/www/html/foo) was added under /var/www/html and also not added to /upgrade.exclude.

That's currently expected and documented behavior:

https://github.com/nextcloud/docker#persistent-data

Though it wasn't well documented until relatively recently in #1862 (and perhaps it could still use a better call out or it's own heading since it's easy to miss at the end of the Persistent Data section).

@joshtrichards joshtrichards added the data persistence Volumes, bind mounts, etc. label Oct 25, 2023
@HyggesAlpaka
Copy link
Author

Hi @joshtrichards ,

Sorry for my late response. Sounds on the one hand plausible, but then I must have seen an empty folder on my server, right? But I had a new nextcloud instanz under my old server folder with an empty data folder and a new config etc.
But when I see it correct, then the upgrade.exclude is not in the /var/www/html, so that couldn't be the issue...maybe a misconception on my side. I thought I have overwritten the upgrade.exclude in the /var/www/html due to my mounting.

I'll close this issue. I don't think it makes sense to further investigate this, as I can't give more infos (too long ago and I don't have the server anymore) and my first assumption turned out as wrong. Sorry for the inconvenience.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
data persistence Volumes, bind mounts, etc. enhancement feature: upgrading Upgrading an existing deployment to a new image/NC version
Projects
None yet
Development

No branches or pull requests

3 participants