Deploy a Framework Friday #1 with Ruby and Sinatra

Alright, just for fun I’m kicking off a new blog series. I’m going to publish a new “Deploy a Framework Friday” each week for about the next, well, bunch of weeks. There are a TON of frameworks that are available on PaaS Technologies.

This first entry I’m going to implement a simple Sinatra app with Ruby. Nothing fancy, simply a hello world and the respective deployment to a Cloud Foundry PaaS.

First, let’s whip out the super complex code (right, this isn’t complex, I just like sarcasm). The hello.rb file I created.

[sourcecode language=”ruby”]
require ‘sinatra’

get ‘/’ do
"Hello World!"
end

get ‘/route’ do
"Hello from a route URI!"
end
[/sourcecode]

Next add a Gemfile & respective Gemfile.lock as such.

Gemfile

[sourcecode language=”ruby”]
source "http://rubygems.org"
gem ‘sinatra’
[/sourcecode]

Gemfile.lock

[sourcecode language=”ruby”]
GEM
remote: http://rubygems.org/
specs:
rack (1.4.1)
rack-protection (1.2.0)
rack
sinatra (1.3.2)
rack (~> 1.3, >= 1.3.6)
rack-protection (~> 1.2)
tilt (~> 1.3, >= 1.3.3)
tilt (1.3.3)

PLATFORMS
ruby

DEPENDENCIES
sinatra
[/sourcecode]

Then deploy using the Cloud Foundry VMC.

[sourcecode language=”bash”]
vmc push
[/sourcecode]

If you’ve forgotten, be sure to target and login first.

[sourcecode language=”bash”]
vmc target api.ironfoundry.me
vmc login
[/sourcecode]

That does it. Yeah, not a whole lot to get started working on a Sinatra Project. For more information on Sinatra check out the main web presence here http://www.sinatrarb.com/.

For more information on Cloud Foundry or Iron Foundry click on the respective link.

For the code sample, check out the working “paasIt” code repo on Github.

Next week I’ll do a baseline ASP.NET MVC 4 Application and get it deployed.