Discuss This Topic
There are 0 comments in this discussion.
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:
cloned hubot irc runnable to a directory named after my new bot
git clone https://github.com/jgable/hubot-irc-runnable.git mynewbot
cd mynewbot
edited mynewbot's package.json do add hubot-logger as a dependency
...
"dependencies": {
...
"hubot-logger": "~0.0.11"
}...
npm install
edited the necessary environmental variables in runbot.sh:
# Set Environment Variables
export HUBOT_IRC_NICK=mynewbot
export HUBOT_IRC_SERVER=irc.freenode.net
export HUBOT_IRC_ROOMS="#channel1,#channel2"
export IRCLOGS_PORT=3000 #or whatever port you want your node express app to listen on for serving archives of logs
export IRCLOGS_FOLDER="/path/to/where/i/want/logs"
added a new external-scripts.json that looks like this:
["hubot-logger"]
./runbot.sh
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.
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:
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:
http://irc.waltermcginnis.com/irclogs/