From fc1221b5e2c8da0a00b7a365bb1a8009b5055a9b Mon Sep 17 00:00:00 2001 From: Carl Perry Date: Thu, 22 Sep 2011 16:01:27 -0700 Subject: [PATCH] Initial Import to Public Repository --- README.md | 1 + admin-tools/README.rdoc | 0 admin-tools/metadata.rb | 6 + admin-tools/recipes/default.rb | 37 +++++ btrfs/README.rdoc | 0 btrfs/metadata.rb | 6 + btrfs/recipes/default.rb | 29 ++++ ceph/README.md | 129 ++++++++++++++++++ ceph/attributes/radosgw.rb | 22 +++ ceph/files/default/radosgw | 38 ++++++ ceph/metadata.rb | 9 ++ ceph/providers/mkcephfs.rb | 0 ceph/recipes/default.rb | 30 ++++ ceph/recipes/mds.rb | 20 +++ ceph/recipes/mon.rb | 34 +++++ ceph/recipes/osd.rb | 22 +++ ceph/recipes/oss.rb | 25 ++++ ceph/recipes/rados-rest.rb | 33 +++++ ceph/recipes/radosgw.rb | 78 +++++++++++ ceph/templates/default/apache-pin.erb | 3 + ceph/templates/default/mods/fastcgi.conf.erb | 5 + ceph/templates/default/pin.erb | 3 + ceph/templates/default/rgw.conf.erb | 40 ++++++ collectd/README.rdoc | 0 collectd/metadata.rb | 6 + collectd/recipes/ceph-mon.rb | 60 ++++++++ collectd/recipes/ceph-osd.rb | 68 +++++++++ collectd/recipes/default.rb | 61 +++++++++ .../templates/default/collectd-mon.conf.erb | 44 ++++++ .../templates/default/collectd-osd.conf.erb | 41 ++++++ collectd/templates/default/collectd.conf.erb | 34 +++++ handle-core/README.rdoc | 0 handle-core/metadata.rb | 6 + handle-core/recipes/default.rb | 22 +++ parted/README.rdoc | 0 parted/metadata.rb | 6 + parted/recipes/default.rb | 22 +++ 37 files changed, 940 insertions(+) create mode 100644 README.md create mode 100644 admin-tools/README.rdoc create mode 100644 admin-tools/metadata.rb create mode 100644 admin-tools/recipes/default.rb create mode 100644 btrfs/README.rdoc create mode 100644 btrfs/metadata.rb create mode 100644 btrfs/recipes/default.rb create mode 100644 ceph/README.md create mode 100644 ceph/attributes/radosgw.rb create mode 100755 ceph/files/default/radosgw create mode 100644 ceph/metadata.rb create mode 100644 ceph/providers/mkcephfs.rb create mode 100644 ceph/recipes/default.rb create mode 100644 ceph/recipes/mds.rb create mode 100644 ceph/recipes/mon.rb create mode 100644 ceph/recipes/osd.rb create mode 100644 ceph/recipes/oss.rb create mode 100644 ceph/recipes/rados-rest.rb create mode 100644 ceph/recipes/radosgw.rb create mode 100644 ceph/templates/default/apache-pin.erb create mode 100644 ceph/templates/default/mods/fastcgi.conf.erb create mode 100644 ceph/templates/default/pin.erb create mode 100644 ceph/templates/default/rgw.conf.erb create mode 100644 collectd/README.rdoc create mode 100644 collectd/metadata.rb create mode 100644 collectd/recipes/ceph-mon.rb create mode 100644 collectd/recipes/ceph-osd.rb create mode 100644 collectd/recipes/default.rb create mode 100644 collectd/templates/default/collectd-mon.conf.erb create mode 100644 collectd/templates/default/collectd-osd.conf.erb create mode 100644 collectd/templates/default/collectd.conf.erb create mode 100644 handle-core/README.rdoc create mode 100644 handle-core/metadata.rb create mode 100644 handle-core/recipes/default.rb create mode 100644 parted/README.rdoc create mode 100644 parted/metadata.rb create mode 100644 parted/recipes/default.rb diff --git a/README.md b/README.md new file mode 100644 index 0000000..5c00421 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +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. diff --git a/admin-tools/README.rdoc b/admin-tools/README.rdoc new file mode 100644 index 0000000..e69de29 diff --git a/admin-tools/metadata.rb b/admin-tools/metadata.rb new file mode 100644 index 0000000..1972ddb --- /dev/null +++ b/admin-tools/metadata.rb @@ -0,0 +1,6 @@ +maintainer "Kyle Bader" +maintainer_email "kyle.bader@dreamhost.com" +license "Apache 2.0" +description "Installs the parted disk utility" +long_description IO.read(File.join(File.dirname(__FILE__), 'README.rdoc')) +version "0.0.1" diff --git a/admin-tools/recipes/default.rb b/admin-tools/recipes/default.rb new file mode 100644 index 0000000..e63f832 --- /dev/null +++ b/admin-tools/recipes/default.rb @@ -0,0 +1,37 @@ +# +# Author:: Kyle Bader +# Cookbook Name:: admin-tools +# 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{ + git-core + gdb + inotail + iotop + iftop + iptraf + pdsh + tcpdump + strace + sysstat +} + +packages.each do |pkg| + package pkg do + action :upgrade + end +end diff --git a/btrfs/README.rdoc b/btrfs/README.rdoc new file mode 100644 index 0000000..e69de29 diff --git a/btrfs/metadata.rb b/btrfs/metadata.rb new file mode 100644 index 0000000..ced68b4 --- /dev/null +++ b/btrfs/metadata.rb @@ -0,0 +1,6 @@ +maintainer "Kyle Bader" +maintainer_email "kyle.bader@dreamhost.com" +license "Apache 2.0" +description "Installs tools for BTRFS filesystems" +long_description IO.read(File.join(File.dirname(__FILE__), 'README.rdoc')) +version "0.0.1" diff --git a/btrfs/recipes/default.rb b/btrfs/recipes/default.rb new file mode 100644 index 0000000..47e2af8 --- /dev/null +++ b/btrfs/recipes/default.rb @@ -0,0 +1,29 @@ +# +# Author:: Kyle Bader +# Cookbook Name:: btrfs +# 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{ + btrfs-tools + btrfs-tools-dbg +} + +packages.each do |pkg| + package pkg do + action :upgrade + end +end diff --git a/ceph/README.md b/ceph/README.md new file mode 100644 index 0000000..baf9eb7 --- /dev/null +++ b/ceph/README.md @@ -0,0 +1,129 @@ +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 + +* btrfs +* parted + + +ATTRIBUTES +========== + +Ceph Rados Gateway +------------------ + +* node[:ceph][:radosgw][:api_fqdn] +* node[:ceph][:radosgw][:admin_email] +* node[:ceph][:radosgw][:rgw_addr] + +Ceph Balancer +------------- + +* +* + +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: + + + +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 + +Ceph Balancer +------------- + +Ceph Balancer nodes should use the ceph::balancer recipe + +Includes: + +* + +LICENSE AND AUTHORS +=================== + +* Author: Kyle Bader + +* 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/radosgw.rb b/ceph/attributes/radosgw.rb new file mode 100644 index 0000000..9addfc7 --- /dev/null +++ b/ceph/attributes/radosgw.rb @@ -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"] = "127.0.0.1" +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 new file mode 100755 index 0000000..4c01c2b --- /dev/null +++ b/ceph/files/default/radosgw @@ -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/ceph/metadata.rb b/ceph/metadata.rb new file mode 100644 index 0000000..0d5dd49 --- /dev/null +++ b/ceph/metadata.rb @@ -0,0 +1,9 @@ +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" +depends "btrfs" +depends "parted" diff --git a/ceph/providers/mkcephfs.rb b/ceph/providers/mkcephfs.rb new file mode 100644 index 0000000..e69de29 diff --git a/ceph/recipes/default.rb b/ceph/recipes/default.rb new file mode 100644 index 0000000..fdda443 --- /dev/null +++ b/ceph/recipes/default.rb @@ -0,0 +1,30 @@ +# +# Author:: Kyle Bader +# 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 + libceph1 +} + +packages.each do |pkg| + package pkg do + action :upgrade + end +end diff --git a/ceph/recipes/mds.rb b/ceph/recipes/mds.rb new file mode 100644 index 0000000..76816ba --- /dev/null +++ b/ceph/recipes/mds.rb @@ -0,0 +1,20 @@ +# +# Author:: Kyle Bader +# 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 new file mode 100644 index 0000000..5a6f605 --- /dev/null +++ b/ceph/recipes/mon.rb @@ -0,0 +1,34 @@ +# +# Author:: Kyle Bader +# Cookbook Name:: ceph +# Recipe:: mon +# +# 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" +include_recipe "ceph::rados-rest" + +packages = %w{ + librbd1 + ceph-client-tools + ceph-client-tools-dbg +} + +packages.each do |pkg| + package pkg do + version = node['ceph']['version'] + action :upgrade + end +end diff --git a/ceph/recipes/osd.rb b/ceph/recipes/osd.rb new file mode 100644 index 0000000..4808ae5 --- /dev/null +++ b/ceph/recipes/osd.rb @@ -0,0 +1,22 @@ +# +# Author:: Kyle Bader +# 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 "btrfs" +include_recipe "parted" +include_recipe "ceph::default" diff --git a/ceph/recipes/oss.rb b/ceph/recipes/oss.rb new file mode 100644 index 0000000..207224e --- /dev/null +++ b/ceph/recipes/oss.rb @@ -0,0 +1,25 @@ +# +# Author:: Kyle Bader +# Cookbook Name:: ceph +# Recipe:: oss +# +# 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" + +package "obsync" do + version = node['ceph']['version'] + action :install +end diff --git a/ceph/recipes/rados-rest.rb b/ceph/recipes/rados-rest.rb new file mode 100644 index 0000000..23c5e03 --- /dev/null +++ b/ceph/recipes/rados-rest.rb @@ -0,0 +1,33 @@ +# +# Author:: Kyle Bader +# 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 + librados2 + librgw1 +} + +packages.each do |pkg| + package pkg do + version = node['ceph']['version'] + action :upgrade + end +end diff --git a/ceph/recipes/radosgw.rb b/ceph/recipes/radosgw.rb new file mode 100644 index 0000000..6c70648 --- /dev/null +++ b/ceph/recipes/radosgw.rb @@ -0,0 +1,78 @@ +# +# Author:: Kyle Bader +# 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{ + apache2 + apache2-mpm-worker + apache2-utils + apache2.2-bin + apache2.2-common + 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][:api_fqdn], + :ceph_admin_email => node[:ceph][:admin_email], + :ceph_rgw_addr => node[:ceph][: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/templates/default/apache-pin.erb b/ceph/templates/default/apache-pin.erb new file mode 100644 index 0000000..0530b4e --- /dev/null +++ b/ceph/templates/default/apache-pin.erb @@ -0,0 +1,3 @@ +Package: <%= @package %> +Pin: version <%= node[:ceph][:apache2_version] %> +Pin-Priority: 1001 diff --git a/ceph/templates/default/mods/fastcgi.conf.erb b/ceph/templates/default/mods/fastcgi.conf.erb new file mode 100644 index 0000000..a252609 --- /dev/null +++ b/ceph/templates/default/mods/fastcgi.conf.erb @@ -0,0 +1,5 @@ + + AddHandler fastcgi-script .fcgi + #FastCgiWrapper /usr/lib/apache2/suexec + FastCgiIpcDir /var/lib/apache2/fastcgi + diff --git a/ceph/templates/default/pin.erb b/ceph/templates/default/pin.erb new file mode 100644 index 0000000..cb9e576 --- /dev/null +++ b/ceph/templates/default/pin.erb @@ -0,0 +1,3 @@ +Package: <%= @package %> +Pin: version <%= node[:ceph][:version] %> +Pin-Priority: 1001 diff --git a/ceph/templates/default/rgw.conf.erb b/ceph/templates/default/rgw.conf.erb new file mode 100644 index 0000000..05e12fa --- /dev/null +++ b/ceph/templates/default/rgw.conf.erb @@ -0,0 +1,40 @@ +FastCgiExternalServer /var/www/s3gw.fcgi -socket /var/run/ceph/radosgw.client.rgw-<%= 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 + +> + ServerName <%= @ceph_api_fqdn %> + ServerAdmin <%= @ceph_admin_email %> + DocumentRoot /var/www/ + + RewriteEngine On + RewriteRule ^/(.*) /s3gw.fcgi?params=$1&%{QUERY_STRING} [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L] + + + + Options +ExecCGI + AllowOverride All + SetHandler fastcgi-script + Order allow,deny + Allow from all + AuthBasicAuthoritative Off + + + + SetEnv RGW_DNS_NAME "<%= @ceph_api_fqdn %>" + SetEnv RGW_LOG_LEVEL 20 + SetEnv RGW_PRINT_CONTINUE "yes" + SetEnv RGW_OPENSTACK_URL "http://<%= @ceph_api_fqdn %>" + SetEnv RGW_OPENSTACK_URL_PREFIX "swift" + SetEnv RGW_REMOTE_ADDR_PARAM "X-Forwarded-For" + + SetEnv CEPH_ARGS "-n client.rgw-<%= node[:hostname] %>" + SetEnv RGW_SHOULD_LOG "yes" + + AllowEncodedSlashes On + + ErrorLog /var/log/apache2/error.log + CustomLog /var/log/apache2/sssrgw-access.log proxy_combined + ServerSignature Off + diff --git a/collectd/README.rdoc b/collectd/README.rdoc new file mode 100644 index 0000000..e69de29 diff --git a/collectd/metadata.rb b/collectd/metadata.rb new file mode 100644 index 0000000..efd6cce --- /dev/null +++ b/collectd/metadata.rb @@ -0,0 +1,6 @@ +maintainer "Kyle Bader" +maintainer_email "kyle.bader@dreamhost.com" +license "Apache 2.0" +description "Installs and configures collectd for Ceph" +long_description IO.read(File.join(File.dirname(__FILE__), 'README.rdoc')) +version "0.0.7" diff --git a/collectd/recipes/ceph-mon.rb b/collectd/recipes/ceph-mon.rb new file mode 100644 index 0000000..b407f3a --- /dev/null +++ b/collectd/recipes/ceph-mon.rb @@ -0,0 +1,60 @@ +# Author:: Kyle Bader +# Cookbook Name:: collectd +# Recipe:: ceph-mon +# +# 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{ + collectd + collectd-core +} + +packages.each do |pkg| + package pkg do + action :upgrade + end +end + +service "collectd" do + service_name "collectd" + supports :restart => true +end + +directories = %w{ + /etc/collectd + /var/lib/collectd + /var/lib/collectd/rrd +} + +directories.each do |dir| + directory dir do + action :create + mode 0755 + owner "root" + group "root" + end +end + +template "/etc/collectd/collectd.conf" do + source "collectd-mon.conf.erb" + owner "root" + group "root" + mode 0644 + notifies :restart, "service[collectd]" +end + +service "collectd" do + action[:enable,:start] +end diff --git a/collectd/recipes/ceph-osd.rb b/collectd/recipes/ceph-osd.rb new file mode 100644 index 0000000..3f42ab2 --- /dev/null +++ b/collectd/recipes/ceph-osd.rb @@ -0,0 +1,68 @@ + +# Author:: Kyle Bader +# Cookbook Name:: collectd +# Recipe:: ceph-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. + +packages = %w{ + collectd + collectd-core +} + +packages.each do |pkg| + package pkg do + action :upgrade + end +end + +service "collectd" do + service_name "collectd" + supports :restart => true +end + +directories = %w{ + /etc/collectd + /var/lib/collectd + /var/lib/collectd/rrd +} + +directories.each do |dir| + directory dir do + action :create + mode 0755 + owner "root" + group "root" + end +end + +hostname = node[:hostname] + +osds = %x[/usr/bin/cconf -c /etc/ceph/ceph.conf --list-sections osd --filter-key-value host=#{hostname}] + +template "/etc/collectd/collectd.conf" do + source "collectd-osd.conf.erb" + owner "root" + group "root" + mode 0644 + variables( + :osds => osds + ) + notifies :restart, "service[collectd]" +end + +service "collectd" do + action[:enable,:start] +end diff --git a/collectd/recipes/default.rb b/collectd/recipes/default.rb new file mode 100644 index 0000000..b0f9865 --- /dev/null +++ b/collectd/recipes/default.rb @@ -0,0 +1,61 @@ + +# Author:: Kyle Bader +# Cookbook Name:: collectd +# 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{ + collectd + collectd-core +} + +packages.each do |pkg| + package pkg do + action :upgrade + end +end + +service "collectd" do + service_name "collectd" + supports :restart => true +end + +directories = %w{ + /etc/collectd + /var/lib/collectd + /var/lib/collectd/rrd +} + +directories.each do |dir| + directory dir do + action :create + mode 0755 + owner "root" + group "root" + end +end + +template "/etc/collectd/collectd.conf" do + source "collectd.conf.erb" + owner "root" + group "root" + mode 0644 + notifies :restart, "service[collectd]" +end + +service "collectd" do + action[:enable,:start] +end diff --git a/collectd/templates/default/collectd-mon.conf.erb b/collectd/templates/default/collectd-mon.conf.erb new file mode 100644 index 0000000..7b50b50 --- /dev/null +++ b/collectd/templates/default/collectd-mon.conf.erb @@ -0,0 +1,44 @@ +Hostname <%= node[:fqdn] %> +LoadPlugin syslog + + LogLevel info + +LoadPlugin cpu +LoadPlugin df +LoadPlugin disk +LoadPlugin entropy +LoadPlugin interface +LoadPlugin load +LoadPlugin memory +LoadPlugin network +LoadPlugin processes +LoadPlugin swap +LoadPlugin uptime +LoadPlugin users + + LogLevel "debug" + file "/var/log/collectd.log" + Timestamp true + + + Server "<%= node[:collectd][:sink] %>" "25826" + TimeToLive 128 + MaxPacketSize 1024 + CacheFlush 1800 + + + DataDir "/var/lib/collectd/rrd" + +LoadPlugin python + + ModulePath "/usr/lib/collectd/python.so" + LogTraces true + Import "cephtool" + + cephtool "/usr/bin/ceph" + config "/etc/ceph/ceph.conf" + + + +Include "/etc/collectd/filters.conf" +Include "/etc/collectd/thresholds.conf" diff --git a/collectd/templates/default/collectd-osd.conf.erb b/collectd/templates/default/collectd-osd.conf.erb new file mode 100644 index 0000000..02625d0 --- /dev/null +++ b/collectd/templates/default/collectd-osd.conf.erb @@ -0,0 +1,41 @@ +Hostname <%= node[:fqdn] %> +LoadPlugin syslog + + LogLevel info + +LoadPlugin cpu +LoadPlugin df +LoadPlugin disk +LoadPlugin entropy +LoadPlugin interface +LoadPlugin load +LoadPlugin memory +LoadPlugin network +LoadPlugin processes +LoadPlugin swap +LoadPlugin uptime +LoadPlugin users + + LogLevel "debug" + file "/var/log/collectd.log" + Timestamp true + + + Server "<%= node[:collectd][:sink] %>" "25826" + TimeToLive 128 + MaxPacketSize 1024 + CacheFlush 1800 + + + DataDir "/var/lib/collectd/rrd" + +LoadPlugin ceph +<% @osds.each do |osd| -%> + + Name "<%= osd.chomp %>" + SocketPath "/var/run/ceph/<%= osd.chomp %>.asok" + +<% end -%> + +Include "/etc/collectd/filters.conf" +Include "/etc/collectd/thresholds.conf" diff --git a/collectd/templates/default/collectd.conf.erb b/collectd/templates/default/collectd.conf.erb new file mode 100644 index 0000000..e730f73 --- /dev/null +++ b/collectd/templates/default/collectd.conf.erb @@ -0,0 +1,34 @@ +Hostname <%= node[:fqdn] %> +LoadPlugin syslog + + LogLevel "info" + +LoadPlugin cpu +LoadPlugin df +LoadPlugin disk +LoadPlugin entropy +LoadPlugin interface +LoadPlugin load +LoadPlugin memory +LoadPlugin network +LoadPlugin processes +LoadPlugin swap +LoadPlugin uptime +LoadPlugin users + + LogLevel "debug" + file "/var/log/collectd.log" + Timestamp true + + + Server "<%= node[:collectd][:sink] %>" "25826" + TimeToLive 128 + MaxPacketSize 1024 + CacheFlush 1800 + + + DataDir "/var/lib/collectd/rrd" + + +Include "/etc/collectd/filters.conf" +Include "/etc/collectd/thresholds.conf" diff --git a/handle-core/README.rdoc b/handle-core/README.rdoc new file mode 100644 index 0000000..e69de29 diff --git a/handle-core/metadata.rb b/handle-core/metadata.rb new file mode 100644 index 0000000..7e4c5c7 --- /dev/null +++ b/handle-core/metadata.rb @@ -0,0 +1,6 @@ +maintainer "Kyle Bader" +maintainer_email "kyle.bader@dreamhost.com" +license "Apache 2.0" +description "Installs DreamHost Objects Core Handler" +long_description IO.read(File.join(File.dirname(__FILE__), 'README.rdoc')) +version "0.0.1" diff --git a/handle-core/recipes/default.rb b/handle-core/recipes/default.rb new file mode 100644 index 0000000..8f6757f --- /dev/null +++ b/handle-core/recipes/default.rb @@ -0,0 +1,22 @@ +# +# Author:: Kyle Bader +# Cookbook Name:: handle-core +# 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. + +package "handle-core" do + action :upgrade +end diff --git a/parted/README.rdoc b/parted/README.rdoc new file mode 100644 index 0000000..e69de29 diff --git a/parted/metadata.rb b/parted/metadata.rb new file mode 100644 index 0000000..1972ddb --- /dev/null +++ b/parted/metadata.rb @@ -0,0 +1,6 @@ +maintainer "Kyle Bader" +maintainer_email "kyle.bader@dreamhost.com" +license "Apache 2.0" +description "Installs the parted disk utility" +long_description IO.read(File.join(File.dirname(__FILE__), 'README.rdoc')) +version "0.0.1" diff --git a/parted/recipes/default.rb b/parted/recipes/default.rb new file mode 100644 index 0000000..f06966b --- /dev/null +++ b/parted/recipes/default.rb @@ -0,0 +1,22 @@ +# +# Author:: Kyle Bader +# Cookbook Name:: parted +# 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. + +package "parted" do + action :upgrade +end