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

Check if volume contains older version of WordPress and update it #272

Open
wants to merge 2 commits into
base: master
from

Conversation

Projects
None yet
7 participants
@flojon

flojon commented Jan 7, 2018

If the volume already contains a version of WordPress compare it to the version contained in the image. If older then copy the new version to the volume.

This should solve #156 also see #174

@lwm

This comment has been minimized.

lwm commented Feb 21, 2018

Thanks for submitting this @flojon! There's a bunch of us waiting for this to go in 🌈

@flojon

This comment has been minimized.

flojon commented Feb 21, 2018

You're welcome! 😁

@brianpetersencornell

This comment has been minimized.

brianpetersencornell commented Feb 27, 2018

I am pretty new to docker as well as wordpress so please forgive me if this is a dumb question.

If I understand correctly the update will happen when the container is run NOT built. If I have dev/staging/production deploys won't this mean I have moving scripts when I go to run in each environment? I think I understand having the init this way since it is dependent upon a database to create base tables. But if I have an existing site, I feel like I would just want to run a docker build, include my site, and have it update at that time. Then I can deploy the same static image everywhere I want? Thanks! :)

Also either way this seems like a great addition!

@flojon

This comment has been minimized.

flojon commented Mar 1, 2018

Hi @brianpetersencornell

Wordpress docker includes the code for a given version of Wordpress and this code is deployed to a volume on the first run of that docker image.
If the volume already contains a Wordpress it will not do anything. So even if you runner a newer version of Wordpress docker image it will not upgrade the Wordpress version install to the volume.

What this patch does is to check at startup if the version of Wordpress contained in the image is newer then the version installed in the volume. If so it will upgrade Wordpress.
So as long as you're running the same version of docker-image it will not do anything.

I think we are many people that find it surprising when you upgrade the docker image and the Wordpress version is not upgraded... That's what this patch is trying to fix.

@brianpetersencornell

This comment has been minimized.

brianpetersencornell commented Mar 1, 2018

Thanks for the reply!
This probably isn't the place for such a conversation, is there a better place I can ask these questions?

I'm surprised people are mounting the wordpress code itself. Is there an advantage for doing it this way? Why not just run the code version in the container you are pulling? Then you only need to mount and maintain the uploads folder?

Thanks for your insight on this, I am trying to develop a strategy for my own wordpress sites. My initial approach is to have the docker image contain my wp-content and just use the wordpress code in the image. Then I only mount the uploads folder. So everything is contained in the image. Seems updating would be as easy as doing a new build. It doesn't seem like people are doing it this way though.

@ngdio

This comment has been minimized.

ngdio commented May 25, 2018

Why isn't this being merged? There is no proper way to update WordPress in Docker containers so this must be merged. It's useless otherwise.

@drzraf

This comment has been minimized.

drzraf commented May 25, 2018

abandon WordPress [infrastructure], go https://roots.io/bedrock/
upstream is not going to improve the disastrous situation of wp-config.php

@ConstantinElse

This comment has been minimized.

ConstantinElse commented Jun 23, 2018

I also need this functionality. When is it going to be accepted ?

@tianon

This comment has been minimized.

Member

tianon commented Sep 6, 2018

Sorry for the long delay.

I'm inclined to share my opinion from #156 (comment) here -- namely, I don't really see a compelling reason for us to implement this any more (and thus believe we should simply remove this old TODO item from the code). The official WordPress-recommended method of updating WordPress is to do so either through their integrated web UI or (preferrably) via their automated updates.

I've included in #156 (comment) notes for anyone who wants to disable the WordPress auto-update functionality (which is now possible trivially thanks to #142) and instead control WordPress versioning strictly with Docker image updates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment