Merge pull request #20 from Youscribe/allow_standalone

Allow standalone installation of radosgw

Reviewed-by: Alexandre Marangone <alexandre.marangone@inktank.com>
This commit is contained in:
Alexandre Marangone 2013-04-09 08:57:25 -07:00
commit 7633fa718e
6 changed files with 47 additions and 86 deletions

View File

@ -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

View File

@ -1,38 +0,0 @@
#! /bin/sh
### BEGIN INIT INFO
# Provides: single
# Required-Start: $remote_fs $named $network $time
# Required-Stop: $remote_fs $named $network $time
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: radosgw
### END INIT INFO
PATH=/sbin:/bin:/usr/bin
. /lib/lsb/init-functions
CLIENT_NAME=client.rgw-`hostname | sed 's/\..*//g'`
USER=www-data
do_start () {
su $USER -c "radosgw -c /etc/ceph/ceph.conf -n $CLIENT_NAME >> /var/log/radosgw/radosgw.log 2>&1 &"
}
case "$1" in
start)
do_start
;;
restart|reload|force-reload)
echo "Error: argument '$1' not supported" >&2
exit 3
;;
stop)
# No-op
;;
*)
echo "Usage: $0 start|stop" >&2
exit 3
;;
esac

View File

@ -5,5 +5,5 @@ license "Apache 2.0"
description "Installs/Configures the Ceph distributed filesystem"
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version "0.1.0"
depends "apache2"
depends "apache2", ">= 1.1.12"
depends "apt"

View File

@ -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,17 @@ if node['ceph']['install_debug']
end
packages.each do |pkg|
package pkg do
action :upgrade
end
end
cookbook_file "/etc/init.d/radosgw" do
source "radosgw"
mode 0755
owner "root"
group "root"
package pkg do
action :upgrade
end
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

View 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

View File

@ -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