Getting started on

Nigel Duke 25 April 2011 0

VMWare launched Cloud Foundry recently which marked their entry into the Platform-as-a-Service (PaaS) arena.

There are two main paths for deploying on For Java and Spring-based deployments, there’s an Eclipse plug-in but for this article we’re going to attempt a deployment using the Cloud Foundry command line tool.

After a brief wait, Cloud Foundry approved a request for a account and sent a link to a “Getting Started Guide” together with a temporary password.

Rather than follow a distributed source code manager (DSCM) deployment method using Git or Bazaar, such as that employed by Heroku or cloudControl, Cloud Foundry appears to take a proprietary approach for deployment.

First, Ruby and the Ruby Gems package manager is a pre-requisite, then the “vmc” gem is installed. Following the guide and taking defaults at every option, everything appeared to be going swimmingly until the final hurdle “Starting Application: …” which seemed to take an inordinate amount of time and then bombed, thus:

$ sudo gem install vmc
Fetching: json_pure-1.5.1.gem (100%)
Fetching: rubyzip2-2.0.1.gem (100%)
Fetching: highline-1.6.1.gem (100%)
Fetching: terminal-table-1.4.2.gem (100%)
Fetching: vmc-0.3.10.gem (100%)
Successfully installed json_pure-1.5.1
Successfully installed rubyzip2-2.0.1
Successfully installed highline-1.6.1
Successfully installed terminal-table-1.4.2
Successfully installed vmc-0.3.10
5 gems installed
Installing ri documentation for json_pure-1.5.1...
Installing ri documentation for rubyzip2-2.0.1...
Installing ri documentation for highline-1.6.1...
Installing ri documentation for terminal-table-1.4.2...
Installing ri documentation for vmc-0.3.10...
Installing RDoc documentation for json_pure-1.5.1...
Installing RDoc documentation for rubyzip2-2.0.1...
Installing RDoc documentation for highline-1.6.1...
Installing RDoc documentation for terminal-table-1.4.2...
Installing RDoc documentation for vmc-0.3.10...
$ vmc target
Succesfully targeted to []

$ vmc login
Email: ***@***.com
Password: ********
Successfully logged into []

$ mkdir cloudfoundry
$ cd cloudfoundry/
$ mate hello.rb
$ vmc push
Would you like to deploy from the current directory? [Yn]: Y
Application Name: oioioi
Application Deployed URL: ''?
Detected a Sinatra Application, is this correct? [Yn]: Y
Memory Reservation [Default:128M] (64M, 128M, 256M, 512M, 1G or 2G)
Creating Application: OK
Would you like to bind any services to 'oioioi'? [yN]:
Uploading Application:
Checking for available resources: OK
Packing application: OK
Uploading (0K): OK
Push Status: OK
Staging Application: OK
Starting Application: ..........................Error 306: Error retrieving file 'logs/startup.log'


The error was mine; it would have helped if I had used correct Sinatra syntax. Handily the next section of the guide describes how to update an application and, after correction, the deployment works fine, indeed it’s very quick to deploy:

$ vmc update oioioi
Uploading Application:
Checking for available resources: OK
Packing application: OK
Uploading (0K): OK
Push Status: OK
Stopping Application: OK
Staging Application: OK
Starting Application: OK

All vmc commands can be obtained thus:

$ vmc -h

which led me to examining the log files:

$ vmc logs oioioi
====> logs/stderr.log <==== - - [24/Apr/2011 08:10:47] "GET / HTTP/1.0" 200 35 0.0007 - - [24/Apr/2011 08:10:47] "GET /favicon.ico HTTP/1.0" 404 18 0.0003 - - [24/Apr/2011 08:10:48] "GET /favicon.ico HTTP/1.0" 404 18 0.0004 ====> logs/stdout.log <==== == Sinatra/1.2.1 has taken the stage on 16657 for production with backup from Thin >> Thin web server (v1.2.11 codename Bat-Shit Crazy)
>> Maximum connections set to 1024
>> Listening on, CTRL+C to stop



As long as Ruby and Ruby Gems are already installed on your machine (not always easy with Windows), then Cloud Foundry is very quick to get a simple application launched without having to go through the hassle of installing a specific source code manager.

Nigel Duke (30 Posts)

Comments are closed.