Permalink
Browse files

use upstart to control carbon-cache daemon process

  • Loading branch information...
1 parent 7c33d78 commit 45b7f41f67ee56a7b5dda7efea978bb205944703 @dje dje committed Dec 3, 2011
Showing with 30 additions and 12 deletions.
  1. +30 −12 recipes/carbon.rb
View
@@ -1,34 +1,52 @@
package "python-twisted"
-remote_file "/usr/src/carbon-#{node.graphite.version}.tar.gz" do
- source node.graphite.carbon.uri
- checksum node.graphite.carbon.checksum
+version = node[:graphite][:version]
+
+remote_file "/usr/src/carbon-#{version}.tar.gz" do
+ source node[:graphite][:carbon][:uri]
+ checksum node[:graphite][:carbon][:checksum]
end
execute "untar carbon" do
- command "tar xzf carbon-#{node.graphite.version}.tar.gz"
- creates "/usr/src/carbon-#{node.graphite.version}"
+ command "tar xzf carbon-#{version}.tar.gz"
+ creates "/usr/src/carbon-#{version}"
cwd "/usr/src"
end
execute "install carbon" do
command "python setup.py install"
- creates "/opt/graphite/lib/carbon-#{node.graphite.version}-py2.6.egg-info"
- cwd "/usr/src/carbon-#{node.graphite.version}"
+ creates "/opt/graphite/lib/carbon-#{version}-py2.6.egg-info"
+ cwd "/usr/src/carbon-#{version}"
end
template "/opt/graphite/conf/carbon.conf" do
+ owner "www-data"
+ group "www-data"
variables( :line_receiver_interface => node[:graphite][:carbon][:line_receiver_interface],
:pickle_receiver_interface => node[:graphite][:carbon][:pickle_receiver_interface],
:cache_query_interface => node[:graphite][:carbon][:cache_query_interface] )
notifies :restart, "service[carbon-cache]"
end
-template "/opt/graphite/conf/storage-schemas.conf"
+template "/opt/graphite/conf/storage-schemas.conf" do
+ owner "www-data"
+ group "www-data"
+end
+
+template "/etc/init/carbon-cache.conf" do
+ source "carbon-cache.conf.erb"
+ owner "www-data"
+ group "www-data"
+ notifies :restart, "service[carbon-cache]"
+end
+
+directory "/opt/graphite/lib/twisted/plugins/" do
+ owner "www-data"
+ group "www-data"
+end
service "carbon-cache" do
- running true
- start_command "/opt/graphite/bin/carbon-cache.py start"
- stop_command "/opt/graphite/bin/carbon-cache.py stop"
- action :start
+ provider Chef::Provider::Service::Upstart
+ supports :status => true, :restart => true
+ action [ :enable, :start ]
end

0 comments on commit 45b7f41

Please sign in to comment.