Wednesday, 17 June 2015

Cloud Foundry with Bluemix

Cloud Foundry is an open source Platform as a Service (PaaS) that lets you quickly create and deploy applications on the cloud.  (For those familiar with JEE, I like to think of it as a next generation application server with built-in multi-tenancy support for different languages and service bindings.)

As Cloud Foundry is open source and does not rely on proprietary software or cloud infrastructure, it is completely possible to set up a Cloud Foundry  client locally to experiment with Bluemix. That’s exactly what we will do later in this posting to get familiar with it.  There is nothing better than learning by doing.

Orgs, Spaces, Roles, and Permissions

Cloud Foundry is designed to support multiple developers in isolated spaces within orgs (organizations) to push applications into.

There is a user role within Cloud Foundry (OrgManager) that allows users to create orgs. When using Bluemix, this role is assigned to Bluemix administrators and, by default, the Bluemix user does not have permissions to create or delete them however the user is the administrator of the org itself, so it is possible to create/delete/modify spaces within it. By default, the name of the org is the user name. It is possible however to rename the org.

Every application and service is scoped to a space. A space provides a set of users access to a shared location for application development, deployment, and maintenance. Each org contains at least one space and it's called "dev", by default, in Bluemix.

Let's examine Bluemix with the Cloud Foundry client.:
  1. Go to and download and install the appropriate release for your platform.
  2. It is now possible to type:

    cf help
    to get a full listing of possible commands and:

    cf <command> -h

    cf help <command>
    to get help on a specific commands.
  3. Run the following command which sets the API endpoint, or target URL, of the Cloud Foundry instance's Cloud Controller URL. The Cloud provider, in this case, Bluemix, typically supplies this.

    > cf api
    Setting api endpoint to
    API endpoint: (API version: 2.23.0)   
    Not logged in. Use 'cf login' to log in. 
  4. As suggested we will now login into Cloud Foundry. The "-u" option is the username.

    > cf login -u <Bluemix username>
    API endpoint:
    Targeted org <Bluemix username>
    Targeted space dev
    API endpoint: (API version: 2.23.0)   
    User:           <Bluemix username>   
    Org:            <Bluemix username>   
    Space:          dev
  5. As mentioned previously, the default organization is the username with a default space called "dev". Let's rename the org to something more meaningful. For example
    > cf rename-org <Bluemix username> "Boris's Cloud Blog"
    Renaming org <Bluemix username> to Boris's Cloud Blog as <Bluemix username>...
If you login to Bluemix you will see that the org has been renamed on the Dashboard.

We'll also create a new space for our work.

  1. Create a new space called "Cloud"
  2. > cf create-space Cloud
    Creating space Cloud in org Boris's Cloud Blog as <Bluemix username>...
    Assigning role SpaceManager to user <Bluemix username> in org Boris's Cloud Blog / space Cloud as <Bluemix username>...
    Assigning role SpaceDeveloper to user <Bluemix username> in org Boris's Cloud Blog / space Cloud as <Bluemix username>...
    TIP: Use 'cf target -o Boris's Cloud Blog -s Cloud' to target new space 
  3. Target the new space, this will now be used for applications
    > cf target -o "Boris's Cloud Blog" -s Cloud
    API endpoint: (API version: 2.23.0)   
    User:           <Bluemix username>   
    Org:            Boris's Cloud Blog   
    Space:          Cloud  s
In Bluemix, this new space is also now available for deploying applications:


Cloud Foundry consist of several components: routing, authentication, application lifecycle storage and execution, messaging (for inter-component communication), metrics, logging and service brokers that provides service instances when developers bind those services to applications. (Services can be provided using a SaaS model).

Developing and Deploying Applications

Applications can be built with different programming languages and technologies, Cloud Foundry has the concept of buildpacks that provide support for them. Let's see what buildpacks are available on IBM Bluemix.

> cf buildpacks

Getting buildpacks...

buildpack                            position enabled locked filename  

liberty-for-java                     1        true    false
sdk-for-nodejs                       2        true    false
noop-buildpack                       3        true    false  
java_buildpack                       4        true    false  
ruby_buildpack                       5        true    false  
nodejs_buildpack                     6        true    false  
go_buildpack                         7        true    false  
python_buildpack                     8        true    false  
php_buildpack                        9        true    false  
aspnet5-experimental                 10       true    false
liberty-for-java_v1-18-20150519-1642 11       true    false
sdk-for-nodejs_v1-18-20150519-1759   12       true    false  
Different buildpacks have different functionalities specific to the development technology support being provided. For example, the Java buildpack support includes support for Java Main,  Servlets, Spring Boot CLI and Play Framework. When "pushing" an app to Cloud Foundry, it will examine the contents to determine which build pack should be used. The buildpack can also be specified on the cf command line when pushing the application, this is how custom/community buildpacks can be used.

In the next blog entry, we'll create an app using the Java buildpack and deploy it to the new "Cloud" space we created.

For More information on these topics visit:


  1. Great Article
    Cloud Computing Projects

    Networking Projects

    Final Year Projects for CSE

    JavaScript Training in Chennai

    JavaScript Training in Chennai

    The Angular Training covers a wide range of topics including Components, Angular Directives, Angular Services, Pipes, security fundamentals, Routing, and Angular programmability. The new Angular TRaining will lay the foundation you need to specialise in Single Page Application developer. Angular Training

  2. Harrah's Las Vegas - JtmHub
    Located on the Strip, Harrah's Las Vegas is adjacent to 충주 출장마사지 LINQ Promenade and within 당진 출장안마 a short walk of 제주도 출장마사지 Gold Strike Casino. 속초 출장샵 Guests staying 김포 출장샵 at this hotel and casino