Publish a launchpad event stream on MQTT
Go to file
Matthew Treinish 5ab09429a1 Add config option to set the imap idle timeout
This commit adds a new config option to the imap section, idle-timeout,
which is used to set the timeout duration for the idle call. By default
imaplib2 sets this to 29mins. This if far too long especially on an imap
server that doesn't have imap idle configured properly. What ends up
happening is that all the lp events get bunched together and pushed to
mqtt at once every 29mins. This isn't really useful as an event stream.
So this makes it configurable and decreases the default setting to 1 min
which seems like a much more useful default value, albeit at the cost of
more imap traffic to fetch messages.

Change-Id: I98fc9778f0adc548d28e7bbd8600f05ff4946ba2
2016-09-29 18:51:41 -04:00
doc/source Add doc building infra 2016-08-31 16:26:04 -04:00
lpmqtt Add config option to set the imap idle timeout 2016-09-29 18:51:41 -04:00
.gitignore Initial Commit 2016-08-29 16:09:33 -04:00
.gitreview Add .gitreview file for future gerrit migration 2016-08-31 16:28:40 -04:00
.testr.conf Initial Commit 2016-08-29 16:09:33 -04:00
CONTRIBUTING.rst Initial Commit 2016-08-29 16:09:33 -04:00
LICENSE Initial Commit 2016-08-29 16:09:33 -04:00
README.rst Add config option to set the imap idle timeout 2016-09-29 18:51:41 -04:00
requirements.txt Cleanup requirements file 2016-08-31 16:27:19 -04:00
setup.cfg Fix supported python versions 2016-08-31 16:22:36 -04:00
setup.py Initial Commit 2016-08-29 16:09:33 -04:00
test-requirements.txt Initial Commit 2016-08-29 16:09:33 -04:00
tox.ini Fix supported python versions 2016-08-31 16:22:36 -04:00

README.rst

lpmqtt

lpmqtt, like its name implies, is a tool for publish a launchpad event stream into MQTT. It will publish all the capture events from the lp emails over imap and publish them to MQTT

MQTT Topics

lpmqtt will push launchpad events to topics broken by project and event type. The formula used is:

<base topic>/<project>/<bugs, blueprints, or other event type>/<bug number>

However only the base topic is a guaranteed field. Depending on the emails sent by launchpad some of the other fields may not be present. In those cases the topic will start from the base topic and will use fields moving towards the right until one is missing.

Running lpmqtt

lpmqtt only runs in the foreground and logs all log messages to STDOUT. It takes one argument, the config file (there is no default path) which is required. For example:

% lpmqtt /etc/lpmqtt.conf

will run lpmqtt.

Configuration

There are a few required pieces of information to make lpmqtt work properly. These settings are specified in the config file.

IMAP

To configure lpmqtt to listen to your imap server you need to provide 3 pieces of information in the [imap] section

  • hostname - The hostname for the imap server to connect to
  • username - The username to connect with
  • password - The password to use

There are also a number of optional settings you can use depending on the configuration of the imap server you're connecting to:

  • use_ssl - Set this to True to establish an imaps connection with ssl
  • folder - Specify a mailbox/folder to watch for message from launchpad.

    If one is not specified INBOX will be used

  • delete-old - Set this to True to have lpmqtt delete messages after it

    finishes processing them. By default it will just mark them as read.

  • idle-timeout - The number of seconds to use for the idle timeout

MQTT

Just as with imap there are a few required options for talking to MQTT, which is the other axis of communication in lpmqtt. The options for configuring MQTT communication go in the [mqtt] section. The 2 required options are:

  • hostname - The hostname for the MQTT broker
  • base_topic - The base topic name to use for the gerrit events

There are also a couple optional settings for communicating with mqtt that you can set:

  • port - The port to communicate to the MQTT broker on. By default this

    is set to 1883, the default MQTT port. This only needs to be set if your broker uses a non-default port.

  • keepalive - Used to set the keepalive time for connections to the MQTT

    broker. By default this is set to 60 seconds.

  • username - Used to set the auth username to connect to the MQTT broker

    with.

  • password - Used to set the auth password to connect to the MQTT broker

    with. A username must be set for this option to be used.