yeswework / fabrica-dev-kit

A toolkit for faster, smoother WordPress 5 development
https://fabri.ca/
MIT License
274 stars 27 forks source link

Switching to PHP7 #5

Closed wickedurge closed 7 years ago

wickedurge commented 7 years ago

I'm loving the stack so far, but I'd prefer to use PHP 7.1 instead of 5.6.

tiojoca commented 7 years ago

Thanks @wickedurge !

We're planning to make this a setting in setup.yml but for now you can use PHP 7.1 with just a couple of file edits:

We're adding this to documentation too while we implement the setting in the setup configuration file.

andrewstaffell commented 7 years ago

Hi @wickedurge, further to @tiojoca's instructions and just to clarify: those steps should be taken after cloning the repo and before running ./setup.rb.

Alternatively, if you'd like to make the swap on the project you've already started to set up, make those changes and then to replace the _wp container (which contains PHP), run the following commands, replacing <project slug> as appropriate in the second one:

docker-compose rm --stop wp
docker rmi <project slug>_wp
./setup.rb --reinstall

But as @tiojoca mentioned, we'll shortly implement this as a setup option. Thanks for bringing it to our attention.

wickedurge commented 7 years ago

Awesome stuff, thanks!

I'm including my steps because it's still not quite working and hopefully someone else will find it useful.

I made the suggested changes to Dockerfile and zz-php.ini. No problems there.

It took a little Googling to get the docker commands to work (I'm very new with docker). docker-compose rm --stop worked fine. But, I ended up using docker rmi <project slug>_wp -f in order to get it to stop.

I then ran ./setup.rb --reinstall. Everything looked fine until that last few lines:

WARNING: Image for service wp was built because it did not already exist. To rebuild this image you must use docker-compose build or docker-compose up --build.
fabricaproject_db is up-to-date
Recreating f8d2a2c06c2c_f8d2a2c06c2c_fabricaproject_wp

ERROR: for wp  No such image: sha256:ecf5f1399347fcec01d54b257b861029ea195b041bf7cd0dcd24a3942b083e4c
ERROR: Encountered errors while bringing up the project.
[Fabrica] ⚠️  Docker containers provision failed.
andrewstaffell commented 7 years ago

Turns out it's a bit trickier than we thought to live-swap the _wp container on an existing installation, but the following steps should sort it out (NB it'll replace the database).

cd dev
docker-compose down --volumes --rmi local
cd ..
./setup.rb --reinstall

In the meantime we've pushed some changes so that if you set up a new project you'll only have to modify the /provision/wp/Dockerfile as above between clone and setup (ie. not php.ini), and we'll shortly add a setup parameter to automate that too.

Thanks!

wickedurge commented 7 years ago

And we're officially back in business!

Thank you for your help and for making such a cool tool. If you ever need a "WordPress hero" for testing or something, drop me a line.

tiojoca commented 7 years ago

Glad to hear, thank you @wickedurge !