Indira, Mother of D(a)emons
Table of Contents
Indira is a library Erlang application intended for running other Erlang applications as daemons. It provides means to parse command line arguments, start application (including its dependencies), do some administrative duties (like load application's parameters, change working directory, write PID file and start networking) and to create a channel to issue commands.
Especially the last one is interesting: since Erlang knows very little about operating system of the host, shutting down the daemon properly becomes difficult. Indira allows to create a command channel, so an initscript can talk to application's internals. But since the command channel is already here, it can easily be extended to support more commands, like getting statistics or managing Erlang cluster.
Indira is more of a framework and an approach to run Erlang code than a pure library. It takes a little more than including some code in application to run under Indira. On the other hand, it doesn't take any code at all to run an application under Indira: one could daemonize an application that knows nothing about Indira at all and even better, it's still easy to create commands channel for such application.
Documentation and examples
API documentation is hosted here: http://dozzie.jarowit.net/api/indira/ It includes examples of Indira configuration, snippets on how to run Indira and so on.
How to download
Canonical repository location is at jarowit.
git clone http://dozzie.jarowit.net/code/erlang-indira.git
There is a supplementary location at GitHub.
git clone https://github.com/dozzie/indira
How to install
Installation process is tested for building RPM/DEB packages. If you want to make mess in your system by omitting package system, you are on your own. The application, however, uses rebar to build its code, so it should be pretty standard as for Erlang.
You need casual package building tools for your distribution, either rpm-build (RPMs) or dpkg-dev with fakeroot (DEBs). For Debian, you'll also need dh-rebar (Debian package for Jessie and my backport for >=Squeeze, including source package).
The process boils down to run rebar compile. *.beam files will be stored in ./ebin directory.
The EDoc documentation can be generated using rebar doc.
- Prepare source RPM (non-root privileges are fine here)
- Build binary RPM (unless you've taken care of building as non-root, you
need to be root here)
rpmbuild --rebuild erlang-indira-*.src.rpm
- Install package with its dependencies (exact path should be printed by previous step); most probably it will be located in /usr/src/redhat/RPMS/noarch/erlang-indira-*.rpm
- Build binary package
dpkg-buildpackage -b -uc
- Install package (../erlang-indira*.deb) with its dependencies