Stylized Alex Ward logo

Techlahoma Chat Bot take 2

by cthos
About 1 min


So it has been a while since I first talked about creating amandaharlin_v2, and I figured it was time for an update.I originally spun up _v2 on Digital Ocean (which is what is hosting this blog), and everything worked out pretty well.

However, this left some things to be desired, as I was the only one in control of the server, and since I wasn't using any kind of node process manager. If irc would disconnect for extended periods of time, or the node process would die for any reason, I'd have to manually go restart the bot. Additionally, there wasn't an easy way to give access to the administrators of #techlahoma.

This is why I receently moved amandaharlin_v2 over to Heroku. The instructions for this are actually very well documented, and the process is not all that difficult.

The very first thing that you need to do is create the heroku app, which can be done with the heroku command line:

cd techlahoma-bot
heroku create

This automatically adds the heroku git repo url to the git repository within which the command was run.

After that, it's just a matter of using heroku:set to create the appropriate environment variables:

heroku config:set HUBOT_IRC_NICK="amandaharlin_v2"
heroku config:set HUBOT_IRC_ROOMS="#techlahoma"
heroku config:set HUBOT_IRC_SERVER="irc.freenode.net"
heroku config:set HEROKU_URL=http://amandaharlin_v2.herokuapp.com/

That last one is used to ensure the application pings itself at the appropriate interval to ensure that it doesn't timeout when inactive.

Finally, the only last thing you need to do when pushing the bot is to update the Procfile in order to actually start the app:

web: bin/hubot -a irc -n amandaharlin_v2

After that, we're done! Huzzah.

The added bonus here is that I can also grant access to the various #techlahoma leadership to adminster the app directly instead of having to create ssh accounts for them.