Skip to content
Browse files

Install runit and user-specific runit directory

  • Loading branch information...
1 parent 7d4d502 commit 1b6a1540ff5dfc1bec9e26d103004a1a0bbb221a @topfunky topfunky committed Nov 2, 2008
Showing with 74 additions and 2 deletions.
  1. +18 −2 recipes/peepserver.rb
  2. +24 −0 recipes/templates/install-runit-for-user.sh
  3. +32 −0 recipes/templates/install-runit.sh
View
20 recipes/peepserver.rb
@@ -98,6 +98,7 @@ def run_and_return(cmd)
# TODO
# * Uninstall httpd: chkconfig --del httpd
+ runit
git
nginx
memcached
@@ -195,6 +196,20 @@ def run_and_return(cmd)
run cmd
end
+ desc "Install runit"
+ task :runit do
+ %w(install-runit.sh install-runit-for-user.sh).each do |filename|
+ result = File.read(File.dirname(__FILE__) + "/templates/#{filename}")
+ put result, "src/#{filename}", :mode => 0755
+ end
+
+ sudo "src/install-runit.sh"
+ # netcat is used by some scripts
+ sudo "yum install nc -y"
+
+ run "src/install-runit-for-user.sh"
+ end
+
desc "Install memcached"
task :memcached do
# TODO Needs to run ldconfig after libevent is installed
@@ -346,8 +361,9 @@ def run_and_return(cmd)
# TODO Bail unless make 3.81 is installed
cmd = [
"cd src",
- "git clone http://xph.us/src/beanstalkd.git",
- "cd beanstalkd",
+ "wget http://xph.us/software/beanstalkd/rel/beanstalkd-1.0.tar.gz",
+ "tar xfz beanstalkd-1.0.tar.gz",
+ "cd beanstalkd-1.0",
"/usr/local/bin/make",
"sudo cp beanstalkd /usr/local/bin/"
].join(" && ")
View
24 recipes/templates/install-runit-for-user.sh
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+##
+# Install the runit process launcher for a specific user.
+#
+# Should be run that user. Will also call sudo for some commands.
+#
+# Built for CentOS as found at RailsMachine hosting. http://railsmachine.com
+#
+# Author: Geoffrey Grosenbach http://peepcode.com
+# See also: http://www.sanityinc.com/articles/init-scripts-considered-harmful
+# And also: http://smarden.sunsite.dk/runit/install.html
+
+sudo mkdir -p /etc/sv/$USER
+
+mkdir ~/service
+
+cat >/tmp/run <<EOT
+#!/bin/sh
+exec 2>&1
+exec chpst -u $USER /usr/local/bin/runsvdir $HOME/service 'log: ...........................................................................................................................................................................................................................................................................................................................................................................................................'
+EOT
+sudo mv /tmp/run /etc/sv/$USER/run
+sudo chmod +x !$
View
32 recipes/templates/install-runit.sh
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+##
+# Install the runit process launcher.
+#
+# Should be run as the root user.
+#
+# Built for CentOS as found at RailsMachine hosting. http://railsmachine.com
+#
+# Author: Geoffrey Grosenbach http://peepcode.com
+# Original: http://smarden.sunsite.dk/runit/install.html
+# See also: http://www.sanityinc.com/articles/init-scripts-considered-harmful
+
+mkdir /package
+chmod 1755 /package
+cd /package
+wget http://smarden.sunsite.dk/runit/runit-2.0.0.tar.gz
+tar xfz runit-2.0.0.tar.gz
+rm !$
+cd admin/runit-2.0.0
+./package/install
+
+# Install alongside traditional sysvinit and inittab
+install -m0750 /package/admin/runit/etc/2 /sbin/runsvdir-start
+mkdir -p /service
+mkdir -p /etc/sv
+
+cat >>/etc/inittab <<EOT
+SV:123456:respawn:/sbin/runsvdir-start
+EOT
+
+init q

0 comments on commit 1b6a154

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