Cloud Foundry Blog

Cloud Foundry Previews New Features at SpringOne 2GX

The Cloud Foundry team has been interacting with hundreds of Spring, Groovy, and Grails developers and architects at SpringOne 2GX.  At the show we previewed and introduced several new technologies on top of our Open Platform as a Service offering and have been getting great feedback.  For those of you that don’t know, SpringOne 2GX is the premier event for Spring, Groovy, and Grails application development and runtime technologies with tons of deep technical content delivered by the top experts in the industry, including some of our very own.

Cloud Foundry presented its own track at SpringOne 2GX this year, and we have been busy showing off some of the latest developments with Cloud Foundry.  Some of these developments include introductions and previews of these exciting new technologies:

  • Spring features: auto-reconfiguration mechanism that allows applications to automatically bind to Cloud Foundry Services without any modifications. The use of the “cloud” namespace and profiles gives applications explicit control over consuming Cloud Foundry Services and requires no modification to run locally. 
  • VCC/”Caldecott” : Allows users to attach to Cloud Foundry Services and control them as if they are running locally.  An example that was demoed was exporting a vFabric Postgres Table and importing it into another vFabric Postgres instance.
  • Java Remote Debugging : Giving Java Developers the ability to debug applications running in a local instance of Cloud Foundry through the Spring STS IDE.  This included setting breakpoint in live code, making changes to variables, and then continuing the application while it was running in their local Cloud Foundry instance.  This is available in the open source repository and can be enabled for local instances of Cloud Foundry (VCAP).
  • Spring Insight : Providing real-time application runtime performance and behavior information for Java Spring applications running on CloudFoundry.com.

Some of the conference attendees really impressed us by showing some really cool applications that were developed and deployed to Micro Cloud Foundry and CloudFoundry.com in just minutes.  In addition to the great technology previews, there has been a lot of excitement around being able to deploy applications on Micro Cloud Foundry and then to CloudFoundy.com with no coding changes.  Combined with the upcoming effort to allow for provisioning of private Cloud Foundry instances behind the firewall, developers are recognizing Cloud Foundry as their de facto PaaS deployment solution.

Facebook Twitter Linkedin Digg Delicious Reddit Stumbleupon Email

Build and Extend Custom SuccessFactors Applications on Cloud Foundry

SuccessFactors has selected Cloud Foundry as the platform to empower its customers to build and extend custom applications around SuccessFactors.  A leading SaaS company that provides business execution capabilities for over 3,500 organizations with around 15 million employees, SuccessFactors chose Cloud Foundry for the flexibility and choice it provides their customers in development frameworks, applications services and clouds for deployment.

The need to customize, extend and integrate enterprise applications is a common one.  Doing this for SaaS applications brings particular challenges, as those applications run remotely and historically have been limited in terms of programmability.  By bringing together Cloud Foundry’s robust runtime capabilities with SuccessFactor’ business processes and data, developers get the best of both worlds.

SuccessFactors has deployed a simple sample application (http://sfsf.cloudfoundry.com) that gives a sense of what is possible. The application integrates SuccessFactors’ employee location data with Google Maps to calculate the impact of a facilities move.  If you are a SuccessFactors customer or partner, you can use the SFAPI to do your own integration.  Over time, you can expect the two companies to deepen the integration and in particular make it even easier for enterprises to extend SuccessFactors from both public and private clouds.  To find out more about this partnership, please visit http://www.successfactors.com/info/en/vmware-cloud-foundry.

Facebook Twitter Linkedin Digg Delicious Reddit Stumbleupon Email

Micro Cloud Foundry™ — Now With PostgreSQL and RabbitMQ

We just released an update for Micro Cloud Foundry with PostgreSQL and RabbitMQ.  Micro Cloud Foundry is a complete version of Cloud Foundry that runs in a virtual machine on a developer’s Mac or PC. Today, vFabric Postgres, a version of PostgresSQL database optimized for the virtualized cloud environment, and RabbitMQ, a reliable, scalable and portable messaging system, are both available with Micro Cloud Foundry.

Developers can now quickly develop and test applications with RabbitMQ as its messaging solution and/or PostgresSQL as its data store solution, on their local machine before deploying and scaling to the cloud.

vFabric Postgres and RabbitMQ are available as part of a new update for Micro Cloud Foundry, available for download today at http://micro.cloudfoundry.com

In the following blog post, we will walk through two simple examples of how to run a Java Spring application using Postgres and a Spring AMQP calculation demo using RabbitMQ on your Micro Cloud Foundry.

First, you will need a CloudFoundry.com account, if you don’t have one yet, please signup here.

Next, you will need to download the new update for Micro Cloud Foundry (version “1.1”)

Login to Micro Cloud Foundry (using your CloudFoundry.com credentials) and download the new “micro-1.1.0” VM.

You will also need to create/ regenerate your domain token.

Please note that you cannot upgrade from the previous version of Micro Cloud Foundry to the new one. For more information on getting started with Micro Cloud Foundry, please read the following blog post.

 

Postgres and Micro Cloud Foundry

Postgres on Micro Cloud Foundry enables developers to build, test and deploy applications on their laptop while leveraging a robust and reliable PostgreSQL relational database. As Micro Cloud Foundry and CloudFoundry.com both include the vFabric Postgres service, the same application can be deployed on CloudFoundry.com without any code changes while leveraging increased database capacity.

Once you have the updated Micro Cloud Foundry installed, you can check the status of Postgres using option 7 in the menu.


Steps to create a Java Spring App using Postgres

Now lets look at steps to create and run a Guestbook application on Micro Cloud Foundry, then deploy to Cloud Foundry. For detailed instructions and code for writing the Spring app (steps 1-8), please see the support article

1. Create a Maven Web Project

2. Add dependency on the Spring framework and automatically download all required java package from Maven repository using pom.xml

3. Define entity class to store objects in a database using JPA

4. Configure JPA by setting a META-INF/persistence.xml file

5. Define a Spring DAO Component: Operations on the database will be performed by an instance of a Data Access Object (DAO) that we will define in this step as a Spring MVC

6. Add a Spring Controller Class to manage guestbook web requests

7. Add a JSP page

8. Integrate the Spring Framework into the web application by adding the definition of the Spring dispatcher servlet to the web.xml configuration file and configuring that servlet using another xml configuration file.

The settings above guides Spring to support annotations (for components, controllers and transactions), to inject a JPA EntityManager, to manage transactions and to look for JSP pages in the WEB-INF directory.

9. Build the project and deploy to Micro Cloud Foundry

Open a command prompt (Windows) or terminal (Linux) and “cd” to the location of the Guest project in the Eclipse workspace. Type command “mvn package” to generate war file Guestbook.war

$mvn package

[...]

[INFO] ---------------------------

[INFO] BUILD SUCCESSFUL

[INFO] ---------------------------

[INFO] Total time: 3 seconds

[INFO] Finished at: Mon Aug 08 23:59:32 GMT-08:00 2011

[INFO] Final Memory: 31M/428M

[INFO] ---------------------------

Now we are ready to push the application to Micro Cloud Foundry. Change to the target directory before doing vmc push. Here, we will call the application “‘guestbook”

$vmc push

Would you like to deploy from the current directory? [Yn]: y

Application Name: guestbook

Application Deployed URL: 'guestbook.yourcloud.cloudfoundry.me'?

Detected a Java SpringSource Spring Application, is this correct? [Yn]: y

Memory Reservation [Default:512M] (64M, 128M, 256M or 512M)

Creating Application: OK

Would you like to bind any services to 'guestbook'? [yN]: y

Would you like to use an existing provisioned service [yN]? n

The following system services are available::

1. mongodb

2. mysql

3. postgresql

4. redis

Please select one you wish to provision: 3

Specify the name of the service [postgresql-9a305]: guestbook

Creating Service: OK

Binding Service: OK

Uploading Application:

  Checking for available resources: OK

  Processing resources: OK

  Packing application: OK

  Uploading (9M): OK

Push Status: OK

Staging Application: OK

Starting Application: OK

Now your application is running inside the Micro Cloud Foundry! Use “vmc services”, “vmc apps” commands to retrieve service and application information.

Go to  http://guestbook.yourcloud.cloudfoundry.me and see the web page:

Type anything you want and click on “Add’, what you just type will appear in the page, stored in your local PostgreSQL database.

Deploy to CloudFoundry.com with zero change

Now it’s time to deploy this application to CloudFoundry.com public PaaS service and see how the application works without any change in code and configuration!

First, use vmc target command to point to Cloud Foundry:

$vmc target api.cloudfoundry.com

Successfully targeted to [ http://api.cloudfoundry.com]

$vmc login

Email: [Your Cloud Foundry email]

Password: [Your Cloud Foundry password]

Successfully logged into [ http://api.cloudfoundry.com]

Use the same vmc push command used above to deploy the application:

$vmc push

Would you like to deploy from the current directory? [Yn]: y

Application Name: guestbook-mycloud

Application Deployed URL: 'guestbook-mycloud.cloudfoundry.com'?

Detected a Java SpringSource Spring Application, is this correct? [Yn]: y

Memory Reservation [Default:512M] (64M, 128M, 256M or 512M)

Creating Application: OK

Would you like to bind any services to 'guestbook-postgresql'? [yN]: y

Would you like to use an existing provisioned service [yN]? n

The following system services are available::

1. mongodb

2. mysql

3. postgresql

4. rabbitmq

5. redis

Please select one you wish to provision: 3

Specify the name of the service [postgresql-a9x55]: guestbook

Creating Service: OK

Binding Service: OK

Uploading Application:

  Checking for available resources: OK

  Processing resources: OK

  Packing application: OK

  Uploading (9M): OK

Push Status: OK

Staging Application: OK 

Starting Application: OK

The application behaves exactly the same as in Micro Cloud Foundry, and stores input data into the Postgres database instance running on CloudFoundry.com.

To learn more on Postgres and Cloud Foundry, please read the following blog post, tutorials and FAQ.

RabbitMQ and Micro Cloud Foundry

RabbitMQ on Micro Cloud Foundry enables developers to build, test and deploy applications on their laptop while leveraging a reliable, scalable and portable RabbitMQ messaging system, without the need to set up Rabbit locally.

As Micro Cloud Foundry and CloudFoundry.com both include RabbitMQ, the same application can be scaled up on CloudFoundry.com without any code changes: just use the vmc command line to add workers.

See above for how to download and configure Micro Cloud Foundry 1.1. Once you have done that, if you press 7 in the Micro Cloud Foundry console, to get the service status, you will see the RabbitMQ services listed.


The Spring AMQP Π Calculation Demo for CloudFoundry sample works out of the box on your local machine: it is an adaptation of Jonas Boner’s excellent Akka Getting Started Tutorial that calculates the value of Π but using RabbitMQ worker queues instead of Actors.

It relies on the Leibniz formula for Π, which has the advantage of lending itself to easy parallelization:

In the sample, you use a picalc-master application that creates n tasks in Rabbit, and p instances of the picalc-worker application that pull the calculations tasks from a Rabbit queue and push results there, to be accumulated by the master.

This is what it looks like on a recent MacBook Pro with n=5000 and p=3.


Simply follow the instructions in the README, targeting vmc and your browser to yourcloud.cloudfoundry.com, if you are using DynDNS, or vcap.me if you have configured Micro Cloud Foundry to work offline.

One aspect that is different when working locally vs in the cloud is that the local VM has a limited amount of RAM, so the number of worker instances you can launch locally is limited. You may want to try out the sample with 2 or 3 workers instead of 4, because currently Micro Cloud Foundry does not use more than 1Gb RAM, even if you configure the VM with more capacity.


With the new release of Micro Cloud Foundry, you can try out your Cloud Foundry applications on your laptop, without having to install your Postgres or RabbitMQ Cloud Foundry services.

If you have any questions or problems, please contact us at http://support.cloudfoundry.com

- The Cloud Foundry Team

Don’t have a Cloud Foundry account yet? Signup for free today

Facebook Twitter Linkedin Digg Delicious Reddit Stumbleupon Email