Tag Archives: sinatra

Facebook application – deploying on the Cloud with Heroku.

Recently, Heroku announced a partnership with Facebook. Heroku is a famous [and my favorite] Platform as a Service for Ruby Apps and recently it launched a new stack that also supports java and python.
Facebook applications were always needed be scale-ready due to the network effect that they rely on. A successful Facebook application can literrally double it’s audience every day while it spreads over the huge user base of facebook.

This fact has developed a trend where facebook applications’ teams look for cloud solutions when deploying even small apps.

Facebook, listening to this trend, launched an automated way to host your app on cloud by integrating. Now when a facebook developer Creates a new app, in the first screen with all the basic options (app name, urls etc) there is a new option called “Cloud Services”

There you can select to host your facebook application on Heroku Cloud Service and see the following screens

Heroku Cloud Services - Integrating Facebook popup

Then you can select the stack (programming language) of your application. Heroku will spawn a process which will automatically build a new initial facebook application in the language specified. The app will have all the basics features, meaning authenticating from facebook, asking and using some basic permissions and rendering a welcome page featuring facebook’s api.

Heroku Cloud Services - Integrating Facebook - Choosing Stack / Language

In my case, I chose ruby and thus heroku started a new Sinatra Application, bundled with all the basic gems

Heroku - Facebook Application - Ruby - Sinatra

source :gemcutter
gem "sinatra"
gem "mogli"
gem "json"
gem "httparty"
gem "thin"


The magic part is that now heroku and facebook have complete the whole process for you and the exact application url that is spawned to start on heroku is added in the specified fields of the app configuration page.

Heroku Cloud Services - Integrating Facebook

To go on and customize your brand new application, just wait for the email from the heroku team that gives you a git repository. You clone, edit and

push heroku master

to deploy your app.