Back to Home

Redmine Configuring jabber alerts in 5 minutes

redmine · jabber · notifications · alerts

Redmine Configuring jabber alerts in 5 minutes

    Redmine is a great project management and bug tracking system. However (from my personal experience of use), she is not able to build a self-organizing error control system in a working team. Developers are too busy to keep track of all comments related to their tasks; on the other hand, the author who created this or that task rarely looks into it in the same way. In cases where the task is set incorrectly or needs to be clarified, the dialogue between the performer and the author may be delayed, because the discussion is sluggish. Because of this, the tracker list turns into a dump of irrelevant tasks. It is becoming easier to resolve the issue directly without resorting to Redmine. The effectiveness of such a system is low.

    It is worth saying that I am interested in the self-organizing system. Surely, you can hire some specialist who will kick the developers so that they look into the tracker more often, ring up users, etc. But in realities of small companies this is a luxury. Therefore, as it seems to me, this problem needs to be solved through a certain notification mechanism.

    Immediately the problem can be solved like this:
    • Redmine can send email alerts. In principle, what is needed, but has a number of drawbacks: firstly, no one will check mail every five minutes; secondly, this notification function can be disabled by the user; in the absence of corporate mail, such notification letters rush to the spam section.
    • Extension for IDE, for example mylyn for Eclipse. Unfortunately, it solves the problem from only one end: ordinary users do not have any IDEs. But for developers it provides the broadest possibilities for working with Redmine straight from the IDE. This is probably even the best option (for developers) if the company is able to deploy a workstation with a pre-installed IDE and a customized extension.
    • Alerts via jabber or icq.

    For Redmine there is an interesting orangutan jabber bot . This is an ambitious project, the purpose of which is to organize work with Redmine through the jabber protocol. In an ideal world, you can: close, create, and comment on tasks simply by sending message commands in human language. But it is in an ideal world. But in real life there are difficulties in setting up, the commands are fixed, there is no question of a human language. In addition, for the bot to work on Redmine, you need to roll up a plugin written for some shaggy version. And the most important minus: only English support.

    Unfortunately, I did not find other options for organizing jabber alerts for Redmine. I had to create my own notification service.

    Alert service "send2me"


    As I wrote earlier, Redmine can send out email alerts about changes in tasks. Using this opportunity, you can send jabber notifications by directly sending mail messages to the list of jabber addresses. Based on this idea, send2me.org appeared .

    After registration, each user receives a personal mail box, for example, "[email protected]". Any message received on this electronic mail box is sent to the list of jabber-contacts, according to the created rules. The service provides a simple interface for describing the rules for selecting messages for distribution. Rules are described by conditional jump blocks, regular expressions, and a routing table. These three components allow you to describe an arbitrarily complex rule for sending messages. However, creating a rule for sending alerts from Redmine is a trivial task, thanks to its built-in templates.

    So, let's set up jabber notifications for Redmine:

    1. Register on send2me.org and get a personal mailbox, for example, “[email protected]”.

    2. In Redmine, we create a user who will listen to all notifications, and specify "[email protected]" as his email address. Thus, we ensure that all changes in tasks will be sent to the specified mail.

    3. Now we need to create a Redmine message processing rule. To do this, go to send2me.org as your user and click on the "Add" button in the "Rules" section. In the rule editing form, specify the "Redmine" template. Let's go over the items that need to be changed.








    • In the first block (red “1” in the image) we discard all messages that do not come from Redmine. This is done with a regular expression:
       $ header {'X-Redmine-Host'} = ~ /^yourredminehost.com$/
      Accordingly, instead of " yourredminehost.com " you should enter the host of your Redmine.
    • In the second block, we discard all messages not from our project. The regular expression is used:
      $ header {'X-Redmine-Project'} = ~ / ^ identifier $ /
      where " identifier " is the project identifier in Redmine. This block is optional - if you delete it, then messages from all projects will be received.
    • And finally, in the third block, you need to fill out the correspondence table of Redmine users and their jabber contacts.

    Note: The message headers generated by Redmine are used to identify message recipients.
            ($ header {'X-Redmine-Issue-Author'}, 
              $ header {'X-Redmine-Issue-Assignee'}, 
              split (';', $ header {'X-Redmine-Watchers'}))
    Unfortunately, Redmine does not add task observers to the message header. Therefore, “out of the box” notifications will only come to the authors of tasks and assigned performers. An optional X-Redmine-Watchers header is used to identify observers . For it to work, you need to install a simple plug-in for Redmine (it does not require any migration or any manipulations with the configuration of Redmine).

    This completes the procedure for configuring Redmine jabber alerts. Further for those who are interested, I will describe the architecture of the send2me.org service

    Alert Service Architecture


    The figure shows a schematic diagram of the organization of such a service.



    Any letter received by e-mail is processed as follows:
    • Postfix - receives the received message and forwards it to the named pipe (named pipe). Postfix is ​​configured in such a way that it redirects to the pipe only messages from those users for whom there is an entry in the send2me.org database (i.e. for registered users). The remaining messages are deleted.
    • Rule processor - Extracts a message from a named pipe and applies a set of user rules to it. If the message is not discarded according to the rules, it is prepared for sending to jabber contacts and redirected to the next named pipe.
    • Ejabberd module (bot) - Extracts a message from a named pipe and sends it.

    A separate link is web crud , written in Dancer and designed to create and edit custom rules.

    Attachments of letters by the service are not processed, but are cut out upon receipt using renattach .

    It's hard for me to evaluate the performance of such an architecture: postfix and ejabberd are well-known high-quality products. I believe the narrow link is the parts of the system that I wrote in perl. I think pretty quickly the habraffect will dump my beggarly server (1Ghz & 512MB), but it will be enough for serving really interested users.

    Read Next