Permalink
Browse files

attribute normalization

  • Loading branch information...
1 parent 7b9cb80 commit d3ea9e864e5dfc8d5e90aeba04c45349414b4f22 Philip (flip) Kromer committed Nov 18, 2011
Showing with 590 additions and 475 deletions.
  1. +5 −0 README-checklist.md
  2. +6 −0 TODO.md
  3. +1 −1 meta-cookbooks/install_from/README.md
  4. +23 −2 meta-cookbooks/install_from/providers/release.rb
  5. +15 −9 meta-cookbooks/install_from/resources/release.rb
  6. +1 −1 site-cookbooks/cassandra/README.md
  7. +1 −1 site-cookbooks/cassandra/attributes/default.rb
  8. +2 −2 site-cookbooks/cassandra/recipes/install_from_release.rb
  9. +1 −1 site-cookbooks/elasticsearch/attributes/default.rb
  10. +1 −1 site-cookbooks/elasticsearch/recipes/install_from_release.rb
  11. +3 −0 site-cookbooks/ganglia/attributes/default.rb
  12. +16 −16 site-cookbooks/ganglia/recipes/client.rb
  13. +9 −11 site-cookbooks/ganglia/recipes/gmetad.rb
  14. +10 −12 site-cookbooks/ganglia/recipes/server.rb
  15. +1 −1 site-cookbooks/ganglia/templates/default/gmetad.conf.erb
  16. +20 −20 site-cookbooks/ganglia/templates/default/gmond.conf.erb
  17. +8 −8 site-cookbooks/graphite/README.md
  18. +21 −12 site-cookbooks/graphite/attributes/default.rb
  19. +3 −3 site-cookbooks/graphite/metadata.rb
  20. +3 −3 site-cookbooks/graphite/recipes/carbon.rb
  21. +2 −2 site-cookbooks/graphite/recipes/ganglia.rb
  22. +27 −29 site-cookbooks/graphite/recipes/web.rb
  23. +6 −15 site-cookbooks/graphite/recipes/whisper.rb
  24. +3 −3 site-cookbooks/graphite/templates/default/carbon.conf.erb
  25. +23 −23 site-cookbooks/graphite/templates/default/graphite-vhost.conf.erb
  26. +0 −1 site-cookbooks/hadoop_cluster/attributes/default.rb
  27. +1 −0 site-cookbooks/hadoop_cluster/libraries/hadoop_cluster.rb
  28. +0 −5 site-cookbooks/hadoop_cluster/metadata.rb
  29. +2 −2 site-cookbooks/hadoop_cluster/templates/default/etc_default_hadoop.erb
  30. +20 −20 site-cookbooks/hbase/README.md
  31. +44 −20 site-cookbooks/hbase/attributes/default.rb
  32. +14 −16 site-cookbooks/hbase/metadata.rb
  33. +28 −30 site-cookbooks/hbase/recipes/default.rb
  34. +2 −3 site-cookbooks/hbase/recipes/master.rb
  35. +1 −2 site-cookbooks/hbase/recipes/regionserver.rb
  36. +5 −6 site-cookbooks/hbase/recipes/stargate.rb
  37. +2 −2 site-cookbooks/hbase/templates/default/hbase-env.sh.erb
  38. +12 −0 site-cookbooks/jruby/attributes/default.rb
  39. +18 −22 site-cookbooks/jruby/recipes/default.rb
  40. +2 −1 site-cookbooks/jruby/recipes/gems.rb
  41. +2 −2 site-cookbooks/nodejs/README.md
  42. +2 −2 site-cookbooks/nodejs/attributes/default.rb
  43. +2 −2 site-cookbooks/nodejs/metadata.rb
  44. +5 −5 site-cookbooks/nodejs/recipes/compile.rb
  45. +1 −1 site-cookbooks/nodejs/recipes/default.rb
  46. +1 −1 site-cookbooks/pig/README.md
  47. +2 −8 site-cookbooks/pig/attributes/default.rb
  48. +6 −10 site-cookbooks/pig/recipes/install_from_release.rb
  49. +1 −1 site-cookbooks/redis/README.md
  50. +1 −1 site-cookbooks/redis/attributes/default.rb
  51. +1 −1 site-cookbooks/redis/metadata.rb
  52. +1 −1 site-cookbooks/redis/recipes/install_from_release.rb
  53. +16 −16 site-cookbooks/redis/recipes/server.rb
  54. +1 −1 site-cookbooks/resque/README.md
  55. +15 −16 site-cookbooks/resque/attributes/default.rb
  56. +1 −1 site-cookbooks/resque/metadata.rb
  57. +45 −0 site-cookbooks/resque/recipes/dedicated_redis.rb
  58. +0 −43 site-cookbooks/resque/recipes/default.rb
  59. +49 −8 site-cookbooks/resque/recipes/server.rb
  60. +1 −1 site-cookbooks/resque/templates/default/resque_redis.conf.erb
  61. +4 −4 site-cookbooks/statsd/README.md
  62. +20 −6 site-cookbooks/statsd/attributes/default.rb
  63. +3 −3 site-cookbooks/statsd/metadata.rb
  64. +1 −23 site-cookbooks/statsd/recipes/default.rb
  65. +18 −0 site-cookbooks/statsd/recipes/server.rb
  66. +4 −4 site-cookbooks/statsd/templates/default/baseConfig.js.erb
  67. +2 −2 site-cookbooks/statsd/templates/default/sv-statsd-run.erb
  68. +20 −6 site-cookbooks/zookeeper/attributes/default.rb
  69. +3 −0 site-cookbooks/zookeeper/recipes/client.rb
View
@@ -184,6 +184,10 @@ use `deploy_{}` for anything that would be true whatever SCM you're using; use
* **java_home**
* AVOID **java_opts** if possible: assemble it in your recipe from intelligible attribute names.
+### Nitpicks
+
+* Always put file modes in quote marks: `mode "0664"` not `mode 0664`.
+
## Integrations
### provides_service
@@ -224,3 +228,4 @@ roles shouldn't assemble systems. The contents of the infochimps_chef/roles/plat
* Deprecated:
- Cluster and facet roles (`roles/gibbon_cluster.rb`, `roles/gibbon_namenode.rb`, etc) go away
- roles should be service-oriented: `hadoop_master` considered harmful, you should explicitly enumerate the services
+
View
@@ -3,6 +3,12 @@
- track global order of runlist additions, compile final list using that order
- syntactic sugar for ```server(0).fullname('blah')```
+### Knife commands
+
+* knife cluster kick fails if service isn't running
+
+* make clear directions for installing `cluster_chef` and its initial use.
+
### Cookbook attribute refresh:
| flip fixed | temujin9 checked |
@@ -7,7 +7,7 @@ Installs/Configures install_from
Does the fetch-unpack-configure-build-install dance.
Given a project `pig`, with url `http://apache.org/pig/pig-0.8.0.tar.gz`, and
-the default :root_dir of `/usr/local`, this provider will
+the default :prefix_dir of `/usr/local`, this provider will
* fetch it to :package_file (`/usr/local/src/pig-0.8.0.tar.gz`)
* unpack it to :install_dir (`/usr/local/share/pig-0.8.0`)
@@ -21,7 +21,7 @@
# Does the fetch-unpack-configure-build-install dance.
#
# Given a project 'pig', with url 'http://apache.org/pig/pig-0.8.0.tar.gz', and
-# the default :root_dir of '/usr/local', this provider will
+# the default :prefix_dir of '/usr/local', this provider will
#
# * fetch it to :release_file ('/usr/local/src/pig-0.8.0.tar.gz')
# * unpack it to :install_dir ('/usr/local/share/pig-0.8.0')
@@ -43,6 +43,7 @@
mode "0644"
action :create
not_if{ ::File.directory?(new_resource.install_dir) }
+ checksum new_resource.checksum if new_resource.checksum
end
end
@@ -58,6 +59,7 @@
user new_resource.user
cwd ::File.dirname(new_resource.install_dir)
code "#{new_resource.unrelease_cmd} '#{new_resource.release_file}'"
+ creates new_resource.install_dir
not_if{ ::File.directory?(new_resource.install_dir) }
environment new_resource.environment
end
@@ -78,10 +80,11 @@
action :install do
action_build
+ action_install_binaries
end
-
action :build_with_ant do
+ action_build
bash "build #{new_resource.name} with ant" do
user new_resource.user
cwd new_resource.install_dir
@@ -91,6 +94,7 @@
end
action :configure_with_configure do
+ action_configure
bash "configure #{new_resource.name} with configure" do
user new_resource.user
cwd new_resource.install_dir
@@ -100,6 +104,7 @@
end
action :build_with_make do
+ action_build
bash "build #{new_resource.name} with make" do
user new_resource.user
cwd new_resource.install_dir
@@ -108,7 +113,23 @@
end
end
+action :install_binaries do
+ new_resource.has_binaries.each do |bin|
+ link ::File.join(new_resource.prefix_root, 'bin', ::File.basename(bin)) do
+ to ::File.join(new_resource.home_dir, bin)
+ action :create
+ end
+ end
+end
+
+action :install_python do
+ action_install
+ command "python setup.py install"
+ cwd new_resource.install_dir
+end
+
action :install_with_make do
+ action_install
bash "install #{new_resource.name} with make" do
user new_resource.user
cwd new_resource.install_dir
@@ -22,26 +22,32 @@
actions( :download, :unpack, :configure, :build, :install,
:configure_with_configure,
:build_with_make, :build_with_ant,
- :install_with_make
+ :install_with_make, :install_binaries, :install_python
)
attribute :name, :name_attribute => true
attribute :release_url, :kind_of => String, :required => true
# Prefix directory -- other _dir attributes hang off this by default
-attribute :root_dir, :kind_of => String, :default => '/usr/local'
-# Directory for the unreleased contents, eg /usr/local/share/pig-0.8.0
+attribute :prefix_dir, :kind_of => String, :default => '/usr/local'
+# Directory for the unreleased contents, eg /usr/local/share/pig-0.8.0. Defaults to {prefix_dir}/share/{basename_of_release_url}
attribute :install_dir, :kind_of => String
-# Directory as the project is referred to, eg /usr/local/share/pig
+# Directory as the project is referred to, eg /usr/local/share/pig. Defaults to {prefix_dir}/{name}
attribute :home_dir, :kind_of => String
-# Directory for the release file, eg /usr/local/src
+# Release file name, eg /usr/local/src/pig-0.8.0.tar.gz
attribute :release_file, :kind_of => String
+# Checksum for the release file
+attribute :checksum, :kind_of => String, :default => nil
# Command to expand project
attribute :expand_cmd, :kind_of => String
# User to run as
attribute :user, :kind_of => String, :default => 'root'
# Environment to pass on to commands
attribute :environment, :kind_of => Hash, :default => {}
+# Binaries to install. Supply a path relative to install_dir, and it will be
+# symlinked to prefix_root
+attribute :has_binaries, :kind_of => Array, :default => []
+
def initialize(*args)
super
@@ -53,11 +59,11 @@ def assume_defaults!
::File.basename(release_url) =~ %r{^(.+?)(?:-bin)?\.(tar\.gz|tar\.bz2|zip)$}
release_basename, release_ext = [$1, $2]
- Chef::Log.info( [self, release_basename, release_ext, self.to_hash, release_url, root_dir ].inspect )
+ Chef::Log.info( [self, release_basename, release_ext, self.to_hash, release_url, prefix_dir ].inspect )
- @install_dir ||= ::File.join(root_dir, 'share', release_basename)
- @home_dir ||= ::File.join(root_dir, 'share', name)
- @release_file ||= ::File.join(root_dir, 'src', ::File.basename(release_url))
+ @install_dir ||= ::File.join(prefix_dir, 'share', release_basename)
+ @home_dir ||= ::File.join(prefix_dir, 'share', name)
+ @release_file ||= ::File.join(prefix_dir, 'src', ::File.basename(release_url))
@expand_cmd ||=
case release_ext
when 'tar.gz' then 'tar xzf'
@@ -175,7 +175,7 @@ Side question: what are the tradeoffs to consider to choose between the same $$
* `[:cassandra][:request_scheduler]` - (default: "org.apache.cassandra.scheduler.NoScheduler")
* `[:cassandra][:throttle_limit]` - (default: "80")
* `[:cassandra][:request_scheduler_id]` - (default: "keyspace")
-* `[:cassandra][:install_url]` - (default: "http://www.eng.lsu.edu/mirrors/apache/cassandra/0.7.7/apache-cassandra-0.7.7-bin.tar.gz")
+* `[:cassandra][:release_url]` - (default: "http://www.eng.lsu.edu/mirrors/apache/cassandra/0.7.7/apache-cassandra-0.7.7-bin.tar.gz")
* `[:cassandra][:git_repo]` - (default: "git://git.apache.org/cassandra.git")
* `[:cassandra][:git_revision]` - (default: "cdd239dcf82ab52cb840e070fc01135efb512799")
* `[:cassandra][:jna_deb_amd64_url]` - (default: "http://debian.riptano.com/maverick/pool/libjna-java_3.2.7-0~nmu.2_amd64.deb")
@@ -57,7 +57,7 @@
# install_from_release: version
cassversion = "0.7.7"
# install_from_release: tarball url
-default[:cassandra][:install_url] = "http://www.eng.lsu.edu/mirrors/apache/cassandra/#{cassversion}/apache-cassandra-#{cassversion}-bin.tar.gz"
+default[:cassandra][:release_url] = "http://www.eng.lsu.edu/mirrors/apache/cassandra/#{cassversion}/apache-cassandra-#{cassversion}-bin.tar.gz"
# For install_from_git
default[:cassandra][:git_repo] = 'git://git.apache.org/cassandra.git'
# until ruby gem is updated, use cdd239dcf82ab52cb840e070fc01135efb512799
@@ -27,12 +27,12 @@
recursive true
end
-cassandra_install_pkg = File.basename(node[:cassandra][:install_url])
+cassandra_install_pkg = File.basename(node[:cassandra][:release_url])
cassandra_install_dir = cassandra_install_pkg.gsub(%r{(?:-bin)?\.tar\.gz}, '')
# Chef::Log.info [cassandra_install_pkg, cassandra_install_dir].inspect
remote_file "/usr/local/src/"+cassandra_install_pkg do
- source node[:cassandra][:install_url]
+ source node[:cassandra][:release_url]
mode "0644"
action :create
end
@@ -1,5 +1,5 @@
default[:elasticsearch][:version] = "0.13.1"
-default[:elasticsearch][:checksum] = nil
+default[:elasticsearch][:release_url_checksum] = nil
default[:elasticsearch][:cluster_name] = "default"
@@ -27,7 +27,7 @@
remote_file "/tmp/elasticsearch-#{node[:elasticsearch][:version]}.zip" do
source "https://github.com/downloads/elasticsearch/elasticsearch/elasticsearch-#{node[:elasticsearch][:version]}.zip"
mode "0644"
- # checksum node[:elasticsearch][:checksum]
+ # checksum node[:elasticsearch][:release_url_checksum]
end
# install into eg. /usr/local/share/elasticsearch-0.x.x ...
@@ -0,0 +1,3 @@
+default[:ganglia][:home_dir] = '/var/lib/ganglia'
+default[:ganglia][:log_dir] = '/var/log/ganglia'
+default[:ganglia][:conf_dir] = '/etc/ganglia'
@@ -22,24 +22,24 @@
package "ganglia-monitor"
service "ganglia-monitor" do
- enabled true
- running true
- pattern "gmond"
+ enabled true
+ running true
+ pattern "gmond"
end
-template "/etc/ganglia/gmond.conf" do
- source "gmond.conf.erb"
- backup false
- owner "ganglia"
- group "ganglia"
- mode 0644
+template "#{node[:ganglia][:conf_dir]}/gmond.conf" do
+ source "gmond.conf.erb"
+ backup false
+ owner "ganglia"
+ group "ganglia"
+ mode "0644"
+ send_addr = provider_private_ip("#{node[:cluster_name]}-gmetad") || "localhost"
variables(
- :cluster => {
- :name => node[:cluster_name],
- :send_host => provider_private_ip("#{node[:cluster_name]}-gmetad") || "localhost",
- :send_port => 8649,
- :receive_port => 8649,
- })
+ :cluster => {
+ :name => node[:cluster_name],
+ :send_addr => send_addr,
+ :send_port => 8649,
+ :receive_port => 8649,
+ })
notifies :restart, resources(:service => "ganglia-monitor")
end
-
@@ -29,19 +29,17 @@
cluster_nodes = { node['cluster_name'] => [ node['ip-address'] ] }
-template "/etc/ganglia/gmetad.conf" do
- source "gmetad.conf.erb"
- backup false
- owner "ganglia"
- group "ganglia"
- mode 0644
+template "#{node[:ganglia][:conf_dir]}/gmetad.conf" do
+ source "gmetad.conf.erb"
+ backup false
+ owner "ganglia"
+ group "ganglia"
+ mode "0644"
variables(:cluster_nodes => cluster_nodes, :clusters => [ node['cluster_name'] ])
notifies :restart, resources(:service => "gmetad")
end
-directory "/var/lib/ganglia/rrds" do
- owner "ganglia"
- group "ganglia"
+directory "#{node[:ganglia][:home_dir]}/rrds" do
+ owner "ganglia"
+ group "ganglia"
end
-
-
@@ -28,24 +28,22 @@
cluster_nodes = {}
search(:node, '*:*') do |node|
- next unless node['ganglia'] && node['ganglia']['cluster_name']
+ next unless node['ganglia']['cluster_name']
cluster_nodes[node['ganglia']['cluster_name']] ||= []
cluster_nodes[node['ganglia']['cluster_name']] << node['fqdn'].split('.').first
end
-template "/etc/ganglia/gmetad.conf" do
- source "gmetad.conf.erb"
- backup false
- owner "ganglia"
- group "ganglia"
- mode 0644
+template "#{node[:ganglia][:conf_dir]}/gmetad.conf" do
+ source "gmetad.conf.erb"
+ backup false
+ owner "ganglia"
+ group "ganglia"
+ mode "0644"
variables(:cluster_nodes => cluster_nodes, :clusters => search(:ganglia_clusters, "*:*"))
notifies :restart, resources(:service => "gmetad")
end
-directory "/var/lib/ganglia/rrds" do
- owner "ganglia"
- group "ganglia"
+directory "#{node[:ganglia][:home_dir]}/rrds" do
+ owner "ganglia"
+ group "ganglia"
end
-
-
@@ -111,7 +111,7 @@ data_source "<%= cluster %>" <%= @cluster_nodes[cluster] %>
#
#-------------------------------------------------------------------------------
# Where gmetad stores its round-robin databases
-# default: "/var/lib/ganglia/rrds"
+# default: "#{node[:ganglia][:home_dir]}/rrds"
# rrd_rootdir "/some/other/place"
#
#-------------------------------------------------------------------------------
Oops, something went wrong.

0 comments on commit d3ea9e8

Please sign in to comment.