Skip to content
This repository has been archived by the owner on Feb 13, 2023. It is now read-only.

[WIP] Followup #667: Make it easier to switch between PHP versions #714

Closed
wants to merge 5 commits into from

Conversation

oxyc
Copy link
Collaborator

@oxyc oxyc commented Jun 7, 2016

This still needs work. Not really sure how to adress all issues. Also added some temporary tests for Ubuntu 14.04, unfortunately we never figured out how to test 12.04 using docker so that needs some manual testing (together with memcached and redis).

  • We dropped support for PHP 5.5 at some point so I kept it that way.
  • I tried to use the same packages as in geerlingguy.php with the exceptions:
    • php-mcrypt is added (not sure what happens if you re-provision using PHP 7.0, needs to be tested).
    • php-apcu isn't available in the PPA.
  • Also using ppa:ondrej/php5-compat in addition to what beetbox had so there's less confusion with package names...
  • I automatically set the correct xhprof zipball as well.
  • Unlike beetbox I just fallback to geerlingguy.php if php_version == "7.0"
  • I source a {{ ansible_distribution }}.yml file before config.yml so that users can still override the values. We could also use a bunch of conditional set_fact. That's a lot of overridden variables though..

Also needs to test upgrade path and see what happens when an Ubuntu 14.04 box upgrades. Lots of manual testing...

@oxyc
Copy link
Collaborator Author

oxyc commented Jun 7, 2016

@thom8 would be great if you could give this a quick review as well.

@thom8
Copy link
Collaborator

thom8 commented Jun 8, 2016

@oxyc switching from 7.0 to 5.6 isn't working on 16.04 as it not using the PPA.

I also use CI for testing 😄 + Circle CI also allows you to SSH into the environment to "test" stuff out..
you can enable the build without a circle.yml file 😉

BTW loving the default.config.yml! makes it so much easier to update and test

@geerlingguy
Copy link
Owner

@thom8 - I've heard that Travis will be adding a similar feature soonish... and that some people can get access to it sooner if they just ask (especially if they do a lot of OSS work).

And yeah, default.config.yml might be one of my favorite new things too!

@oxyc
Copy link
Collaborator Author

oxyc commented Jun 10, 2016

@thom8 the PPAs are supposed to work on 16.04? I thought I tried it and something like memcached or redis didn't like the packages available. Not sure, it was in the beginning of my attempts so maybe it was something unrelated–I'll give it a second try as switching to PHP 5.6 on 16.04 as well would be a nice new feature for sure!

when: php_version == "5.5" and ansible_distribution == "Ubuntu" and ansible_distribution_version == "12.04"
- name: Add repository for PHP on Ubuntu.
apt_repository: repo='ppa:ondrej/php'
when: ansible_distribution == "Ubuntu" and ansible_distribution_version != "16.04"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@oxyc the PPA isn't included in 16.04 so it's probably conflicting with php56_packages.

I'm still working out some issues when switching from an existing version so will keep you posted.

Copy link
Collaborator Author

@oxyc oxyc Jun 11, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested it briefly locally but the build failed on 16.04 while 14.04 worked out of the box. I hope to get a second look at it this weekend.

Awesome! Being able to switch versions without destroying would be great!

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@thom8 / @oxyc - FYI, note that as of geerlingguy/ansible-role-php#135 (latest PHP role version), you can set php_packages_state: "latest", and that, along with a different repo (yum) or PPA (apt), will switch PHP versions on the fly as well.

I just used that to finally bump hostedapachesolr.com to a modern PHP version on CentOS 6 (after testing on staging servers of course) :D

@thom8
Copy link
Collaborator

thom8 commented Jun 15, 2016

@oxyc made some progress here, and we can now cleanly switch between PHP 5.5, 5.6 & 7.0.

As we've locked in @ 14.04, we can always assume that the new PPA is being used.

The module purge could be avoided by setting a version specific module path so modules that require compiling like xdebug & xhprof would have a separate module path per version. The PR's referenced above would allow us to remove this purge task -- https://github.com/beetboxvm/beetbox/blob/master/provisioning/ansible/roles/beetbox-php-ppa/tasks/main.yml#L18

php_fpm_pool_conf_path: "{{ php_fpm_conf_path }}/pool.d/www.conf"
php_mysql_package: "php{{ php_version }}-mysql"
php_opcache_conf_filename: "10-opcache.ini"
php56_packages:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One potential problem here—is this list overridable via config.yml? As long as it is, I think I'm okay with this particular setup.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it is, it's loaded before config.yml etc so any user configurations should take effect (unless they hack default.config.yml)

@oxyc
Copy link
Collaborator Author

oxyc commented Dec 2, 2016

Related #1031

@oxyc
Copy link
Collaborator Author

oxyc commented Dec 2, 2016

I have some WP projects going on at the moment but I'll try and work on this next weekend (hopefully).

@oxyc
Copy link
Collaborator Author

oxyc commented Dec 9, 2016

Moving work over to #1043.

@oxyc oxyc closed this Dec 9, 2016
geerlingguy added a commit that referenced this pull request Dec 10, 2016
Followup #667, #714: Make it easier to switch between PHP versions
@oxyc oxyc deleted the phpvars branch April 25, 2017 00:32
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants