Skip to content

Barebones Cloud Foundry Hello World #2 (using Spring Tool Suite)

by on November 13, 2012

It’s pretty easy to get started with Cloud Foundry, but here’s also a 10 min barebones version we shared at JavaOne and will be sharing at Devoxx 2012 (record is 7 mins!)

  1. Sign up! If you do not have a Cloud Foundry account, sign up with this promo code: https://my.cloudfoundry.com/signup/preshavedyak If using your own laptop, make sure that you have Spring Tool Suite or Eclipse installed: http://www.springsource.org/sts (The instructions below are for STS)
  2. Install the Cloud Foundry plugin, Select Help > Dashboard, Click the Extensions tab, at the bottom left, type in “Cloud” in the Find field, then choose Cloud Foundry and click the Install button. Click on the prompted buttons until you are prompted to restart STS. Restart.
  3. Once you restart STS, in the Servers window where it says “No servers available. Define a new server from the …” click on the “new server wizard” link. (If you don’t see a Servers window, go to Window>Show View>Servers or Other>Servers)
  4. From the list of folders, open VMware, choose Cloud Foundry, and click Next.
  5. You should be in the Account Information page where you will log in to your Cloud Foundry account. If you just created a Cloud Foundry account, check your email for your temporary password.
    If you cannot remember your password, recover it here https://my.cloudfoundry.com/passwd
  6. Enter your account email address and password and click on the Validate Account button (We recommend copying and pasting both your email (ID) and your password – This is where a lot of people get stuck). Doubleclick on your VMware Cloud Foundry server and make sure
  7. If prompted to create security questions for the new Master Password, follow those steps.
  8. If the center screen in STS is not on the Dashboard, click the Dashboard tab. (If you don’t see it at all, go to Help>Dashboard)
    Under Create in the top left, choose Spring Template Project.
  9. In the Template Selection window, select Spring MVC Project, click Next.
  10. Create a Project Name (eg. my-first-hello) and specify the top-level package (eg. com.mydotcom.hello01).
    Click Finish.
  11. You will now see your new folder listed in the Package Explorer at the left. (If you don’t see Package Explorer, go to Window>Show View>Package Explorer)
    If you seen no alerts or X’s on your package, drag it down and drop into your VMware Cloud Foundry server listed in the bottom left Server window. (If it won’t drop onto the server, delete the app and create a new one).
  12. Once the app window opens, choose Next. For the Deployed URL, you need to create a unique URL prefix (eg. pusheeninspired – no periods or spaces) Click Next, make sure that your memory allocation is at least 512 or 1024, then click Finish and wait for the app to deploy.
  13. Once you see the word “Deployed” next to your app in the Servers list, right click on the app and choose
    Open Home Page to test. Your Hello World sample app should appear. (If you see 404, doublecheck the console to make sure your app has fully deployed. If you see 404 after full deployment, click on your app on the server and increase the memory allocation).
  14. If you want to do something more fun, you can edit your home.jsp file (in app name>src>main>webapp>WEB-INF>views>home.jsp

You can add something like this into your home.jsp file:

<html>
<head>
<title>Pusheen Inspired</title>
</head>
<body>
<h1>
Hello world! Be inspired!
</h1>
<img src=http://25.media.tumblr.com/tumblr_m7jhivE7DP1qhy6c9o5_250.gif>
<P>  The time on the server is ${serverTime}. </P>
</body>
</html>

If you make changes, then save and drag the changed app to the Cloud Foundry server again. If you succeed, you will see something like this: pusheeninspired.cloudfoundry.com

Voila’! Bare bare bones Cloud Foundry app push completed.

NOTE: Yes, this is a very very limited case. If you encounter issues, please consult these resources:

http://docs.cloudfoundry.com/getting-started.html

http://support.cloudfoundry.com/home

http://stackoverflow.com/questions/tagged/cloudfoundry

About these ads
3 Comments
  1. SpringOne Developer Conference is happening in India for the first time in Bangalore and Hyderabad in the month of December, 2012. The sessions are specifically tailored for developers using the hugely popular open source Spring technologies and Tomcat.

    Please find more details about the event at: http://bit.ly/Ungkqd

    • So sorry that I didn’t see this. Somehow got buried in my box. I heard that SpringOne in India was a smashing success. Good work!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: