Cloudbacon Ramblings from someone named "braidn"

Hubot Sightings With Monit

Slack and bots go together like peanut butter and chinese food. They are quite, literally over running the joint. So with an already loud and notification filled app like Slack, what’s one more? Hubot is a somewhat older, coffee script powered happiness engine from the folks at GitHub. Getting one of these guys up and running isn’t really the topic here but, this guide is super easy to follow.

Now that there is a bot up and running, we can’t just check out of the server and have it continue to run. That’s where Monit comes in. Monit is a dead-simple, text based uptime monitoring system. It can search out, at an interval and make sure a specific program is still running. If the PID, or whatever is missing, Monit will use the designated start process to start things back up.

Ok, so how can we stitch Monit and Hubot together? Matt Garrison, a couple years ago put together a gist for just this occasion. A couple of things to make this thing work:

  1. Make sure on the restart and start services to use a user and group that is available to your server.
  2. Name the bot properly
  3. Make sure to use the correct path to the bot
  4. And finally/lastly, call the hubot bin from node_modules, it’s cleaner.

Happy annoying your fellow Slack mates with kittens and Archer quotes. Also, if for some reason Matt removes the above link, here is my forked gist

Update for Oct 11, 2015

Since writing this, we have moved on from Monit to God. God, may require Ruby but, overall it has been a much more stable choice over Monit. Monit seemed to generate new instances of the Slackbot And never cleanup the old pids. This left the users confused when they interacted with the bot because any command would be multiplied by the amount of instances currently running. Not good when you are trying to not spam your team’s Slack channel.

God has been exceptionally reliable and always seems to reap the previous PID before creating another instance.