Tuesday, May 13, 2014

Deploy HelloWorld Ruby Sinatra web application on BlueMix

Today I will  share my step-by-step process to build and deploy a Ruby-based Sinatra application on BlueMix.Sinatra is a free and open source software web application library and domain-specific language written in Ruby. It is an alternative to other Ruby web application frameworks such as Ruby on Rails, Merb, Nitro and Camping. I am a newbie for Ruby,I thought it might take me lots effort to do this,but after trial,it is beyond my expectation,the whole operation is less five minutes.

1.Visit https://ace.ng.bluemix.net/ and setup an IBM account.After login into the BlueMix site, Click the catalog link,you will see below screen.
2.Double Click the Ruby Sinatra,it will popup a dialog for you to create your Ruby Sinatra name and host name. For example I create the app name to HelloWordlRuby,the domain name is also HelloWorld.ng.bluemix.net.After click the "Create" Button,it will automatic create this app into the DashBoard.

3.You can double click the HelloWorldRuby app link http://hellowordlruby.ng.bluemix.net to see the actual result.

4.Actually the web UI show the most variable of the Ruby(version 1.9.3) Sinatra environment info.I want to make some changes  on the UI. Just click on the settings(gear) icon next to your application name and select view guide to download the whole package.

5.Unzip the package to my local machine to c:\sinatra, open the helloWorld.rb and change the content to below screen.
6.Visit this CLI link and download the installer for your OS.Use below command to connect your bluemix
cf api https://api.ng.bluemix.net
Setting api endpint to https://api.ng.bluemix.net... OK
Since the package already shipped with manifest.yml file,so we can directly use cf push command to deploy it.
- host: HelloWordlRuby
  disk: 1024M
  name: HelloWordlRuby
  path: .
  domain: ng.bluemix.net
  instances: 1
  memory: 128M

After  authentication, we can use cf push command  to deploy our application(make sure you execute command under the application fold) to BlueMix again.After successful deployment and re-visit the url you can see the below new UI,


  1. Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging. If anyone wants to become a Front end developer learn from Javascript Online Training from India . or learn thru JavaScript Online Training from India. Nowadays JavaScript has tons of job opportunities on various vertical industry. ES6 Online Training

  2. It is nice blog Thank you provide important information and I am searching for the same information to save my time Ruby on Rails Online Training