Humbly Report: Sean Bechhofer

Semantics 'n' stuff

Automating the Whale

leave a comment »

Heroku

In my last blog post, I wrote about my chromaticwhale twitterbot, which is merrily posting fictitious Northern Rail updates. The original bot made use of cheapbotsdonequick which, as the name suggests, made setting up a twitter bot cheap (i.e. free) and quick. I was keen to add some flexibility to the system, so wanted something a little more sophisticated.

I’m a cheapskate though, so I still wanted something free. I could probably have quietly set up a cron job on a work machine, but I’m not sure that would have been looked on favourably as it’s perhaps not exactly pushing back the bounds of human knowledge. A quick cast around suggested that heroku.com would provide what I needed. Heroku is a cloud platform for applications. They provide paid-for infrastructure for scalable apps, but if you’re just interested in small scale dicking about experimentation, there’s an entry plan that gives an allowance of free “dyno” hours a month.

Set up involved creating an account and then a heroku application. This sets up a git repository that you can push code to which will then run on the heroku infrastructure. This works nicely as I was already using git to manage the codebase. There’s also extra stuff in there that tells heroku about the requirements of your application. When you push to the remote repository, some magic happens at the heroku end and the application is built and set up.

For my purposes, I just wanted a one-off job run periodically, so I set up a scheduler that kicks off every hour. In order to give the impression of reality, the job doesn’t tweet every time it’s run, but on average once in every N times. This was one of the flexibilities I was keen to incorporate. Again, code on github shows how all this works.

Over December, the bot has used just over 8 hours of time, which is well within the 1,000 free hours allocated.

Disclaimer: I have no connection with Heroku other than being a (happy) user. I’m sure other similar infrastructures are available if you really want to spend some time looking for them. I didn’t.

Advertisements

Written by Sean Bechhofer

December 20, 2016 at 4:59 pm

Posted in Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: