Skip to content
Browse files

carbon-cache: runit support

  • Loading branch information...
1 parent 5d21908 commit 00b06a7123c50f00dfca69f8445e03ff946039aa @fujin fujin committed Jan 20, 2012
View
4 metadata.rb
@@ -3,8 +3,10 @@
license "Apache 2.0"
description "Installs/Configures graphite"
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
-version "0.1.2"
+version "0.1.3"
depends "python"
depends "apache2"
supports "ubuntu"
+
+depends "runit"
View
17 recipes/carbon.rb
@@ -33,20 +33,19 @@
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]"
+execute "carbon: change graphite storage permissions to www-data" do
+ command "chown -R www-data:www-data /opt/graphite/storage"
+ only_if do
+ f = File.stat("/opt/graphite/storage")
+ f.uid == 0 and f.gid == 0
+ end
end
directory "/opt/graphite/lib/twisted/plugins/" do
owner "www-data"
group "www-data"
end
-service "carbon-cache" do
- provider Chef::Provider::Service::Upstart
- supports :status => true, :restart => true
- action [ :enable, :start ]
+runit_service "carbon-cache" do
+ finish_script true
end
View
11 templates/default/carbon-cache.conf.erb
@@ -1,11 +0,0 @@
-description "Graphite Carbon Cache Daemon"
-
-start on runlevel [2345]
-stop on runlevel [!2345]
-
-expect daemon
-respawn
-
-env PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
-
-exec sudo -u www-data /opt/graphite/bin/carbon-cache.py start
View
6 templates/default/sv-carbon-cache-finish.erb
@@ -0,0 +1,6 @@
+#!/bin/sh
+PIDFILE="/opt/graphite/storage/carbon-cache-a.pid"
+
+if [ -e $PIDFILE ]; then
+ rm -v $PIDFILE
+fi
View
2 templates/default/sv-carbon-cache-log-run.erb
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec svlogd -tt ./main
View
3 templates/default/sv-carbon-cache-run.erb
@@ -0,0 +1,3 @@
+#!/bin/sh
+exec 2>&1
+exec chpst -u www-data:www-data -l /opt/graphite/storage/carbon-cache.lock -- /opt/graphite/bin/carbon-cache.py --debug start

0 comments on commit 00b06a7

Please sign in to comment.
Something went wrong with that request. Please try again.