Glad You're Ready. Let's Get Started!

Let us know how we can contact you.

Thank you!

We'll respond shortly.

  • Blog Navigation
World's Smallest IaaS, Part 4: Hello World

In this blog post we deploy a simple “hello world” app to our Cloud Foundry installation.

[2014-10-19 this blog post has been updated to reflect Cloud Foundry CLI version 6.6.1]


We have already set up Cloud Foundry:

  1. World’s Smallest IaaS, Part 1 describes installing VMware ESXi and VMware vCenter on an Apple Mac Pro
  2. World’s Smallest IaaS, Part 2 describes installing Cloud Foundry’s Ops Manager and deploying BOSH to the ESXi/vCenter
  3. World’s Smallest IaaS, Part 3: the PaaS describes installing Elastic Runtime (i.e. Cloud Foundry)

Install Cloud Foundry CLI

Click here [1] to browse to the Cloud Foundry CLI homepage’s download section. Choose the Mac OS X 64 bit (Stable installer). Double-click the downloaded file to install the CLI.

Test for a successful install by bringing up a terminal and querying the version of the CLI: [2]

cf --version
  cf version 6.6.1-b2cdb2b-2014-09-23T23:07:17+00:00

Let’s point the CLI to our installation:

cf api --skip-ssl-validation

Let’s log in. We’ll use the UAA admin credentials (these credentials can be retrieved from Ops Manager; here is a description of how to retrieve the credentials). We’ll target the “CF Engineering” organization, which we created at the end of Part 3:

cf login -u admin -p a723936f2102e4xxxxxx # Use admin login
  API endpoint:

  Select an org (or press enter to skip):
  1. system
  2. CF Engineering

  Org> 2
  Targeted org CF Engineering

  Targeted space development

  API endpoint: (API version: 2.13.0)
  User:           admin
  Org:            CF Engineering
  Space:          development

Hello World

Let’s create our first app, a simple app, a “hello world” app. Let’s create a directory where we’ll do our work:

mkdir -p ~/workspace/hello-world
cd ~/workspace/hello-world

Create a file, Gemfile, with the following contents (a Gemfile is a file that describes the Ruby libraries (i.e. “gems”) upon which your application depends). The gem we’re using, Sinatra, is a Ruby-based webserver (though its authors may argue that it’s a DSL (domain specific language) for creating web applications in Ruby).

# Gemfile
source ""
gem "sinatra"

Now let’s write a very simple Ruby/Sinatra program, hello.rb:

# hello.rb
require 'sinatra'
get '/' do
  "hello worldn"

Next we create, a file which is a configuration file for Rack-based applications (or, in this case, Sinatra, which is a Rack-based web framework):

require './hello'
run Sinatra::Application

Let’s make sure we’ve installed Bundler (sudo is not necessary if you’re using rvm, rbenv, or chruby) (if unsure, use sudo):

sudo gem install bundler

Now let’s push:

cf push hello-world
  Creating app hello-world in org CF Engineering / space development as admin...

  Creating route

  Binding to hello-world...

  Uploading hello-world...
  Uploading app files from: /Users/cunnie/workspace/hello-world
  Uploading 892, 4 files

  Starting app hello-world in org CF Engineering / space development as admin...
  -----> Downloaded app package (4.0K)
  -----> Compiling Ruby/Rack
  -----> Using Ruby version: ruby-2.0.0
  -----> Installing dependencies using 1.6.3
         Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
         Fetching gem metadata from
         Using bundler 1.6.3
         Installing tilt 1.4.1
         Installing rack 1.5.2
         Installing rack-protection 1.5.3
         Installing sinatra 1.4.5
         Your bundle is complete!
         Gems in the groups development and test were not installed.
         It was installed into ./vendor/bundle
         Bundle completed (4.41s)
         Cleaning up the bundler cache.
  ###### WARNING:
         You have not declared a Ruby version in your Gemfile.
         To set your Ruby version add this line to your Gemfile:
         ruby '2.0.0'
         # See for more information.
  ###### WARNING:
         No Procfile detected, using the default web server (webrick)

  -----> Uploading droplet (13M)

  1 of 1 instances running

  App started

  Showing health and status for app hello-world in org CF Engineering / space development as admin...

  requested state: started
  instances: 1/1
  usage: 1G x 1 instances

       state     since                    cpu    memory        disk
  #0   running   2014-10-19 12:57:21 PM   0.0%   34.4M of 1G   45M of 1G

Now we test: let’s browse to

The output of our "hello world" application. Plain, minimal formatting, but functional

The output of our “hello world” application. Plain, minimal formatting, but functional

We have successfully tested our Cloud Foundry installation by installing our first app, which is merely a hint of things to come.


The ‘hello world’ example was pulled from internal Cloud Foundry documentation.


1 For those of you lucky enough to have Homebrew-cask installed, you can use it to install the Cloud Foundry CLI: brew cask install cloudfoundry-cli.

2 If you see command not found, then /usr/local/bin is unlikely to be in your PATH. A simple workaround is to invoke the CLI by typing /usr/local/bin/cf rather than cf.

Share This