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

DOCS: Upgrade gudiance? #689

Closed
scyto opened this issue Jan 28, 2022 · 9 comments
Closed

DOCS: Upgrade gudiance? #689

scyto opened this issue Jan 28, 2022 · 9 comments

Comments

@scyto
Copy link

scyto commented Jan 28, 2022

I am new to wordpress, very familiar with docker containers / compose / stacks etc.

I got my WordPress network-multisite install running on docker, its served by an nginx reverse proxy.
Got all that working (though docs could be better because as there too many contradictory, invalid or just outdated blog posts on docker-wordpress+nginx)

My www, plugins and themes are all mounted as a bind mount from my host via the volume directive in compose

volumes: 
  - /mnt/iscsi/docker/wordpress/www:/var/www/html

When I choose to update to from 5.8.x to 5.9 is the right way to run the upgrade inside the container or pull the 5.9 image and do docker-compose down then up?

@scyto
Copy link
Author

scyto commented Jan 28, 2022

for reference, my full stack

version: '3'

services:
   db:
     image: mysql:5.7
     volumes:
       - /mnt/iscsi/docker/wordpressdb_data:/var/lib/mysql
     restart: always
     environment:
       MYSQL_ROOT_PASSWORD: xxxxxx
       MYSQL_DATABASE: wordpressdb
       MYSQL_USER: xxxxx
       MYSQL_PASSWORD: xxxxxx
     deploy:
       mode: replicated
       replicas: 1
       placement:
         constraints: [node.role == manager]


   wordpress:
     image: wordpress:latest
     ports:
       - 8080:80
     restart: always
     environment:
       WORDPRESS_DB_HOST: db:3306
       WORDPRESS_DB_USER: xxxxxx
       WORDPRESS_DB_PASSWORD: xxxxxxxx
       WORDPRESS_DB_NAME: wordpressdb
     volumes:
       - /mnt/iscsi/docker/wordpress/www:/var/www/html
      
     deploy:
       mode: replicated
       replicas: 1
       placement:
         constraints: [node.role == manager]

volumes:
    db_data:

@tianon
Copy link
Member

tianon commented Feb 1, 2022

I would suggest updating both the image and the software, but the official recommendation is definitely to use the built-in updater, especially for (automatically) applying security updates.

If you're updating a major version, you'll likely want the newer base image just to make sure you catch newer required/recommended PHP modules, such as #688, but it's not usually strictly required. Another good reason to be updating your base image, however, is to make sure you're getting security updates at that layer as well, such as updates to PHP itself or packages from the underlying distribution.

(Yes, I agree this should be better documented 😅)

@dmtroyer
Copy link

With a mounted volume on /var/www/html you will find that you can only update the Wordpress software by running a Wordpress upgrade or having it auto update. In fact, even without one, because of the VOLUME directive in the Dockerfile you can only upgrade this way (even if you have a newer base image) unless you delete the volume or the Wordpress files in the volume. Quite a head scratcher for lots of people.

@yosifkit
Copy link
Member

With a mounted volume on /var/www/html you will find that you can only update the Wordpress software by running a Wordpress upgrade or having it auto update. In fact, even without one, because of the VOLUME directive in the Dockerfile you can only upgrade this way (even if you have a newer base image) unless you delete the volume or the Wordpress files in the volume.

docker-library/docs#2057 (and docs on Docker Hub):

The default configuration for this image matches the official WordPress defaults in which automatic updates are enabled (so the initial install comes from the image, but after that it becomes self-managing within the /var/www/html/ data volume).

Related discussions & comments: #246 (comment), #520, #567 (comment)

@gsugambit
Copy link

Is there an answer for this? The updater doesnt work because then it asks for FTP information. It seems really weird that i've been looking online for an answer for this for about 4hrs. Why doesnt Wordpress give a clear answer?

"How do we update docker containers without the need for the FTP functionality"

@tianon
Copy link
Member

tianon commented Sep 8, 2022

If WordPress is prompting you for FTP credentials, you need to fix your local permissions such that the user inside the container has permission to write to the files in your volume/mount.

@domi-a
Copy link

domi-a commented Sep 25, 2022

If WordPress is prompting you for FTP credentials, you need to fix your local permissions such that the user inside the container has permission to write to the files in your volume/mount.

thank you very much. i would have never considered to search in this direction.

from 5.2 to 5.9 the application could update by it self, (excpt to 5.7 wich complete screwed it self to garbage) or by updating the image. but from 5.9 to 6.0.2 it showed me that weird ftp promt.
i changed the permissions in /var/www/html volume to 0777 with owner www-data. and the update went trough without the promt.
don't know why this is nessesary, i never changed anything in the permissions of that folder. the owner already was www-data and the rights were scattered between 0644, 0755 and 0777

@gsugambit
Copy link

If WordPress is prompting you for FTP credentials, you need to fix your local permissions such that the user inside the container has permission to write to the files in your volume/mount.

thank you very much. i would have never considered to search in this direction.

from 5.2 to 5.9 the application could update by it self, (excpt to 5.7 wich complete screwed it self to garbage) or by updating the image. but from 5.9 to 6.0.2 it showed me that weird ftp promt. i changed the permissions in /var/www/html volume to 0777 with owner www-data. and the update went trough without the promt. don't know why this is nessesary, i never changed anything in the permissions of that folder. the owner already was www-data and the rights were scattered between 0644, 0755 and 0777

i will try this thanks!

@tianon
Copy link
Member

tianon commented Dec 20, 2023

Closing, since I think docker-library/docs#2057 is probably the best we're going to get here 😅 (it points out that the image has automatic updates enabled and explains how to not use that)

@tianon tianon closed this as completed Dec 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants