brint / wordpress-cookbook

Development repository for Opscode Cookbook wordpress
https://supermarket.chef.io/cookbooks/wordpress
Apache License 2.0
80 stars 176 forks source link

wordpress.conf.erb not compatible with Apache 2.4 #39

Closed rberger closed 10 years ago

rberger commented 10 years ago

Apache 2.4 has done some radical changes in lots of config parameters. It really broke a lot of things including the main apache2 cookbook. AND Ubuntu packagers have updated the apache2 package to use 2.4 for several releases, not just 14.04. The apache2 cookbook maintainers have a pre-release with fixes (COOK-3900).

But it looks like the wordpress cookbook apache config template contains a couple of lines that are incompatible with apache2.4:

  RewriteLog <%= node['apache']['log_dir'] %>/<%= @application_name %>-rewrite.log
  RewriteLogLevel 0

need to be removed to have wordpress work with Apache 2.4. (http://httpd.apache.org/docs/current/mod/mod_rewrite.html)

Is there a way to override the template source in the wordpress cookbook in a wrapper cookbook? I don't see a way off hand.

These Apache 2.4 changes are a major pain. I don't know what they were thinking by making breaking configuration changes in a dot release.

gondoi commented 10 years ago

It's not ideal, but the way the upstream apache2 cookbook determines if 2.4 is in use is by an attribute. This can be used here as well to bypass this section of the template:

if node['apache']['version'] == '2.2'
  RewriteLog <%= node['apache']['log_dir'] %>/<%= @application_name %>-rewrite.log
  RewriteLogLevel 0
end

We are looking to improve determining the version of Apache installed, but that attribute should still be used.

brint commented 10 years ago

@rberger Thanks for the note. I've been purposely waiting on COOK-3900 to add 2.4 support. For now, I've added notes to the README.md to outline what versions of RHEL/CentOS and Ubuntu are supported. No surprise, it's just ones with 2.2 for now.

I'm going to keep this issue open as I expect 2.4 to become a more common request with Ubuntu 14.04 and CentOS/RHEL 7 now out.

@gondoi - I know you've been working on helping get COOK-3900 out the door, is there any drawback to just using node['apache']['version']?

rberger commented 10 years ago

Just for the record, I redeployed my wordpress setup using the current wordpress cookbook and Master of the apache cookbook as of yesterday (the apache master has COOK-3900 merged in now) on Ubuntu 13.10 which was unexpectedly updated to Apache 2.4

Other than having to modify the wordpress.conf.erb to remove the Rewritelog stuff, it worked. I did have to set apache[:version] = "2.4" as an override.

brint commented 10 years ago

More as a public notice: We'll need to wait to implement this change until the apache2 cookbook issues a release that supports 2.4. Since support is now in master, that'll likely be pretty soon.

gondoi commented 10 years ago

@brint No drawback, the attribute is currently the preferred way of letting the cookbook know it's dealing with 2.4 at the moment.

brint commented 10 years ago

@gondoi Awesome, once they publish the new version of the apache2 cookbook, we'll make the adjustment.

gondoi commented 10 years ago

Well, well, well. It looks like the auto setting of '2.4' was added while I was on vacation. Please ignore my comments :smile:

https://github.com/onehealth-cookbooks/apache2/blob/master/attributes/default.rb#L20-L36

rberger commented 10 years ago

@gondoi pretty funny. I had spent several hours trying to figure out how to dynamically determine the version in the Apache cookbook and gave up. Hadn't thought of just making rules like that.

brint commented 10 years ago

They just published version 2.0.0 of the apache2 cookbook last night that includes 2.4 support.

brint commented 10 years ago

@rberger I've pushed a branch up that includes 14.04 support and fixes php-fpm configurations on 10.04.

I need to do a little more testing before bringing these changes into master.

rberger commented 10 years ago

Just tried it on my personal blog on Ubuntu 13.10 / Apache/2.4.6 (Ubuntu) and it worked great!

brint commented 10 years ago

@rberger Great news! Pushed the changes to master and cut release v2.3.0. Going to go ahead and close this issue. Thanks for the quick correspondence!