There are 0 comments in this discussion.
Topic: Work Tools Revamp - Hubot for IRC logging
How to set up Hubot for IRC channels with a web accessible log viewer
This took a bit to find all the parts for, but in the end it was pretty simple.
For a remote worker on an open soruce project like myself, IRC is really handy for keeping in touch with other team members.
However as someone on the other side world and in a very different time zone as the other team members, having an IRC without a log to refer back to was a real pain. Obviously I needed a bot to log the channel.
On a previous project that used Campfire, I got to know Hubot. I knew that Hubot was very extendable and had an IRC adapter so I figured I would jump on the Hubot bandwagon.
Here's what I did:
- installed Node.js and Redis that Hubot depends on
cloned hubot irc runnable to a directory named after my new bot
git clone https://github.com/jgable/hubot-irc-runnable.git mynewbot
edited mynewbot's package.json do add hubot-logger as a dependency
- installed mynewbot's dependencies with
edited the necessary environmental variables in runbot.sh:
# Set Environment Variables
export IRCLOGS_PORT=3000 #or whatever port you want your node express app to listen on for serving archives of logs
added a new external-scripts.json that looks like this:
- edited hubot-scripts.json to drop "tweet.coffee" (was causing errors on start for me) and add other scripts from hubot-scripts that I wanted
Now your bot should log into your channels and start logging. Without further set up, your IRC logs would be available on localhost:3000 from your browser.
Optional steps that you will probably need
I want to have my logs be publicly available, so I went ahead and set up a new Digital Ocean host with all of the above set up plus the following:
- set up DNS to point at my new host as a subdomain of an existing registered domain, in my case this was an A record that pointed at the IP address Digital Ocean gave me
- set up my new host to forward requests for port 80 to port 3000 since I didn't want to run node as a priviledged user (you have to be root to listen on port 80 otherwise) as per this stackoverflow answer
- ran the ./runbot.sh command from with a screen session so I log out and leave it running
- add something that will restart ./runbot.sh if it dies, I did the following:
This uses an UpStart init script to respawn the process if it dies (and start it at boot, etc.). Place the file under /etc/init/mybot.conf (rename mybot.conf to whatever you named your bot's directory) and edit to suit. I based it off the steps found in http://kvz.io/blog/2012/11/20/installing-hubot-on-ubuntu/.
You can check out my working example here: