Stuff and Code


Jack of all trades, Master of some. This is a place to write down thoughts about projects I work on.


Heroku and the AO-Killbot

–Deploying an App on Heroku–

It’s no secret that I like to play computer games. In fact I’m somewhat of a wizard at them… or at least I’m a wizard in some of them, I’m not actually that good. In any case, my gaming group is currently playing a game called Albion Online in which mercilessly pking your opponents is a large part of the activities. Albion’s developer Sandbox Interactive provides an API with which someone can get all sorts of statistics about who killed who. I thought it would be a cool idea to create a Discord Bot to display said information in my group’s discord channel. After a little information gathering I found out such an App already existed and was open source. Not wanting to reinvent the wheel, I forked the Killbot, made some modifications so that it would better fit our group’s needs, and then began searching for somewhere to host it.

I’ve used various free services like NOW to deploy simple Apps with varying amounts of success. The problem is all the free ones aren’t really free if you want them running 247. They all have various amounts of downtime, or rather they have a restricted amount of time per day they are up, running, and ready to serve requests. While something like NOW worked OK to try out a quick Node.js App I wanted something that would run 247. A year or two ago a classmate had suggested Heroku was a good option to quickly get something up and running. Into Heroku I dove. To my initial dismay Heroku had the same issue of not being really free if you wanted 247 server uptime. However, what eventually pulled me into ponying up the few dollars a month to have a 247 is just how EASY it is to use.

I had my Node.js powered Killbot App customized and ready to go. It ran on local fine. Check. Now to try to figure out how to get it deployed on a new platform – usually a tough task initially. Check. Wait, what? Yeah, it took but a few minutes to get my app up and running on Heroku. Several options are offered for how one would like to deploy their app:

Heroku Deploy

My code was already on GitHub so I just gave the link to my repo and hit deploy. I watched as the server log output showed that the command to start a Node.js app was set to the default node app.js (which required a quick change since the Killbot was set up to start a different way) and then not but a minute later the designated Discord channel began to light-up with the bot’s activity.

One of my favorite features is the ability to inject config variables. No need to have a ‘secret_settings’ type file. It can all be set from the Heroku dashboard. It varries from language to language, but for Node.js one can use process.env.myVariableNameHere in the code to grab that value. Super easy! Anyway, this post turned more into an endorsement of Heroku than talking about the code, but that’s OK sometimes. In my short time as a professional developer (34 of a year) I’ve discovered that the process of code management, deployment, etc. is half the battle. If only it were as easy as Heroku at work!