daemontools + mono + dream

daemontools is a wonderful alternative to using inittab or rc.d startup scripts on your favorite Linux and BSD boxes. I really like using it, but Im not here to sell you on it, simply to tell you how you can use it to keep your dream server going. I am going to use the 8-ball example from the mindtouch site for this example. First I like to go to the directory where I keep my dream app.

cd ~/8-ball/bin

This is the directory where my mindtouch.host.exe file is located. Next using my favorite $EDITOR I will


In this file I will add the following:

cd /home/errr/8-ball/bin &&
exec envuidgid www-data /usr/bin/mono mindtouch.host.exe script 8ball.startup.xml \
public-uri http://slice.michaelrice.org:8081/ \
server-name http://slice.michaelrice.org \
ip slice.michaelrice.org:8081

Next save the file & set the script to be executable

chmod +x run

Now I will explain a couple of things here. First off the envuidgid is a command from daemontools so you may need to provide the full path to your file location of this if it is not in your $PATH. Second off is the IP flag. If you use an IP here from my testing then the host will only work when you type that IP. See more about that here: http://forums.developer.mindtouch.com/showthread.php?p=36055
Now you need to be root (or you can use sudo) for this next part. Head to your service directory. If you installed daemontools from source that is typically /service but if you are like me and use Debian/GNU Linux and used apt-get to install it then it will be located in /etc/service Simply change to the directory and symlink:

errr-slice.michaelrice.org | /home/errr | 16:38 |
» sudo -s
[sudo] password for errr:
root-slice.michaelrice.org | /home/errr | 16:38 |
» cd /etc/service
root-slice.michaelrice.org | /etc/service | 16:39 |
» ln -s /home/errr/8-ball/bin 8ball

From here its like any other new service we have ever added. svscan will automatically start the new service within 5 seconds. You can verify that its working with ps, svstat or by just hitting the URL directly. In my case you can see my example here

Tags: , , , , ,

Leave a Reply