-
-
Notifications
You must be signed in to change notification settings - Fork 642
[WIP] Followup #667: Make it easier to switch between PHP versions #714
Conversation
@thom8 would be great if you could give this a quick review as well. |
@oxyc switching from 7.0 to 5.6 isn't working on I also use CI for testing 😄 + Circle CI also allows you to SSH into the environment to "test" stuff out.. BTW loving the |
@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, |
@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" |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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!
There was a problem hiding this comment.
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
@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: |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
)
Related #1031 |
I have some WP projects going on at the moment but I'll try and work on this next weekend (hopefully). |
Moving work over to #1043. |
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).
geerlingguy.php
with the exceptions:ppa:ondrej/php5-compat
in addition to whatbeetbox
had so there's less confusion with package names...beetbox
I just fallback togeerlingguy.php
ifphp_version == "7.0"
{{ ansible_distribution }}.yml
file beforeconfig.yml
so that users can still override the values. We could also use a bunch of conditionalset_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...