]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-cookbooks.git/commitdiff
Move ceph/* to top-level.
authorTommi Virtanen <tv@inktank.com>
Mon, 9 Jul 2012 22:46:52 +0000 (15:46 -0700)
committerTommi Virtanen <tv@inktank.com>
Mon, 9 Jul 2012 22:46:52 +0000 (15:46 -0700)
This repository used to be a collection of several cookbooks, but this
hasn't been true for a month, since
a77b418b95df8f2b6f56d9a90e47dc62100cdf4d. Simplifies the file layout
and makes this look more like your usual cookbook.

Thanks to Guilhem Lettron <guilhem@lettron.fr>

46 files changed:
README.md
attributes/conf.rb [new file with mode: 0644]
attributes/radosgw.rb [new file with mode: 0644]
ceph/README.md [deleted file]
ceph/attributes/conf.rb [deleted file]
ceph/attributes/radosgw.rb [deleted file]
ceph/files/default/radosgw [deleted file]
ceph/libraries/default.rb [deleted file]
ceph/metadata.rb [deleted file]
ceph/recipes/apt.rb [deleted file]
ceph/recipes/bootstrap_osd.rb [deleted file]
ceph/recipes/conf.rb [deleted file]
ceph/recipes/default.rb [deleted file]
ceph/recipes/mds.rb [deleted file]
ceph/recipes/mon.rb [deleted file]
ceph/recipes/osd.rb [deleted file]
ceph/recipes/rados-rest.rb [deleted file]
ceph/recipes/radosgw.rb [deleted file]
ceph/roles/ceph-mds.rb [deleted file]
ceph/roles/ceph-mon.rb [deleted file]
ceph/roles/ceph-osd.rb [deleted file]
ceph/roles/ceph-radosgw.rb [deleted file]
ceph/templates/default/apt-sources-list.release.erb [deleted file]
ceph/templates/default/ceph.conf.erb [deleted file]
ceph/templates/default/mods/fastcgi.conf.erb [deleted file]
ceph/templates/default/rgw.conf.erb [deleted file]
files/default/radosgw [new file with mode: 0755]
libraries/default.rb [new file with mode: 0644]
metadata.rb [new file with mode: 0644]
recipes/apt.rb [new file with mode: 0644]
recipes/bootstrap_osd.rb [new file with mode: 0644]
recipes/conf.rb [new file with mode: 0644]
recipes/default.rb [new file with mode: 0644]
recipes/mds.rb [new file with mode: 0644]
recipes/mon.rb [new file with mode: 0644]
recipes/osd.rb [new file with mode: 0644]
recipes/rados-rest.rb [new file with mode: 0644]
recipes/radosgw.rb [new file with mode: 0644]
roles/ceph-mds.rb [new file with mode: 0644]
roles/ceph-mon.rb [new file with mode: 0644]
roles/ceph-osd.rb [new file with mode: 0644]
roles/ceph-radosgw.rb [new file with mode: 0644]
templates/default/apt-sources-list.release.erb [new file with mode: 0644]
templates/default/ceph.conf.erb [new file with mode: 0644]
templates/default/mods/fastcgi.conf.erb [new file with mode: 0644]
templates/default/rgw.conf.erb [new file with mode: 0644]

index 5c00421dd3254f31daea02355c6aab382084136d..31b214eaa78cdc7c12f489c5f9c8aadb68bbb776 100644 (file)
--- a/README.md
+++ b/README.md
@@ -1 +1,115 @@
+DESCRIPTION
+===========
+
 These are incomplete, use with caution.  They have pulled from a working configuration using Debian.  They will require work for other distributions.  They also assume your package manager (apt-get, etc) are already configured for a ceph repository.
+
+Installs and configures Ceph, a distributed network storage and filesystem 
+designed to provide excellent performance, reliability, and scalability.
+
+REQUIREMENTS
+============
+
+Platform
+--------
+
+Tested as working:
+ * Debian Squeeze (6.x)
+
+Cookbooks
+---------
+
+The ceph cookbook requires the following cookbooks from Opscode:
+
+https://github.com/opscode/cookbooks
+
+* apache2
+
+Also required are the following cookbooks New Dream Network (DreamHost.com):
+
+https://github.com/NewDreamNetwork/ceph-cookbooks
+
+
+ATTRIBUTES
+==========
+
+Ceph Rados Gateway
+------------------
+
+* node[:ceph][:radosgw][:api_fqdn]
+* node[:ceph][:radosgw][:admin_email]
+* node[:ceph][:radosgw][:rgw_addr]
+
+TEMPLATES
+=========
+
+
+
+USAGE
+=====
+
+Ceph cluster design is beyond the scope of this README, please turn to the
+public wiki, mailing lists, visit our IRC channel or Ceph Support page:
+
+http://ceph.newdream.net/wiki/
+http://ceph.newdream.net/mailing-lists-and-irc/
+http://www.cephsupport.com/
+
+This diagram helps visualize recipe inheritence of the ceph cookbook recipes:
+
+ <diagram url>
+
+Ceph Monitor
+------------
+
+Ceph monitor nodes should use the ceph::mon recipe. 
+
+Includes:
+
+* ceph::default
+* ceph::rados-rest
+
+Ceph Metadata Server
+--------------------
+
+Ceph metadata server nodes should use the ceph::mds recipe.
+
+Includes:
+
+* ceph::default
+
+Ceph OSD
+--------
+
+Ceph OSD nodes should use the ceph::osd recipe
+
+Includes:
+
+* ceph::default
+
+Ceph Rados Gateway
+------------------
+
+Ceph Rados Gateway nodes should use the ceph::radosgw recipe
+
+Includes:
+
+* ceph::rados-rest
+
+LICENSE AND AUTHORS
+===================
+
+* Author: Kyle Bader <kyle.bader@dreamhost.com>
+
+* 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.
diff --git a/attributes/conf.rb b/attributes/conf.rb
new file mode 100644 (file)
index 0000000..27bef9e
--- /dev/null
@@ -0,0 +1,2 @@
+default["ceph"]["config"] = {}
+default["ceph"]["config-sections"] = {}
diff --git a/attributes/radosgw.rb b/attributes/radosgw.rb
new file mode 100644 (file)
index 0000000..2812559
--- /dev/null
@@ -0,0 +1,22 @@
+#
+# Cookbook Name:: ceph
+# Attributes:: radosgw
+#
+# 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.
+#
+default["ceph"]["radosgw"]["api_fqdn"] = "localhost"
+default["ceph"]["radosgw"]["admin-email"] = "admin@example.com"
+default["ceph"]["radosgw"]["rgw_addr"] = "*:80"
+
diff --git a/ceph/README.md b/ceph/README.md
deleted file mode 100644 (file)
index cdf1b03..0000000
+++ /dev/null
@@ -1,113 +0,0 @@
-DESCRIPTION
-===========
-
-Installs and configures Ceph, a distributed network storage and filesystem 
-designed to provide excellent performance, reliability, and scalability.
-
-REQUIREMENTS
-============
-
-Platform
---------
-
-Tested as working:
- * Debian Squeeze (6.x)
-
-Cookbooks
----------
-
-The ceph cookbook requires the following cookbooks from Opscode:
-
-https://github.com/opscode/cookbooks
-
-* apache2
-
-Also required are the following cookbooks New Dream Network (DreamHost.com):
-
-https://github.com/NewDreamNetwork/ceph-cookbooks
-
-
-ATTRIBUTES
-==========
-
-Ceph Rados Gateway
-------------------
-
-* node[:ceph][:radosgw][:api_fqdn]
-* node[:ceph][:radosgw][:admin_email]
-* node[:ceph][:radosgw][:rgw_addr]
-
-TEMPLATES
-=========
-
-
-
-USAGE
-=====
-
-Ceph cluster design is beyond the scope of this README, please turn to the
-public wiki, mailing lists, visit our IRC channel or Ceph Support page:
-
-http://ceph.newdream.net/wiki/
-http://ceph.newdream.net/mailing-lists-and-irc/
-http://www.cephsupport.com/
-
-This diagram helps visualize recipe inheritence of the ceph cookbook recipes:
-
- <diagram url>
-
-Ceph Monitor
-------------
-
-Ceph monitor nodes should use the ceph::mon recipe. 
-
-Includes:
-
-* ceph::default
-* ceph::rados-rest
-
-Ceph Metadata Server
---------------------
-
-Ceph metadata server nodes should use the ceph::mds recipe.
-
-Includes:
-
-* ceph::default
-
-Ceph OSD
---------
-
-Ceph OSD nodes should use the ceph::osd recipe
-
-Includes:
-
-* ceph::default
-
-Ceph Rados Gateway
-------------------
-
-Ceph Rados Gateway nodes should use the ceph::radosgw recipe
-
-Includes:
-
-* ceph::rados-rest
-
-LICENSE AND AUTHORS
-===================
-
-* Author: Kyle Bader <kyle.bader@dreamhost.com>
-
-* 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.
diff --git a/ceph/attributes/conf.rb b/ceph/attributes/conf.rb
deleted file mode 100644 (file)
index 27bef9e..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-default["ceph"]["config"] = {}
-default["ceph"]["config-sections"] = {}
diff --git a/ceph/attributes/radosgw.rb b/ceph/attributes/radosgw.rb
deleted file mode 100644 (file)
index 2812559..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-#
-# Cookbook Name:: ceph
-# Attributes:: radosgw
-#
-# 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.
-#
-default["ceph"]["radosgw"]["api_fqdn"] = "localhost"
-default["ceph"]["radosgw"]["admin-email"] = "admin@example.com"
-default["ceph"]["radosgw"]["rgw_addr"] = "*:80"
-
diff --git a/ceph/files/default/radosgw b/ceph/files/default/radosgw
deleted file mode 100755 (executable)
index 4c01c2b..0000000
+++ /dev/null
@@ -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
diff --git a/ceph/libraries/default.rb b/ceph/libraries/default.rb
deleted file mode 100644 (file)
index 34cc1b0..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-def is_crowbar?()
-  return defined?(Chef::Recipe::Barclamp) != nil
-end
-
-def get_mon_addresses()
-  if is_crowbar?
-    mon_addresses = search(:node, "role:ceph-mon AND ceph_config_environment:#{node['ceph']['config']['environment']}").map { |node| Chef::Recipe::Barclamp::Inventory.get_network_by_type(node, "admin").address + ":6789" }
-  else
-    mon_addresses = search(:node, "role:ceph-mon AND chef_environment:#{node.chef_environment}").map { |node| node["ipaddress"] + ":6789" }
-  end
-  return mon_addresses
-end
-
-QUORUM_STATES = ['leader', 'peon']
-
-def have_quorum?()
-    # "ceph auth get-or-create-key" would hang if the monitor wasn't
-    # in quorum yet, which is highly likely on the first run. This
-    # helper lets us delay the key generation into the next
-    # chef-client run, instead of hanging.
-    #
-    # Also, as the UNIX domain socket connection has no timeout logic
-    # in the ceph tool, this exits immediately if the ceph-mon is not
-    # running for any reason; trying to connect via TCP/IP would wait
-    # for a relatively long timeout.
-    mon_status = %x[ceph --admin-daemon /var/run/ceph/ceph-mon.#{node['hostname']}.asok mon_status]
-    raise 'getting monitor state failed' unless $?.exitstatus == 0
-    state = JSON.parse(mon_status)['state']
-    return QUORUM_STATES.include?(state)
-end
diff --git a/ceph/metadata.rb b/ceph/metadata.rb
deleted file mode 100644 (file)
index 52349c0..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-maintainer                     "Kyle Bader"
-maintainer_email       "kyle.bader@dreamhost.com"
-license                                "Apache 2.0"
-description                    "Installs/Configures the Ceph distributed filesystem"
-long_description       IO.read(File.join(File.dirname(__FILE__), 'README.md'))
-version                                "0.0.10"
-depends                                "apache2"
diff --git a/ceph/recipes/apt.rb b/ceph/recipes/apt.rb
deleted file mode 100644 (file)
index 1c91226..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-release_or_autobuild = node["ceph_branch"].nil? ? "release" : "autobuild"
-
-execute "add autobuild gpg key to apt" do
-  command <<-EOH
-wget -q -O- https://raw.github.com/ceph/ceph/master/keys/#{release_or_autobuild}.asc \
-| sudo apt-key add -
-  EOH
-end
-
-template '/etc/apt/sources.list.d/ceph.list' do
-  owner 'root'
-  group 'root'
-  mode '0644'
-  source 'apt-sources-list.release.erb'
-  variables(
-    :codename => node[:lsb][:codename],
-    :branch => node["ceph_branch"]
-  )
-end
-
-execute 'apt-get update'
diff --git a/ceph/recipes/bootstrap_osd.rb b/ceph/recipes/bootstrap_osd.rb
deleted file mode 100644 (file)
index 6905d72..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-# this recipe allows bootstrapping new osds, with help from mon
-
-include_recipe "ceph::osd"
-include_recipe "ceph::conf"
-
-if is_crowbar?
-  mons = search(:node, "role:ceph-mon AND ceph_config_environment:#{node['ceph']['config']['environment']} AND ceph_bootstrap_osd_key:*")
-else
-  mons = search(:node, "role:ceph-mon AND chef_environment:#{node.chef_environment} AND ceph_bootstrap_osd_key:*")
-end
-
-if mons.length < 1 then
-  puts "No ceph-mon found."
-else
-
-  directory "/var/lib/ceph/bootstrap-osd" do
-    owner "root"
-    group "root"
-    mode "0755"
-  end
-
-  # TODO cluster name
-  cluster = 'ceph'
-
-  file "/var/lib/ceph/bootstrap-osd/#{cluster}.keyring.raw" do
-    owner "root"
-    group "root"
-    mode "0440"
-    content mons[0]["ceph_bootstrap_osd_key"]
-  end
-
-  execute "format as keyring" do
-    command <<-EOH
-      set -e
-      # TODO don't put the key in "ps" output, stdout
-      read KEY <'/var/lib/ceph/bootstrap-osd/#{cluster}.keyring.raw'
-      ceph-authtool '/var/lib/ceph/bootstrap-osd/#{cluster}.keyring' --create-keyring --name=client.bootstrap-osd --add-key="$KEY"
-      rm -f '/var/lib/ceph/bootstrap-osd/#{cluster}.keyring.raw'
-    EOH
-  end
-end
diff --git a/ceph/recipes/conf.rb b/ceph/recipes/conf.rb
deleted file mode 100644 (file)
index 582ab5b..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-raise "fsid must be set in config" if node["ceph"]["config"]['fsid'].nil?
-raise "mon_initial_members must be set in config" if node["ceph"]["config"]['mon_initial_members'].nil?
-
-mon_addresses = get_mon_addresses()
-
-template '/etc/ceph/ceph.conf' do
-  source 'ceph.conf.erb'
-  variables(
-    :mon_addresses => mon_addresses
-  )
-  mode '0644'
-end
diff --git a/ceph/recipes/default.rb b/ceph/recipes/default.rb
deleted file mode 100644 (file)
index 83efa38..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-#
-# Author:: Kyle Bader <kyle.bader@dreamhost.com>
-# Cookbook Name:: ceph
-# Recipe:: default
-#
-# 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.
-                       
-packages = %w{
-       ceph
-       ceph-dbg
-       ceph-common
-       ceph-common-dbg
-}
-
-packages.each do |pkg|
-       package pkg do
-               action :upgrade
-       end
-end
diff --git a/ceph/recipes/mds.rb b/ceph/recipes/mds.rb
deleted file mode 100644 (file)
index 76816ba..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-#
-# Author:: Kyle Bader <kyle.bader@dreamhost.com>
-# Cookbook Name:: ceph
-# Recipe:: mds
-#
-# 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 "ceph::default"
diff --git a/ceph/recipes/mon.rb b/ceph/recipes/mon.rb
deleted file mode 100644 (file)
index 13d067b..0000000
+++ /dev/null
@@ -1,106 +0,0 @@
-# this recipe creates a monitor cluster
-
-require 'json'
-
-include_recipe "ceph::default"
-include_recipe "ceph::conf"
-
-if is_crowbar?
-  ipaddress = Chef::Recipe::Barclamp::Inventory.get_network_by_type(node, "admin").address
-else
-  ipaddress = node['ipaddress']
-end
-
-service "ceph-mon-all-starter" do
-  provider Chef::Provider::Service::Upstart
-  action [:enable]
-end
-
-# TODO cluster name
-cluster = 'ceph'
-
-execute 'ceph-mon mkfs' do
-  command <<-EOH
-set -e
-# TODO chef creates doesn't seem to suppressing re-runs, do it manually
-if [ -e '/var/lib/ceph/mon/ceph-#{node["hostname"]}/done' ]; then
-  echo 'ceph-mon mkfs already done, skipping'
-  exit 0
-fi
-KR='/var/lib/ceph/tmp/#{cluster}-#{node['hostname']}.mon.keyring'
-# TODO don't put the key in "ps" output, stdout
-ceph-authtool "$KR" --create-keyring --name=mon. --add-key='#{node["ceph"]["monitor-secret"]}' --cap mon 'allow *'
-
-ceph-mon --mkfs -i #{node['hostname']} --keyring "$KR"
-rm -f -- "$KR"
-touch /var/lib/ceph/mon/ceph-#{node['hostname']}/done
-EOH
-  # TODO built-in done-ness flag for ceph-mon?
-  creates '/var/lib/ceph/mon/ceph-#{node["hostname"]}/done'
-  notifies :start, "service[ceph-mon-all-starter]", :immediately
-end
-
-ruby_block "tell ceph-mon about its peers" do
-  block do
-    mon_addresses = get_mon_addresses()
-    mon_addresses.each do |addr|
-      system 'ceph', \
-        '--admin-daemon', "/var/run/ceph/ceph-mon.#{node['hostname']}.asok", \
-        'add_bootstrap_peer_hint', "#{addr}"
-      # ignore errors
-    end
-  end
-end
-
-ruby_block "create client.admin keyring" do
-  block do
-    if not ::File.exists?('/etc/ceph/ceph.client.admin.keyring') then
-      if not have_quorum? then
-        puts 'ceph-mon is not in quorum, skipping bootstrap-osd key generation for this run'
-      else
-        # TODO --set-uid=0
-        key = %x[
-        ceph \
-          --name mon. \
-          --keyring '/var/lib/ceph/mon/#{cluster}-#{node['hostname']}/keyring' \
-          auth get-or-create-key client.admin \
-          mon 'allow *' \
-          osd 'allow *' \
-          mds allow
-        ]
-        raise 'adding or getting admin key failed' unless $?.exitstatus == 0
-        # TODO don't put the key in "ps" output, stdout
-        system 'ceph-authtool', \
-          '/etc/ceph/ceph.client.admin.keyring', \
-          '--create-keyring', \
-          '--name=client.admin', \
-          "--add-key=#{key}"
-        raise 'creating admin keyring failed' unless $?.exitstatus == 0
-      end
-    end
-  end
-end
-
-ruby_block "save osd bootstrap key in node attributes" do
-  block do
-    if node['ceph_bootstrap_osd_key'].nil? then
-      if not have_quorum? then
-        puts 'ceph-mon is not in quorum, skipping bootstrap-osd key generation for this run'
-      else
-        key = %x[
-          ceph \
-            --name mon. \
-            --keyring '/var/lib/ceph/mon/#{cluster}-#{node['hostname']}/keyring' \
-            auth get-or-create-key client.bootstrap-osd mon \
-            "allow command osd create ...; \
-            allow command osd crush set ...; \
-            allow command auth add * osd allow\\ * mon allow\\ rwx; \
-            allow command mon getmap"
-        ]
-        raise 'adding or getting bootstrap-osd key failed' unless $?.exitstatus == 0
-        node.override['ceph_bootstrap_osd_key'] = key
-        node.save
-      end
-    end
-  end
-end
diff --git a/ceph/recipes/osd.rb b/ceph/recipes/osd.rb
deleted file mode 100644 (file)
index acad61b..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-#
-# Author:: Kyle Bader <kyle.bader@dreamhost.com>
-# Cookbook Name:: ceph
-# Recipe:: osd
-#
-# 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 "ceph::default"
diff --git a/ceph/recipes/rados-rest.rb b/ceph/recipes/rados-rest.rb
deleted file mode 100644 (file)
index 0001cca..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-#
-# Author:: Kyle Bader <kyle.bader@dreamhost.com>
-# Cookbook Name:: ceph
-# Recipe:: rados-client
-#
-# 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.
-                       
-
-packages = %w{
-       radosgw
-       radosgw-dbg
-}
-
-packages.each do |pkg|
-       package pkg do
-               action :upgrade
-       end
-end
diff --git a/ceph/recipes/radosgw.rb b/ceph/recipes/radosgw.rb
deleted file mode 100644 (file)
index 8a7fe65..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-#
-# Author:: Kyle Bader <kyle.bader@dreamhost.com>
-# Cookbook Name:: ceph
-# Recipe:: radosgw
-#
-# 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 "ceph::rados-rest"
-
-packages = %w{
-       libapache2-mod-fastcgi
-}
-
-include_recipe "apache2"
-
-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"
-end
-
-service "radosgw" do
-       service_name "radosgw"
-       supports :restart => true
-       action[:enable,:start]
-end
-
-apache_module "fastcgi" do
-       conf true
-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
-
diff --git a/ceph/roles/ceph-mds.rb b/ceph/roles/ceph-mds.rb
deleted file mode 100644 (file)
index d0b6380..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-name "ceph-mds"
-description "Ceph Metadata Server"
-run_list(
-        'recipe[ceph::mds]'
-)
diff --git a/ceph/roles/ceph-mon.rb b/ceph/roles/ceph-mon.rb
deleted file mode 100644 (file)
index 0fd7126..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-name "ceph-mon"
-description "Ceph Monitor"
-run_list(
-        'recipe[ceph::mon]'
-)
diff --git a/ceph/roles/ceph-osd.rb b/ceph/roles/ceph-osd.rb
deleted file mode 100644 (file)
index edf4088..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-name "ceph-osd"
-description "Ceph Object Storage Device"
-run_list(
-        'recipe[ceph::bootstrap_osd]'
-)
diff --git a/ceph/roles/ceph-radosgw.rb b/ceph/roles/ceph-radosgw.rb
deleted file mode 100644 (file)
index a4ee87a..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-name "ceph-radosgw"
-description "Ceph RADOS Gateway"
-run_list(
-        'recipe[ceph::radosgw]'
-)
diff --git a/ceph/templates/default/apt-sources-list.release.erb b/ceph/templates/default/apt-sources-list.release.erb
deleted file mode 100644 (file)
index 13dba6b..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-<% if @branch.nil? %>
-deb http://ceph.newdream.net/debian/ <%= @codename %> main
-deb-src http://ceph.newdream.net/debian/ <%= @codename %> main
-<% else %>
-deb http://gitbuilder.ceph.com/ceph-deb-<%= @codename %>-x86_64-basic/ref/<%= @branch %>/ <%= @codename %> main
-deb-src http://gitbuilder.ceph.com/ceph-deb-<%= @codename %>-x86_64-basic/ref/<%= @branch %>/ <%= @codename %> main
-<% end %>
diff --git a/ceph/templates/default/ceph.conf.erb b/ceph/templates/default/ceph.conf.erb
deleted file mode 100644 (file)
index ab4d682..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-[global]
-       auth supported = cephx
-       keyring = /etc/ceph/$cluster.$name.keyring
-
-       # this will be used by all clients to discover the mons to
-       # talk to; this way we don't need to have separate [mon.foo]
-       # sections, and come up with names for the mons just to be
-       # able to list their addresses
-       mon host = <%= @mon_addresses.join(', ') %>
-
-       <% node['ceph']['config'].each do |k, v| %>
-       <%= k %> = <%= v %>
-       <% end %>
-
-[mon]
-       keyring = /var/lib/ceph/mon/$cluster-$id/keyring
-
-[mds]
-       keyring = /var/lib/ceph/mds/$cluster-$id/keyring
-
-[osd]
-       keyring = /var/lib/ceph/osd/$cluster-$id/keyring
-       osd journal size = 1000
-       filestore_xattr_use_omap = true
-
-<% node['ceph']['config-sections'].each do |name, sect| %>
-
-[<%= name %>]
-<% sect.each do |k, v| %>
-<%= k %> = <%= v %>
-<% end %>
-<% end %>
diff --git a/ceph/templates/default/mods/fastcgi.conf.erb b/ceph/templates/default/mods/fastcgi.conf.erb
deleted file mode 100644 (file)
index a252609..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-<IfModule mod_fastcgi.c>
-  AddHandler fastcgi-script .fcgi
-  #FastCgiWrapper /usr/lib/apache2/suexec
-  FastCgiIpcDir /var/lib/apache2/fastcgi
-</IfModule>
diff --git a/ceph/templates/default/rgw.conf.erb b/ceph/templates/default/rgw.conf.erb
deleted file mode 100644 (file)
index 11fb8f2..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-FastCgiExternalServer /var/www/dummyradosgw.fcgi -socket /var/run/ceph/radosgw.client.radosgw.<%= node[:hostname] %>
-
-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 %>
-  DocumentRoot /var/www/
-
-  RewriteEngine On
-  RewriteRule             ^/(.*) /dummyradosgw.fcgi?params=$1&%{QUERY_STRING} [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
-
-  <IfModule mod_fastcgi.c>
-    <Directory /var/www/>
-      Options +ExecCGI
-      AllowOverride All
-      SetHandler fastcgi-script
-      Order allow,deny
-      Allow from all
-      AuthBasicAuthoritative Off
-    </Directory>
-  </IfModule>
-
-  AllowEncodedSlashes On
-
-  ErrorLog /var/log/apache2/error.log
-  CustomLog /var/log/apache2/sssrgw-access.log proxy_combined
-  ServerSignature Off
-</VirtualHost>
diff --git a/files/default/radosgw b/files/default/radosgw
new file mode 100755 (executable)
index 0000000..4c01c2b
--- /dev/null
@@ -0,0 +1,38 @@
+#! /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
diff --git a/libraries/default.rb b/libraries/default.rb
new file mode 100644 (file)
index 0000000..34cc1b0
--- /dev/null
@@ -0,0 +1,30 @@
+def is_crowbar?()
+  return defined?(Chef::Recipe::Barclamp) != nil
+end
+
+def get_mon_addresses()
+  if is_crowbar?
+    mon_addresses = search(:node, "role:ceph-mon AND ceph_config_environment:#{node['ceph']['config']['environment']}").map { |node| Chef::Recipe::Barclamp::Inventory.get_network_by_type(node, "admin").address + ":6789" }
+  else
+    mon_addresses = search(:node, "role:ceph-mon AND chef_environment:#{node.chef_environment}").map { |node| node["ipaddress"] + ":6789" }
+  end
+  return mon_addresses
+end
+
+QUORUM_STATES = ['leader', 'peon']
+
+def have_quorum?()
+    # "ceph auth get-or-create-key" would hang if the monitor wasn't
+    # in quorum yet, which is highly likely on the first run. This
+    # helper lets us delay the key generation into the next
+    # chef-client run, instead of hanging.
+    #
+    # Also, as the UNIX domain socket connection has no timeout logic
+    # in the ceph tool, this exits immediately if the ceph-mon is not
+    # running for any reason; trying to connect via TCP/IP would wait
+    # for a relatively long timeout.
+    mon_status = %x[ceph --admin-daemon /var/run/ceph/ceph-mon.#{node['hostname']}.asok mon_status]
+    raise 'getting monitor state failed' unless $?.exitstatus == 0
+    state = JSON.parse(mon_status)['state']
+    return QUORUM_STATES.include?(state)
+end
diff --git a/metadata.rb b/metadata.rb
new file mode 100644 (file)
index 0000000..52349c0
--- /dev/null
@@ -0,0 +1,7 @@
+maintainer                     "Kyle Bader"
+maintainer_email       "kyle.bader@dreamhost.com"
+license                                "Apache 2.0"
+description                    "Installs/Configures the Ceph distributed filesystem"
+long_description       IO.read(File.join(File.dirname(__FILE__), 'README.md'))
+version                                "0.0.10"
+depends                                "apache2"
diff --git a/recipes/apt.rb b/recipes/apt.rb
new file mode 100644 (file)
index 0000000..1c91226
--- /dev/null
@@ -0,0 +1,21 @@
+release_or_autobuild = node["ceph_branch"].nil? ? "release" : "autobuild"
+
+execute "add autobuild gpg key to apt" do
+  command <<-EOH
+wget -q -O- https://raw.github.com/ceph/ceph/master/keys/#{release_or_autobuild}.asc \
+| sudo apt-key add -
+  EOH
+end
+
+template '/etc/apt/sources.list.d/ceph.list' do
+  owner 'root'
+  group 'root'
+  mode '0644'
+  source 'apt-sources-list.release.erb'
+  variables(
+    :codename => node[:lsb][:codename],
+    :branch => node["ceph_branch"]
+  )
+end
+
+execute 'apt-get update'
diff --git a/recipes/bootstrap_osd.rb b/recipes/bootstrap_osd.rb
new file mode 100644 (file)
index 0000000..6905d72
--- /dev/null
@@ -0,0 +1,41 @@
+# this recipe allows bootstrapping new osds, with help from mon
+
+include_recipe "ceph::osd"
+include_recipe "ceph::conf"
+
+if is_crowbar?
+  mons = search(:node, "role:ceph-mon AND ceph_config_environment:#{node['ceph']['config']['environment']} AND ceph_bootstrap_osd_key:*")
+else
+  mons = search(:node, "role:ceph-mon AND chef_environment:#{node.chef_environment} AND ceph_bootstrap_osd_key:*")
+end
+
+if mons.length < 1 then
+  puts "No ceph-mon found."
+else
+
+  directory "/var/lib/ceph/bootstrap-osd" do
+    owner "root"
+    group "root"
+    mode "0755"
+  end
+
+  # TODO cluster name
+  cluster = 'ceph'
+
+  file "/var/lib/ceph/bootstrap-osd/#{cluster}.keyring.raw" do
+    owner "root"
+    group "root"
+    mode "0440"
+    content mons[0]["ceph_bootstrap_osd_key"]
+  end
+
+  execute "format as keyring" do
+    command <<-EOH
+      set -e
+      # TODO don't put the key in "ps" output, stdout
+      read KEY <'/var/lib/ceph/bootstrap-osd/#{cluster}.keyring.raw'
+      ceph-authtool '/var/lib/ceph/bootstrap-osd/#{cluster}.keyring' --create-keyring --name=client.bootstrap-osd --add-key="$KEY"
+      rm -f '/var/lib/ceph/bootstrap-osd/#{cluster}.keyring.raw'
+    EOH
+  end
+end
diff --git a/recipes/conf.rb b/recipes/conf.rb
new file mode 100644 (file)
index 0000000..582ab5b
--- /dev/null
@@ -0,0 +1,12 @@
+raise "fsid must be set in config" if node["ceph"]["config"]['fsid'].nil?
+raise "mon_initial_members must be set in config" if node["ceph"]["config"]['mon_initial_members'].nil?
+
+mon_addresses = get_mon_addresses()
+
+template '/etc/ceph/ceph.conf' do
+  source 'ceph.conf.erb'
+  variables(
+    :mon_addresses => mon_addresses
+  )
+  mode '0644'
+end
diff --git a/recipes/default.rb b/recipes/default.rb
new file mode 100644 (file)
index 0000000..83efa38
--- /dev/null
@@ -0,0 +1,31 @@
+#
+# Author:: Kyle Bader <kyle.bader@dreamhost.com>
+# Cookbook Name:: ceph
+# Recipe:: default
+#
+# 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.
+                       
+packages = %w{
+       ceph
+       ceph-dbg
+       ceph-common
+       ceph-common-dbg
+}
+
+packages.each do |pkg|
+       package pkg do
+               action :upgrade
+       end
+end
diff --git a/recipes/mds.rb b/recipes/mds.rb
new file mode 100644 (file)
index 0000000..76816ba
--- /dev/null
@@ -0,0 +1,20 @@
+#
+# Author:: Kyle Bader <kyle.bader@dreamhost.com>
+# Cookbook Name:: ceph
+# Recipe:: mds
+#
+# 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 "ceph::default"
diff --git a/recipes/mon.rb b/recipes/mon.rb
new file mode 100644 (file)
index 0000000..13d067b
--- /dev/null
@@ -0,0 +1,106 @@
+# this recipe creates a monitor cluster
+
+require 'json'
+
+include_recipe "ceph::default"
+include_recipe "ceph::conf"
+
+if is_crowbar?
+  ipaddress = Chef::Recipe::Barclamp::Inventory.get_network_by_type(node, "admin").address
+else
+  ipaddress = node['ipaddress']
+end
+
+service "ceph-mon-all-starter" do
+  provider Chef::Provider::Service::Upstart
+  action [:enable]
+end
+
+# TODO cluster name
+cluster = 'ceph'
+
+execute 'ceph-mon mkfs' do
+  command <<-EOH
+set -e
+# TODO chef creates doesn't seem to suppressing re-runs, do it manually
+if [ -e '/var/lib/ceph/mon/ceph-#{node["hostname"]}/done' ]; then
+  echo 'ceph-mon mkfs already done, skipping'
+  exit 0
+fi
+KR='/var/lib/ceph/tmp/#{cluster}-#{node['hostname']}.mon.keyring'
+# TODO don't put the key in "ps" output, stdout
+ceph-authtool "$KR" --create-keyring --name=mon. --add-key='#{node["ceph"]["monitor-secret"]}' --cap mon 'allow *'
+
+ceph-mon --mkfs -i #{node['hostname']} --keyring "$KR"
+rm -f -- "$KR"
+touch /var/lib/ceph/mon/ceph-#{node['hostname']}/done
+EOH
+  # TODO built-in done-ness flag for ceph-mon?
+  creates '/var/lib/ceph/mon/ceph-#{node["hostname"]}/done'
+  notifies :start, "service[ceph-mon-all-starter]", :immediately
+end
+
+ruby_block "tell ceph-mon about its peers" do
+  block do
+    mon_addresses = get_mon_addresses()
+    mon_addresses.each do |addr|
+      system 'ceph', \
+        '--admin-daemon', "/var/run/ceph/ceph-mon.#{node['hostname']}.asok", \
+        'add_bootstrap_peer_hint', "#{addr}"
+      # ignore errors
+    end
+  end
+end
+
+ruby_block "create client.admin keyring" do
+  block do
+    if not ::File.exists?('/etc/ceph/ceph.client.admin.keyring') then
+      if not have_quorum? then
+        puts 'ceph-mon is not in quorum, skipping bootstrap-osd key generation for this run'
+      else
+        # TODO --set-uid=0
+        key = %x[
+        ceph \
+          --name mon. \
+          --keyring '/var/lib/ceph/mon/#{cluster}-#{node['hostname']}/keyring' \
+          auth get-or-create-key client.admin \
+          mon 'allow *' \
+          osd 'allow *' \
+          mds allow
+        ]
+        raise 'adding or getting admin key failed' unless $?.exitstatus == 0
+        # TODO don't put the key in "ps" output, stdout
+        system 'ceph-authtool', \
+          '/etc/ceph/ceph.client.admin.keyring', \
+          '--create-keyring', \
+          '--name=client.admin', \
+          "--add-key=#{key}"
+        raise 'creating admin keyring failed' unless $?.exitstatus == 0
+      end
+    end
+  end
+end
+
+ruby_block "save osd bootstrap key in node attributes" do
+  block do
+    if node['ceph_bootstrap_osd_key'].nil? then
+      if not have_quorum? then
+        puts 'ceph-mon is not in quorum, skipping bootstrap-osd key generation for this run'
+      else
+        key = %x[
+          ceph \
+            --name mon. \
+            --keyring '/var/lib/ceph/mon/#{cluster}-#{node['hostname']}/keyring' \
+            auth get-or-create-key client.bootstrap-osd mon \
+            "allow command osd create ...; \
+            allow command osd crush set ...; \
+            allow command auth add * osd allow\\ * mon allow\\ rwx; \
+            allow command mon getmap"
+        ]
+        raise 'adding or getting bootstrap-osd key failed' unless $?.exitstatus == 0
+        node.override['ceph_bootstrap_osd_key'] = key
+        node.save
+      end
+    end
+  end
+end
diff --git a/recipes/osd.rb b/recipes/osd.rb
new file mode 100644 (file)
index 0000000..acad61b
--- /dev/null
@@ -0,0 +1,20 @@
+#
+# Author:: Kyle Bader <kyle.bader@dreamhost.com>
+# Cookbook Name:: ceph
+# Recipe:: osd
+#
+# 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 "ceph::default"
diff --git a/recipes/rados-rest.rb b/recipes/rados-rest.rb
new file mode 100644 (file)
index 0000000..0001cca
--- /dev/null
@@ -0,0 +1,30 @@
+#
+# Author:: Kyle Bader <kyle.bader@dreamhost.com>
+# Cookbook Name:: ceph
+# Recipe:: rados-client
+#
+# 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.
+                       
+
+packages = %w{
+       radosgw
+       radosgw-dbg
+}
+
+packages.each do |pkg|
+       package pkg do
+               action :upgrade
+       end
+end
diff --git a/recipes/radosgw.rb b/recipes/radosgw.rb
new file mode 100644 (file)
index 0000000..8a7fe65
--- /dev/null
@@ -0,0 +1,73 @@
+#
+# Author:: Kyle Bader <kyle.bader@dreamhost.com>
+# Cookbook Name:: ceph
+# Recipe:: radosgw
+#
+# 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 "ceph::rados-rest"
+
+packages = %w{
+       libapache2-mod-fastcgi
+}
+
+include_recipe "apache2"
+
+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"
+end
+
+service "radosgw" do
+       service_name "radosgw"
+       supports :restart => true
+       action[:enable,:start]
+end
+
+apache_module "fastcgi" do
+       conf true
+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
+
diff --git a/roles/ceph-mds.rb b/roles/ceph-mds.rb
new file mode 100644 (file)
index 0000000..d0b6380
--- /dev/null
@@ -0,0 +1,5 @@
+name "ceph-mds"
+description "Ceph Metadata Server"
+run_list(
+        'recipe[ceph::mds]'
+)
diff --git a/roles/ceph-mon.rb b/roles/ceph-mon.rb
new file mode 100644 (file)
index 0000000..0fd7126
--- /dev/null
@@ -0,0 +1,5 @@
+name "ceph-mon"
+description "Ceph Monitor"
+run_list(
+        'recipe[ceph::mon]'
+)
diff --git a/roles/ceph-osd.rb b/roles/ceph-osd.rb
new file mode 100644 (file)
index 0000000..edf4088
--- /dev/null
@@ -0,0 +1,5 @@
+name "ceph-osd"
+description "Ceph Object Storage Device"
+run_list(
+        'recipe[ceph::bootstrap_osd]'
+)
diff --git a/roles/ceph-radosgw.rb b/roles/ceph-radosgw.rb
new file mode 100644 (file)
index 0000000..a4ee87a
--- /dev/null
@@ -0,0 +1,5 @@
+name "ceph-radosgw"
+description "Ceph RADOS Gateway"
+run_list(
+        'recipe[ceph::radosgw]'
+)
diff --git a/templates/default/apt-sources-list.release.erb b/templates/default/apt-sources-list.release.erb
new file mode 100644 (file)
index 0000000..13dba6b
--- /dev/null
@@ -0,0 +1,7 @@
+<% if @branch.nil? %>
+deb http://ceph.newdream.net/debian/ <%= @codename %> main
+deb-src http://ceph.newdream.net/debian/ <%= @codename %> main
+<% else %>
+deb http://gitbuilder.ceph.com/ceph-deb-<%= @codename %>-x86_64-basic/ref/<%= @branch %>/ <%= @codename %> main
+deb-src http://gitbuilder.ceph.com/ceph-deb-<%= @codename %>-x86_64-basic/ref/<%= @branch %>/ <%= @codename %> main
+<% end %>
diff --git a/templates/default/ceph.conf.erb b/templates/default/ceph.conf.erb
new file mode 100644 (file)
index 0000000..ab4d682
--- /dev/null
@@ -0,0 +1,32 @@
+[global]
+       auth supported = cephx
+       keyring = /etc/ceph/$cluster.$name.keyring
+
+       # this will be used by all clients to discover the mons to
+       # talk to; this way we don't need to have separate [mon.foo]
+       # sections, and come up with names for the mons just to be
+       # able to list their addresses
+       mon host = <%= @mon_addresses.join(', ') %>
+
+       <% node['ceph']['config'].each do |k, v| %>
+       <%= k %> = <%= v %>
+       <% end %>
+
+[mon]
+       keyring = /var/lib/ceph/mon/$cluster-$id/keyring
+
+[mds]
+       keyring = /var/lib/ceph/mds/$cluster-$id/keyring
+
+[osd]
+       keyring = /var/lib/ceph/osd/$cluster-$id/keyring
+       osd journal size = 1000
+       filestore_xattr_use_omap = true
+
+<% node['ceph']['config-sections'].each do |name, sect| %>
+
+[<%= name %>]
+<% sect.each do |k, v| %>
+<%= k %> = <%= v %>
+<% end %>
+<% end %>
diff --git a/templates/default/mods/fastcgi.conf.erb b/templates/default/mods/fastcgi.conf.erb
new file mode 100644 (file)
index 0000000..a252609
--- /dev/null
@@ -0,0 +1,5 @@
+<IfModule mod_fastcgi.c>
+  AddHandler fastcgi-script .fcgi
+  #FastCgiWrapper /usr/lib/apache2/suexec
+  FastCgiIpcDir /var/lib/apache2/fastcgi
+</IfModule>
diff --git a/templates/default/rgw.conf.erb b/templates/default/rgw.conf.erb
new file mode 100644 (file)
index 0000000..11fb8f2
--- /dev/null
@@ -0,0 +1,30 @@
+FastCgiExternalServer /var/www/dummyradosgw.fcgi -socket /var/run/ceph/radosgw.client.radosgw.<%= node[:hostname] %>
+
+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 %>
+  DocumentRoot /var/www/
+
+  RewriteEngine On
+  RewriteRule             ^/(.*) /dummyradosgw.fcgi?params=$1&%{QUERY_STRING} [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
+
+  <IfModule mod_fastcgi.c>
+    <Directory /var/www/>
+      Options +ExecCGI
+      AllowOverride All
+      SetHandler fastcgi-script
+      Order allow,deny
+      Allow from all
+      AuthBasicAuthoritative Off
+    </Directory>
+  </IfModule>
+
+  AllowEncodedSlashes On
+
+  ErrorLog /var/log/apache2/error.log
+  CustomLog /var/log/apache2/sssrgw-access.log proxy_combined
+  ServerSignature Off
+</VirtualHost>