Facebook and Heroku hosting

Update: Full HOWTO instructions here

Creating customised content for Fan Pages has become a big deal for companies, large and small alike. Whether its a competition, a promotion or some sort of gimmick, the use of content to get a user to Like your Fan Page is now standard practice on the Facebook platform.

One of the challenges that many companies, particularly small ones, come up against in this regard, is the issue of hosting, in that content, typically presented on Fan Page tabs, has to be hosted somewhere.

Up until the middle of last year, this wasn’t too big a problem, in that most companies had access to basic hosting by using the same same service that their website was hosted on.

Then, Facebook decided to make it a requirement that all Tab content by hosted on secure links, which meant that if you wanted to host content for a Tab, your hosting service had to be capable of serving content using the https protocol, which meant that you needed a digital certificate installed with your website.

This is something that isn’t needed for the vast majority of websites, so all those companies who had previously hosted their tab content on the same system as their website suddenly found that their hosting service was no longer suitably equipped to meet Facebook’s requirements.

There only option was to go off and pay some tech type to set up a digital certificate for them, which they would then have to renew at regular intervals, paying the tech type each time.

This obviously generated a bit of consternation in the Facebook user community, which finally provoked a response.

Facebook have teamed up with the Cloud Computing provider, Heroku, who offer basic Facebook-ready hosting services, for free, to anyone who wants to host content on a Tab on their Fan Page.

Sounds great, doesn’t it?

Well, all in all, it is, but the only problem is that it isn’t that user friendly.

Yes, when you set up your app on Facebook you have the option to set up Heroku hosting at the same time, but the process of actually publishing your content using that hosting is another matter altogether.

Also, the basic package is very basic. For instance, the database service that the provide will accommodate only 5MB of data. That’s probably fine for most short term promotions or competitions, but not for any sort of permanent app that is going to collect data over a period of time.

If you want more thrust, you’ve got to get your credit card out.

Anyway, its still a welcome development, so lets not be too cynical.

The basic mechanics of using Heroku are thus:

After you select Heroku as your hosting option when setting up your app, you will be guided through the process of setting up a Heroku account on foot of which you will receive an instructional email.

This will show you how to verify your account and give you basic usage instructions.

On Ubuntu, this involves downloading what is called the Heroku Toolbelt, which is a suite of shell tools that allow you to work with your Heroku hosting package.

The Toolbelt for Ubuntu and Linux in general is based on the version control system git, which allows you to update your code and push that code to the hosting server provided by Heroku.

When you create a Facebook application that use Heroku, Heroku automatically creates a sample application in your git repository. You can trial the tools by “cloning” that app to your local environment, updating it and then pushing it out to the hosting platform. This can seem a bit daunting at first, but it becomes pretty straightforward once you follow the tutorials and do it a few times.

Use of the Toolbelt is also based on OpenSSL public/private key encryption, which means one of the first things you have to do is upload a public key to the Heroku system. Heroku presumes that you’ve only ever created one public/private key pair, so if like me you have multiple pairs, you will need to create a .ssh/config file that ensures that Heroku is presented with the correct private key.

Using databases is also a bit of a challenge.

Heroku provides access to a Postgres database instance for each application you create, which is a bit odd, given that 99.9% of Facebook apps are created with MySQL.

Heroku tells you that most of your MySQL code will work with Postgres, but the word most is never very comforting, so if you want access to a genuine MySQL system, you will need to use what Heroku refers to as an “add-on”, such as the add-on for the Cloud MySQL Db service, CloudDB.

To use this, you have to give Heroku your Credit Card number, but the basic Ignite service provided by CloudDB is free to use. Like Heroku, this gives you 5MB data storage.

Cloud DB is based in the Amazon EC2 Cloud Computing Environment in the US, which means that your MySQL instance is going to be at a remove from your hosting environment. This shouldn’t be an issue provided you aren’t transferring large amounts of data in/out of your database.

Once you set up the add-on, you’ll be given the username/password combo for the MySQL server you will be using, plus the hostname and the database name, which means you can login with the MySQL client or phpMyAdmin and manipulate in the normal fashion.

There’s a lot more detail to the use of Heroku that described above, and it isn’t for novices.

However, if you are a Facebook app developer, and you consistently get development requests from clients who don’t have access to digitally-certified hosting services, learning how to use Heroku will be well worth your while.

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>