commit
488246fa04
@ -21,3 +21,10 @@ default["ceph"]["radosgw"]["admin_email"] = "admin@example.com"
|
|||||||
default["ceph"]["radosgw"]["rgw_addr"] = "*:80"
|
default["ceph"]["radosgw"]["rgw_addr"] = "*:80"
|
||||||
default["ceph"]["radosgw"]["rgw_port"] = false
|
default["ceph"]["radosgw"]["rgw_port"] = false
|
||||||
default["ceph"]["radosgw"]["webserver_companion"] = "apache2" #can be false
|
default["ceph"]["radosgw"]["webserver_companion"] = "apache2" #can be false
|
||||||
|
default['ceph']["radosgw"]['use_apache_fork'] = true
|
||||||
|
case node['platform']
|
||||||
|
when 'ubuntu'
|
||||||
|
default["ceph"]["radosgw"]["init_style"] = "upstart"
|
||||||
|
else
|
||||||
|
default["ceph"]["radosgw"]["init_style"] = "sysvinit"
|
||||||
|
end
|
||||||
|
@ -10,3 +10,26 @@ apt_repository "ceph-#{branch}" do
|
|||||||
key node['ceph']['debian'][branch]['repository_key']
|
key node['ceph']['debian'][branch]['repository_key']
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if node['roles'].include?("ceph-radosgw") \
|
||||||
|
&& node["ceph"]["radosgw"]["webserver_companion"] == "apache2" \
|
||||||
|
&& node["ceph"]["radosgw"]["use_apache_fork"] == true
|
||||||
|
case node['lsb']['codename']
|
||||||
|
when "precise","oneiric"
|
||||||
|
apt_repository "ceph-apache2" do
|
||||||
|
repo_name "ceph-apache2"
|
||||||
|
uri "http://gitbuilder.ceph.com/apache2-deb-#{node['lsb']['codename']}-x86_64-basic/ref/master"
|
||||||
|
distribution node['lsb']['codename']
|
||||||
|
components ["main"]
|
||||||
|
key "https://ceph.com/git/?p=ceph.git;a=blob_plain;f=keys/autobuild.asc"
|
||||||
|
end
|
||||||
|
apt_repository "ceph-modfastcgi" do
|
||||||
|
repo_name "ceph-modfastcgi"
|
||||||
|
uri "http://gitbuilder.ceph.com/libapache-mod-fastcgi-deb-#{node['lsb']['codename']}-x86_64-basic/ref/master"
|
||||||
|
distribution node['lsb']['codename']
|
||||||
|
components ["main"]
|
||||||
|
key "https://ceph.com/git/?p=ceph.git;a=blob_plain;f=keys/autobuild.asc"
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Log.info("Ceph's Apache and Apache FastCGI forks not available for this distribution")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
@ -3,10 +3,16 @@ raise "mon_initial_members must be set in config" if node["ceph"]["config"]['mon
|
|||||||
|
|
||||||
mon_addresses = get_mon_addresses()
|
mon_addresses = get_mon_addresses()
|
||||||
|
|
||||||
|
is_rgw = false
|
||||||
|
if node['roles'].include? 'ceph-radosgw'
|
||||||
|
is_rgw = true
|
||||||
|
end
|
||||||
|
|
||||||
template '/etc/ceph/ceph.conf' do
|
template '/etc/ceph/ceph.conf' do
|
||||||
source 'ceph.conf.erb'
|
source 'ceph.conf.erb'
|
||||||
variables(
|
variables(
|
||||||
:mon_addresses => mon_addresses
|
:mon_addresses => mon_addresses,
|
||||||
|
:is_rgw => is_rgw
|
||||||
)
|
)
|
||||||
mode '0644'
|
mode '0644'
|
||||||
end
|
end
|
||||||
|
@ -17,15 +17,22 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
packages = %w{
|
case node['platform_family']
|
||||||
radosgw
|
when "debian"
|
||||||
}
|
packages = %w{
|
||||||
|
radosgw
|
||||||
if node['ceph']['install_debug']
|
}
|
||||||
packages_dbg = %w{
|
|
||||||
radosgw-dbg
|
if node['ceph']['install_debug']
|
||||||
|
packages_dbg = %w{
|
||||||
|
radosgw-dbg
|
||||||
|
}
|
||||||
|
packages += packages_dbg
|
||||||
|
end
|
||||||
|
when "rhel","fedora","suse"
|
||||||
|
packages = %w{
|
||||||
|
ceph-radosgw
|
||||||
}
|
}
|
||||||
packages += packages_dbg
|
|
||||||
end
|
end
|
||||||
|
|
||||||
packages.each do |pkg|
|
packages.each do |pkg|
|
||||||
@ -34,12 +41,48 @@ packages.each do |pkg|
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
service "radosgw" do
|
include_recipe "ceph::conf"
|
||||||
service_name "radosgw"
|
|
||||||
supports :restart => true
|
|
||||||
action[:enable,:start]
|
|
||||||
end
|
|
||||||
|
|
||||||
if node["ceph"]["radosgw"]["webserver_companion"]
|
unless File.exists?("/var/lib/ceph/radosgw/ceph-radosgw.#{node['hostname']}/done")
|
||||||
include_recipe "ceph::radosgw_#{node["ceph"]["radosgw"]["webserver_companion"]}"
|
if node["ceph"]["radosgw"]["webserver_companion"]
|
||||||
|
include_recipe "ceph::radosgw_#{node["ceph"]["radosgw"]["webserver_companion"]}"
|
||||||
|
end
|
||||||
|
|
||||||
|
directory "/etc/ceph" do
|
||||||
|
owner "root"
|
||||||
|
group "root"
|
||||||
|
mode "0644"
|
||||||
|
action :create
|
||||||
|
end
|
||||||
|
|
||||||
|
ruby_block "create rados gateway client key" do
|
||||||
|
block do
|
||||||
|
keyring = %x[ ceph auth get-or-create client.radosgw.#{node['hostname']} osd 'allow rwx' mon 'allow r' --name mon. --key='#{node["ceph"]["monitor-secret"]}' ]
|
||||||
|
keyfile = File.new("/etc/ceph/ceph.client.radosgw.#{node['hostname']}.keyring", "w")
|
||||||
|
keyfile.puts(keyring)
|
||||||
|
keyfile.close
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
file "/var/lib/ceph/radosgw/ceph-radosgw.#{node['hostname']}/done" do
|
||||||
|
action :create
|
||||||
|
end
|
||||||
|
|
||||||
|
service "radosgw" do
|
||||||
|
case node["ceph"]["radosgw"]["init_style"]
|
||||||
|
when "upstart"
|
||||||
|
service_name "radosgw-all-starter"
|
||||||
|
provider Chef::Provider::Service::Upstart
|
||||||
|
else
|
||||||
|
if node['platform'] == "debian"
|
||||||
|
service_name "radosgw"
|
||||||
|
else
|
||||||
|
service_name "ceph-radosgw"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
supports :restart => true
|
||||||
|
action [ :enable, :start ]
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Log.info("Rados Gateway already deployed")
|
||||||
end
|
end
|
||||||
|
@ -17,8 +17,61 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# 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"
|
||||||
include_recipe "apache2::mod_fastcgi"
|
|
||||||
|
apache_module "fastcgi" do
|
||||||
|
conf true
|
||||||
|
end
|
||||||
|
|
||||||
apache_module "rewrite" do
|
apache_module "rewrite" do
|
||||||
conf false
|
conf false
|
||||||
@ -30,3 +83,17 @@ web_app "rgw" do
|
|||||||
admin_email node['ceph']['radosgw']['admin_email']
|
admin_email node['ceph']['radosgw']['admin_email']
|
||||||
ceph_rgw_addr node['ceph']['radosgw']['rgw_addr']
|
ceph_rgw_addr node['ceph']['radosgw']['rgw_addr']
|
||||||
end
|
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
|
||||||
|
@ -29,6 +29,19 @@
|
|||||||
<% end -%>
|
<% end -%>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
|
||||||
|
<% if (@is_rgw) -%>
|
||||||
|
[client.radosgw.<%= node['hostname'] %>]
|
||||||
|
host = <%= node['hostname'] %>
|
||||||
|
rgw socket path = /var/run/ceph/radosgw.<%= node['hostname'] %>
|
||||||
|
keyring = /etc/ceph/ceph.client.radosgw.<%= node['hostname'] %>.keyring
|
||||||
|
log file = /var/log/ceph/radosgw.log
|
||||||
|
<% if (! node['ceph']['config']['rgw'].nil?) -%>
|
||||||
|
<% node['ceph']['config']['rgw'].each do |k, v| %>
|
||||||
|
<%= k %> = <%= v %>
|
||||||
|
<% end %>
|
||||||
|
<% end -%>
|
||||||
|
<% end -%>
|
||||||
|
|
||||||
<% node['ceph']['config-sections'].each do |name, sect| %>
|
<% node['ceph']['config-sections'].each do |name, sect| %>
|
||||||
[<%= name %>]
|
[<%= name %>]
|
||||||
<% sect.each do |k, v| %>
|
<% sect.each do |k, v| %>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<% if node['ceph']['radosgw']['rgw_port'] -%>
|
<% if node['ceph']['radosgw']['rgw_port'] -%>
|
||||||
FastCgiExternalServer /var/www/dummyradosgw.fcgi -host 127.0.0.1:<%= node['ceph']['radosgw']['rgw_port'] %>
|
FastCgiExternalServer /var/www/s3gw.fcgi -host 127.0.0.1:<%= node['ceph']['radosgw']['rgw_port'] %>
|
||||||
<% else -%>
|
<% else -%>
|
||||||
FastCgiExternalServer /var/www/dummyradosgw.fcgi -socket /var/run/ceph/radosgw.client.radosgw.<%= node['hostname'] %>
|
FastCgiExternalServer /var/www/s3gw.fcgi -socket /var/run/ceph/radosgw.<%= node['hostname'] %>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
|
||||||
LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" proxy_combined
|
LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" proxy_combined
|
||||||
@ -13,7 +13,7 @@ LogFormat "%{X-Forwarded-For}i %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{Use
|
|||||||
DocumentRoot /var/www/
|
DocumentRoot /var/www/
|
||||||
|
|
||||||
RewriteEngine On
|
RewriteEngine On
|
||||||
RewriteRule ^/(.*) /dummyradosgw.fcgi?params=$1&%{QUERY_STRING} [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
|
RewriteRule ^/([a-zA-Z0-9-_.]*)([/]?.*) /s3gw.fcgi?page=$1¶ms=$2&%{QUERY_STRING} [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
|
||||||
|
|
||||||
<IfModule mod_fastcgi.c>
|
<IfModule mod_fastcgi.c>
|
||||||
<Directory /var/www/>
|
<Directory /var/www/>
|
||||||
@ -28,7 +28,7 @@ LogFormat "%{X-Forwarded-For}i %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{Use
|
|||||||
|
|
||||||
AllowEncodedSlashes On
|
AllowEncodedSlashes On
|
||||||
|
|
||||||
ErrorLog /var/log/apache2/error.log
|
ErrorLog /var/log/<%= node['apache']['package'] %>/error.log
|
||||||
CustomLog /var/log/apache2/sssrgw-access.log proxy_combined
|
CustomLog /var/log/<%= node['apache']['package'] %>/rgw-access.log proxy_combined
|
||||||
ServerSignature Off
|
ServerSignature Off
|
||||||
</VirtualHost>
|
</VirtualHost>
|
||||||
|
2
templates/default/s3gw.fcgi.erb
Normal file
2
templates/default/s3gw.fcgi.erb
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
exec /usr/bin/radosgw -c /etc/ceph/ceph.conf -n <%= @ceph_rgw_client %>
|
Loading…
x
Reference in New Issue
Block a user