Permalink
Browse files

Merge pull request #2 from heavywater/feature/carbon-cache-runit

Runit support
  • Loading branch information...
2 parents 5d21908 + 00b06a7 commit 1a283163d7e44e03936b24b3114d3a3130e4d0fb @webframp webframp committed Jan 20, 2012
View
@@ -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
@@ -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
@@ -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
@@ -0,0 +1,6 @@
+#!/bin/sh
+PIDFILE="/opt/graphite/storage/carbon-cache-a.pid"
+
+if [ -e $PIDFILE ]; then
+ rm -v $PIDFILE
+fi
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec svlogd -tt ./main
@@ -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 1a28316

Please sign in to comment.