Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

Runit support
  • Loading branch information...
commit 1a283163d7e44e03936b24b3114d3a3130e4d0fb 2 parents 5d21908 + 00b06a7
Sean Escriva webframp authored
4 metadata.rb
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"
17 recipes/carbon.rb
View
@@ -33,11 +33,12 @@
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
@@ -45,8 +46,6 @@
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
11 templates/default/carbon-cache.conf.erb
View
@@ -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
6 templates/default/sv-carbon-cache-finish.erb
View
@@ -0,0 +1,6 @@
+#!/bin/sh
+PIDFILE="/opt/graphite/storage/carbon-cache-a.pid"
+
+if [ -e $PIDFILE ]; then
+ rm -v $PIDFILE
+fi
2  templates/default/sv-carbon-cache-log-run.erb
View
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec svlogd -tt ./main
3  templates/default/sv-carbon-cache-run.erb
View
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.