Cloud Foundry Blog

Cloud Foundry Open Tour 2012

Cloud Foundry Open Tour 2012 is a global series of one day developer events designed to help the thriving cloud community to meet and exchange ideas with the technologists behind the industry’s leading open platform as a service. Whether you are building enterprise Java applications, Ruby-based social media sites or mobile back-end systems using Node.js, these special one day events are the fastest way to learn about developing in the cloud. Register now for the city nearest you.

Cloud Foundry Open Tour Map

Beijing, Shanghai & Tokyo

The Cloud Foundry Open Tour begins with special events in Beijing (March 28), Shanghai (March 30) and Tokyo (April 2). The leading engineers behind Cloud Foundry will give a hands on guide for getting started with the platform and the follow-up sessions will teach developers all the details they need to create productive applications in Java, Ruby or Node.js. Essential sessions include

  • Cloud Foundry Technical Overview by Mark Lucovsky
  • Cloud Foundry Bootcamp by Chris Richardson

San Francisco, Portland, Austin & Washington D.C.

There are four great locations for the developer community to learn more about Cloud Foundry: San Francisco (March 30), Portland (April 2), Austin (April 5) and Washington, D.C. (April 9). The North American cities will help developer learn the basics about Cloud Foundry but will also focus on the broad community of contributors to the open source platform.  In select cities, attendees will have access to special sessions by 10gen about MongoDB, AppFog about PHP as well as presentations about cloud application design by prominent community members. Key sessions include:

  • Cloud Foundry Bootcamp by Dave McCrory
  • Using MongoDB for Cloud Foundry Applications by Jared Rosoff (10gen)

Kiev, Moscow & London

In Europe, the Cloud Foundry Open Tour joins forces with the Spring and Grails developer communities to provide multiple tracks that are sure to interest any enterprise developer: Kiev (April 24), Moscow (April 26) and London (May 1). These events are perfect for learning about the latest Spring 3.1 release, recommendations for using noSQL, Grails 2.1 capabilities as well as incredible details about how the Cloud Foundry platform works. Top sessions include:

  • Developing Polyglot Applications on Cloud Foundry by Chris Richardson
  • Spring 3.1 Review and 3.2 Preview by Juergen Hoeller
  • What’s New in Groovy 2.0 by Guillaume Laforge

Register Today

Meet-up with other cutting edge developers, learn from the expert technologists behind Cloud Foundry and expand your opportunities by attending the Cloud Foundry Open Tour.

There is a small registration fee for attending the Cloud Foundry Open Tour, but the current early bird registration provides discounts and space is limited in each city so be sure to save your spot today.

Facebook Twitter Linkedin Digg Delicious Reddit Stumbleupon Email

Micro Cloud Foundry Streamlines Offline Support and Adds Java Debugging

The Cloud Foundry team released a new version of Micro Cloud FoundryTM including streamlined offline support, Java debugging, up-to-date versions of all languages/frameworks and services as supported on CloudFoundry.com and ability to enable/disable application services.

Micro Cloud Foundry is a complete version of Cloud Foundry that runs in a virtual machine on a developer’s computer. Micro Cloud Foundry has established itself as the convenient and portable Cloud Foundry environment from which developers can easily develop and test their applications.

The new version we release today (version 1.2) , immediately available for download at www.cloudfoundry.com improves upon that convenience and portability by making it very simple to configure your Micro Cloud Foundry instance to either run disconnected from or connected to the internet.  The default network setting has been changed to the offline configuration, so that Micro Cloud Foundry can work flawlessly and consistently anywhere you are: home, office, coffee shop, conference, or even on a plane.

Java developers can now debug a Java application running in Micro Cloud Foundry with a Java debugger similarly to how they have always done with locally running applications.  The user can set break points in the source code, suspend and resume running applications, view the application stack and perform code stepping operations.  To enable Java debugging  users can either push an application through the Cloud Foundry command-line (VMC) using the ‘vmc push <my app> -d‘ command option or use the built-in debugger of SpringSource Tool Suite (STS).  An upcoming release of STS will further improve Java and Grails debugging with Micro Cloud Foundry applications to a seamless user experience.

The new release of Micro Cloud Foundry has updated its included runtimes to the versions indicated in the table below.  These runtimes are now up-to-date with the CloudFoundry.com public service.  A notable addition to the runtimes is Node.js 0.6, which is now available as an option:

Name Version
Java 6 1.6
Node.js 0.4.12
Node.js 0.6.8
Ruby 1.8 1.8.7
Ruby 1.9 1.9.2p180

(This information can be retrieved using the ‘vmc runtimes‘ command)

Micro Cloud Foundry services have been updated as well to the following versions :

Name Version
MongoDB 1.8
MySQL 5.1
Postgresql 9.0
RabbitMQ 2.4
Redis 2.2

(This information can be retrieved using the ‘vmc services‘ command)

Since a Micro Cloud Foundry instance by default runs all of the services available in CloudFoundry.com, some of the services may be utilizing precious resources on your machine even if you do not use them.  This can easily be remedied by turning off the services that are unnecessary.  From the main menu of the Micro Cloud Foundry console, select option 8 for services.

From the services menu, you can easily choose to disable a service or re-enable a service that was previously disabled.

To get specific instructions or find out more about these new features for Micro Cloud Foundry, please visit our documentation site at: start.cloudfoundry.com.  Additionally, we will be detailing some of these features and technology behind them in future blog posts.  Micro Cloud Foundry 1.2 is immediately available for download at CloudFoundry.com, so update yours today!

-The Cloud Foundry Team

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

 

Facebook Twitter Linkedin Digg Delicious Reddit Stumbleupon Email

Cloud Foundry Now Supports the Rails Console

Ruby and Rails developers can now remotely access the popular rails console using the Cloud Foundry command line tool (VMC). This new feature enables inspection of the Cloud Foundry Runtime App environment, troubleshooting application issues in runtime, and even the ability to modify data “on the fly” for one-off admin tasks.  Using the new vmc rails-console command, developers can target any Cloud Foundry instance, including the upcoming release of Micro Cloud Foundry.

Getting Started

First, install or update your Cloud Foundry command line tool (‘VMC’) to the latest preview version using the following command:

gem install vmc --pre

You can verify that you got the right version using:

vmc -v

which should show the version to be 0.3.16.beta.3 or higher.

Next, push or update a Rails app using vmc push.

To access the console, run:

vmc rails-console appname

That’s all there is to it!  Read on for a more detailed example…

Using the Rails Console

Let’s get started by deploying a Rails application to Cloud Foundry. We’ll use Enki, an open source blog engine.   I’ll use the cloudfoundry-samples fork, where I’ve added the mysql2 gem to enki’s Gemfile.  Now I’m ready to push to Cloud Foundry:

mycomp:enki$ vmc push mynewblog
Would you like to deploy from the current directory? [Yn]:
Application Deployed URL [mynewblog.cloudfoundry.com]:
Detected a Rails Application, is this correct? [Yn]:
Memory Reservation ("64M", "128M", "256M", "512M", "1G") ["256M"]:
Creating Application: OK
Create services to bind to 'mynewblog'? [yN]: y
1: mongodb
2: mysql
3: postgresql
4: rabbitmq
5: redis
What kind of service?: 2
Specify the name of the service [mysql-8f1d2]:
Creating Application: OK
Creating Service [mysql-8f1d2]: OK
Binding Service [mysql-8f1d2]: OK
Uploading Application:
  Checking for available resources: OK
  Processing resources: OK
  Packing application: OK
  Uploading (20M): OK
Push Status: OK
Staging Application: OK
Starting Application: OK

Looks like the app deployed successfully.  I saved the manifest generated from this vmc output, so you can do just a simple “vmc push” with the application name and URL after cloning the sample.

I’ll make my first blog post about this new Rails Console support and wait for the comments to start rolling in…

Unfortunately, it looks like I have a nasty comment from Joe that needs deleting.  Let’s fire up the Rails Console through vmc to easily get rid of that comment.  The vmc rails-console command can be run from any directory.

mycomp:enki$ vmc rails-console mynewblog
Deploying tunnel application 'caldecott'.
Uploading Application:
  Checking for available resources: OK
  Packing application: OK
  Uploading (1K): OK
Push Status: OK
Staging Application 'caldecott': OK
Starting Application 'caldecott': OK
Connecting to 'mynewblog' console: OK

irb():001:0>

Since this is the first time I’ve run Rails Console, vmc will deploy the caldecott application for me, which helps tunnel communication to my remote Rails application.  After that, it fires up the console and waits for input.

irb():001:0> @comment = Comment.find_by_author("Joe")
#<Comment id: 7, post_id: 1, author: "Joe", body: "I have something real...">
irb():002:0> @comment.delete
#<Comment id: 7, post_id: 1, author: "Joe", body: "I have something real...">
irb():003:0> @comment = Comment.find_by_author("Joe")
nil
irb():004:0> exit

In this console session, I use Comment.find_by_author to find Joe’s comment, delete the comment, and then check to ensure that Joe’s comment has been removed.   Let’s refresh the web page and see that it’s gone:

This is just one small example of what can be done with Rails Console.  I could use it for all sorts of diagnostics as well, such as perusing the database, running ruby commands to inspect state, or interacting with controller methods to check responsiveness.  For more information, check out the Rails Console documentation or this handy screencast from RailsCasts.

Enabling the Rails Console

The console will automatically be available when you push any Rails application.  If you already have a Rails application deployed to Cloud Foundry, you will need to update or redeploy your app to stage the console support.

What are you waiting for? Go try it out!

Ready to start interacting with your Rails app on Cloud Foundry? Make sure to update to the latest vmc gem, and you should be ready to give it a whirl.  Please feel free to direct any suggestions or feedback to the support forums!

- Jennifer Hickey
The Cloud Foundry Team

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

 

Facebook Twitter Linkedin Digg Delicious Reddit Stumbleupon Email

ThemaTweets – Visualizing the French Elections Buzz on Cloud Foundry

As the platform matures, we see many cool applications being built on top of Cloud Foundry. This is the first in a series of guest blog posts by application developers explaining what their application does, how it is architected, what they like in Cloud Foundry and what needs to be improved.

Guest blog post by Eric Bottard

ThemaTweets2012 allows you to visualize what people say about the french elections candidates on Twitter, how these candidates relate to key themes of this 2012 event and analyze information under several angles.


The Story

In late 2011, Google France launched a data visualization challenge about the upcoming 2012 presidential elections. The rules of the challenge were pretty straightforward : provide a web application that leverages data from Google and/or Twitter and shed a new light on the french elections. The winners would eventually win a trip to Mountain View, or a nice Android tablet.

My team and I started hacking pretty late and although we wanted to use that opportunity to experiment with new technologies and great ideas (after all, the main reason we engaged in the challenge was for the fun of it), we focused ourselves on one simple thing : detecting the topics that mattered the most to people, and how candidates to the elections related to those. Now, you’ll admit that 140 characters is not much to convey structured information. Add to this the fact that people don’t always put a lot of effort into writing elaborate sentences on Twitter, so we decided to keep things simple : we would only count occurrences of candidates and topics, without trying to analyze the tone of the tweet.

Being a dataviz oriented application, ThemaTweets allows the user to navigate between different views of the same raw data. The main screen shows an overall breakdown of candidates and then the topics mentioned in tweets (eg. Nicolas Sarkozy is found in 43% of the tweets we captured and amongst those, 28% cite the topic “Taxes”). Click on a button and you’ll invert the view (eg. 54% of tweets captured deal with “Ecology”, of which 33% are linked to François Hollande).

One can also view the evolution of these figures over time. This is already useful and interesting, but we wanted to go further than that and help some hidden information surface out of those simple datapoints. So the application also has two other views :

  1. one allows us to see how topics “belong” to a political side. By assigning some kind of left-right alignment to each of the candidates, we can average the relative positions of topics relative to each other.
  2. the other selects the topics that are the most often encountered for each candidate and then displays the “overlap” that one can find between two (or more) candidates. For example, if N. Sarkozy is linked to “Euro crisis” in 34% of the tweets and Dominique de Villepin is credited with 21% of tweets for the same topic, we’d link them together with an arc. The thickness of the arc at both ends reflects the percentages.

Lastly, we added a view that highlights the terms we captured in the tweets, so that people can witness were the data is coming from.


Of course, users can view the evolution of topics or candidates share over time

How the application actually works

Under the hood, ThemaTweets is a simple web application, built on top of Spring and Hibernate. The data model is rather simple, with an added twist whereby we aggregate data hourly to avoid recomputing means and sums every time a view is needed. It leverages the twitter4j library to connect to twitter, making use of the streaming API. There are fixed keyword terms made of the candidates names (and their political parties, collaborators and so on). This allows the twitter API to pre-filter results. Then, for each tweet that is received, the app tries to match it against keywords related to topics. Contrary to the candidate filter, there is an opportunity here to apply Lucene related technology where we tokenize and stem the words (so that we would match “écologie”, “écolo”, “écologiste” as well as variants without the accented “é”). While we originally went for a trained bayesian filter approach, the ratio of useful words to garbage was really huge. So we decided to keep the algorithm, but using only handcrafted positive weighs for the topic words. This worked really well.

Terms that are captured in tweets are highlighted and linked to views in the application, so that users understand where the data is coming from

Being proficient with the technologies used helped us prototype quickly, with an added productivity bonus coming from Spring Data JPA. The application UI is really client centric, with data coming in JSON from Spring MVC controllers.

Interacting with Cloud Foundry

We chose from the start to experiment with some cloud infrastructure, just for the fun of it. Moreover, we had no idea of the exposure the app would get once the challengers would be revealed. Sadly, we did not have time to lose trying to bend our minds around limitations in JPA queries that actually operate on a NoSQL backend, or trying to have maven and a cloud related eclipse plugin play nicely together. So we finally went for Cloud Foundry after one or two days.

The setup was the most impressive experience I guess. Imagine adding 3 lines of maven plugin configuration to your pom.xml and being able to push the application code directly to the cloud ! The interaction with the vmc command line tool was also very pleasant, and provisioning services by simply following a wizard felt refreshing.

I think the most astonishing feature was the fact that, ThemaTweets being a rather simple app with only one datasource, it got reconfigured automagically to use the cloud mysql instance, as detailed here. So the very same code that ran locally could be deployed in the cloud with no modification.

Also, having access to a genuine java virtual machine without restrictions also was decisive in our choice. Indeed, the Twitter streaming API requires a long lived thread to be connected to the twitter servers, which ruled out some of the alternatives.


Those three lines of XML configuration are all that is needed to deploy to the cloud with maven

Of course, there were some difficulties nevertheless. The biggest drawback comes from the fact that when you’re in the cloud, you’re pretty blind to what happens with your app. At first, there was no way to know what was getting stored in our database, so we had to roll out our own back office application. Luckily, the tunnel solution was discovered soon after, although we had a very hard time making it work on a mac (something that should go more smoothly in the future if I understand correctly).

A side effect of this blindness is that importing / exporting data is pretty complicated, even with the tunnel working. Because of timeouts that have to be enforced on the mysql services, exporting our data had to be done in chunks, which was a bit tedious. Nevertheless, I believe the tunneling approach is very smart and could allow other usages in the future.

We also witnessed some strange memory usage from time to time, whereas the app was behaving very nicely locally.

Some additions to the platform could also be considered as “nice to have”, even though we made it without them. For starters, code versionning was not really an issue for us, as the app was not live until the challenge was over. But because Cloud Foundry allows services to be bound to multiple applications, I guess you can get away with having another app alias running the new code and being bound to the same services.

We also needed our Twitter connector to be a singleton among the whole cluster. While we ended up starting it from an http thread, having a cloud-aware singleton spring scope supported by the platform would be nice (remember that you can’t know beforehand the IP addresses of the machines you’ll be running on, etc.)

I also recently realized that although Cloud Foundry almost gives access to a vanilla Tomcat server, there is no way to add custom jars to the lib/ folder (eg. to allow Spring load time weaving). The platform does add the mysql/postgresql jdbc connector jar for you though.

Finally, I guess what the platform today lacks compared to the competition is a nice looking web UI, although the vmc command line tool (and the REST API behind it) offer a lot information.

Happy End

As you can guess, we were really impressed by the technology. We did not win the first prize in the challenge, but made it to the finals nevertheless. For the purpose of being shown on this youtube channel, the app had to be moved and operated by Google. Because Cloud Foundry did not force us to modify our plain Spring MVC app, the very same war file is now hosted on another platform and it works like a charm.

Signup for Cloud Foundry today, and start building your own cool app!

Facebook Twitter Linkedin Digg Delicious Reddit Stumbleupon Email