welaika / docker-wordmove

Docker image to run Wordmove
https://hub.docker.com/r/welaika/wordmove/
16 stars 9 forks source link

Bump PHP version to 7.4 #19

Closed danieleperot closed 3 years ago

danieleperot commented 3 years ago

Hi all!

I have been using this docker container for Wordmove for quite a while, and it always worked without problems.

In a recent project, however, I decided to use the arrow function syntax introduced in PHP 7.4. When synchronizing the DB from my staging to my local environment, during the search-replace fase WP CLI threw a syntax error. This was due to the fact that Wordmove is currently using PHP version 7.3.

I was able to overcome the problem by extending the wordmove:php7 image with the following instructions:

FROM welaika/wordmove:php7

RUN apt update && apt -y install lsb-release apt-transport-https ca-certificates wget
RUN wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
RUN echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | tee /etc/apt/sources.list.d/php.list
RUN apt update && apt -y install php7.4 php7.4-cli php7.4-mysql php7.4-xml

To further support this issue, I would like to point out that PHP 7.3 is in security support only and will reach its EOL in December '21, so it would be a good opportunity to bring the repository up to date.

I would actually love to open a PR request myself and help the project out, but I thought that it would be better to check with you maintainers first!

Thank you in advance :blush:

alessandro-fazzi commented 3 years ago

Hello @danieleperot :)

Thanks for contributing!

I've just finished an update round, so that ATM we've this current versions out (as per the updated README)

All the maintained versions received a Wordmove version bump to the latest stable available: 5.2.1.

I'd ask another bit of your time to test out your setup pulling updated images from docker hub, eventually throwing a thumbsup and maybe closing this issue if you're happy with the updates.

Thanks again.

All the best

danieleperot commented 3 years ago

Thank you for the fast reply :smile:

I will take a look at it right away. Can't wait to try out the apline version as well!

danieleperot commented 3 years ago

Ok, I checked out both php7 (and latest) and alpine tags and they both work beautifully.

The only thing I encountered was the nasty root user error from WP CLI:

Error: YIKES! It looks like you're running this as root. You probably meant to run this as the user that your WordPress installation exists under.

If you REALLY mean to run this as root, we won't stop you, but just bear in mind that any code on this site will then have full control of your server, making it quite DANGEROUS.

If you'd like to continue as root, please run this again, adding this flag:  --allow-root

If you'd like to run it as the user that this site is under, you can run the following to become the respective user:

    sudo -u USER -i -- wp <command>

However I can simply solve it by adding a user: ${UID}:${GID} in my docker-compose.yml, so I guess this is more my fault than the docker image :sweat_smile:

  kwm:
    tty: true
    depends_on:
      - kwp
    restart: on-failure:5
    image: welaika/wordmove:alpine
    user: "${USER_UID}:${USER_UID}" # USER_UID is a variable I instantiated containing my user ID

I will close the issue then! Thank you again very much for your help :blush:

alessandro-fazzi commented 3 years ago

Hey thank you for the feedback! Glad to hear good news.

But the warning you're getting is grinding my gears a bit: I'm quite sure that wordmove per se is already putting the --allow-root flag. Any chance you're running custom wp-cli commands into the machine? For example using wordmove's hooks?

danieleperot commented 3 years ago

Hi @pioneerskies! Sorry for the delay in my answer.

I'm not using wordmove hooks in my repository, but I was not able to reproduce the error in another project so I must assume that the problem is in my configuration (e.g. some wordpress plugin I'm using that has some side effects with WP CLI) and not in the container itself.

I verified that wordmove in the docker container uses --allow-root when calling WP CLI as you said.

I will keep you posted if I have any extra news! Thank you for the time you put into this issue and in the project :blush:

alessandro-fazzi commented 3 years ago

You're welcome. Thanks again.

best