From de36e7824a2d5981cea8ff810f9d497a39416d2d Mon Sep 17 00:00:00 2001 From: Alexandre Marangone Date: Tue, 23 Apr 2013 12:13:21 -0700 Subject: [PATCH] Update radosgw_apache2 recipe - Multi distro support (CentOS/ubuntu tested) - apache2::mod_fastcgi only supports Debian/Ubuntu, change it to an apache_module - Restart apache once new configuration is applied - Add fastcgi script template Signed-off-by: Alexandre Marangone --- recipes/radosgw_apache2.rb | 69 +++++++++++++++++++++++++++++++++++++- 1 file changed, 68 insertions(+), 1 deletion(-) diff --git a/recipes/radosgw_apache2.rb b/recipes/radosgw_apache2.rb index c6c23a3..080c377 100644 --- a/recipes/radosgw_apache2.rb +++ b/recipes/radosgw_apache2.rb @@ -17,8 +17,61 @@ # See the License for the specific language governing permissions and # limitations under the License. +case node['platform_family'] +when "debian","suse" + packages = %w{ + apache2 + libapache2-mod-fastcgi + } +when "rhel","fedora" + packages = %w{ + httpd + mod_fastcgi + } +end + +packages.each do |pkg| + package pkg do + action :upgrade + end +end + +# For EL, delete the current fastcgi configuration +# and set the correct owners for dirs and logs +d_owner = d_group = "root" +if node['platform_family'] == "rhel" + file "#{node['apache']['dir']}/conf.d/fastcgi.conf" do + action :delete + backup false + end + d_owner = d_group = "apache" +end + +%W{ /var/run/ceph + /var/lib/ceph/radosgw/ceph-radosgw.#{node['hostname']} + /var/lib/apache2/ +}.each do |dir| + directory dir do + owner d_owner + group d_group + mode "0755" + recursive true + action :create + end +end + +file "/var/log/ceph/radosgw.log" do + owner d_owner + group d_group + mode "0644" + action :create +end + include_recipe "apache2" -include_recipe "apache2::mod_fastcgi" + +apache_module "fastcgi" do + conf true +end apache_module "rewrite" do conf false @@ -30,3 +83,17 @@ web_app "rgw" do admin_email node['ceph']['radosgw']['admin_email'] ceph_rgw_addr node['ceph']['radosgw']['rgw_addr'] end + +service "apache2" do + action :restart +end + +template "/var/www/s3gw.fcgi" do + source "s3gw.fcgi.erb" + owner "root" + group "root" + mode "0755" + variables( + :ceph_rgw_client => "client.radosgw.#{node['hostname']}" + ) +end