Manage a standalone installation (without apache2)
Improve apache2 recipe
This commit is contained in:
parent
176f6f178b
commit
934e91ec0f
@ -20,3 +20,4 @@ default["ceph"]["radosgw"]["api_fqdn"] = "localhost"
|
||||
default["ceph"]["radosgw"]["admin_email"] = "admin@example.com"
|
||||
default["ceph"]["radosgw"]["rgw_addr"] = "*:80"
|
||||
default["ceph"]["radosgw"]["rgw_port"] = false
|
||||
default["ceph"]["radosgw"]["webserver_companion"] = "apache2" #can be false
|
||||
|
@ -17,11 +17,8 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
include_recipe "apache2"
|
||||
|
||||
packages = %w{
|
||||
radosgw
|
||||
libapache2-mod-fastcgi
|
||||
radosgw
|
||||
}
|
||||
|
||||
if node['ceph']['install_debug']
|
||||
@ -32,48 +29,24 @@ if node['ceph']['install_debug']
|
||||
end
|
||||
|
||||
packages.each do |pkg|
|
||||
package pkg do
|
||||
action :upgrade
|
||||
end
|
||||
package pkg do
|
||||
action :upgrade
|
||||
end
|
||||
end
|
||||
|
||||
cookbook_file "/etc/init.d/radosgw" do
|
||||
source "radosgw"
|
||||
mode 0755
|
||||
owner "root"
|
||||
group "root"
|
||||
source "radosgw"
|
||||
mode 0755
|
||||
owner "root"
|
||||
group "root"
|
||||
end
|
||||
|
||||
service "radosgw" do
|
||||
service_name "radosgw"
|
||||
supports :restart => true
|
||||
action[:enable,:start]
|
||||
service_name "radosgw"
|
||||
supports :restart => true
|
||||
action[:enable,:start]
|
||||
end
|
||||
|
||||
apache_module "fastcgi" do
|
||||
conf true
|
||||
if node["ceph"]["radosgw"]["webserver_companion"]
|
||||
include_recipe "ceph::radosgw_#{node["ceph"]["radosgw"]["webserver_companion"]}"
|
||||
end
|
||||
|
||||
apache_module "rewrite" do
|
||||
conf false
|
||||
end
|
||||
|
||||
template "/etc/apache2/sites-available/rgw.conf" do
|
||||
source "rgw.conf.erb"
|
||||
mode 0400
|
||||
owner "root"
|
||||
group "root"
|
||||
variables(
|
||||
:ceph_api_fqdn => node['ceph']['radosgw']['api_fqdn'],
|
||||
:ceph_admin_email => node['ceph']['radosgw']['admin_email'],
|
||||
:ceph_rgw_addr => node['ceph']['radosgw']['rgw_addr']
|
||||
)
|
||||
if ::File.exists?("#{node['apache']['dir']}/sites-enabled/rgw.conf")
|
||||
notifies :restart, "service[apache2]"
|
||||
end
|
||||
end
|
||||
|
||||
apache_site "rgw.conf" do
|
||||
enable enable_setting
|
||||
end
|
||||
|
||||
|
32
recipes/radosgw_apache2.rb
Normal file
32
recipes/radosgw_apache2.rb
Normal file
@ -0,0 +1,32 @@
|
||||
#
|
||||
# Author:: Kyle Bader <kyle.bader@dreamhost.com>
|
||||
# Cookbook Name:: ceph
|
||||
# Recipe:: radosgw_apache2
|
||||
#
|
||||
# Copyright 2011, DreamHost Web Hosting
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
include_recipe "apache2"
|
||||
include_recipe "apache2::mod_fastcgi"
|
||||
|
||||
apache_module "rewrite" do
|
||||
conf false
|
||||
end
|
||||
|
||||
web_app "rgw" do
|
||||
template "rgw.conf.erb"
|
||||
server_name node['ceph']['radosgw']['api_fqdn']
|
||||
admin_email node['ceph']['radosgw']['admin_email']
|
||||
ceph_rgw_addr node['ceph']['radosgw']['rgw_addr']
|
||||
end
|
@ -1,15 +1,15 @@
|
||||
<% if node['ceph']['radosgw']['rgw_port'] -%>
|
||||
FastCgiExternalServer /var/www/dummyradosgw.fcgi -host 127.0.0.1:<%= node['ceph']['radosgw']['rgw_port'] %>
|
||||
<% else -%>
|
||||
FastCgiExternalServer /var/www/dummyradosgw.fcgi -socket /var/run/ceph/radosgw.client.radosgw.<%= node[:hostname] %>
|
||||
FastCgiExternalServer /var/www/dummyradosgw.fcgi -socket /var/run/ceph/radosgw.client.radosgw.<%= node['hostname'] %>
|
||||
<% end -%>
|
||||
|
||||
LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" proxy_combined
|
||||
LogFormat "%{X-Forwarded-For}i %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" proxy_debug
|
||||
|
||||
<VirtualHost <%= @ceph_rgw_addr %>>
|
||||
ServerName <%= @ceph_api_fqdn %>
|
||||
ServerAdmin <%= @ceph_admin_email %>
|
||||
<VirtualHost <%= node['ceph']['radosgw']['rgw_addr'] %>>
|
||||
ServerName <%= @params[:server_name] %>
|
||||
ServerAdmin <%= node["ceph"]["radosgw"]["admin_email"] %>
|
||||
DocumentRoot /var/www/
|
||||
|
||||
RewriteEngine On
|
||||
|
Loading…
x
Reference in New Issue
Block a user