Running ejabberd in docker using god

by Gregor Uhlenheuer on December 13, 2014

Lately I have been doing some experiments using ejabberd with docker. In order to control the running ejabberd instance inside the container it is good to have some kind of supervising daemon. Possible candidates I tried so far are supervisord and god.


The latter is my preferred choice as it supports very nice process supervisioning using a linux kernel userspace interface (you will need your kernel to be compiled with CONFIG_CONNECTOR for this mechanism to work). That way there is no need to poll the process if it is still running. Moreover god comes with a lot of reasonable default preferences resulting in very simple configuration files. A basic god configuration file might look something like this:


Sadly using ejabberd using god is not as easy as the example shown above. god expects the process to supervise to run in the foreground whereas ejabberd which is usually controlled by the ejabberdctl script starts a background daemon process.

I extracted some of the logic in the ejabberdctl script into a god configuration file that works with god as expected:


Now you just have to add the god configuration to your Dockerfile like this:

This post is tagged with ejabberd, docker, god, container and linux