Cloud Zone is brought to you in partnership with:

Christopher Keene is an entrepreneur, executive and educator. He is the VP of Cloud Computing Solutions at VMWare. Chris is a DZone MVB and is not an employee of DZone and has posted 38 posts at DZone. You can read more from them at their website. View Full User Profile

The World Is Your Oyster: Installing and Using Cloud Foundry on Windows

04.19.2011
| 10908 views |
  • submit to reddit
Cloud Foundry is an incredibly cool way to build and deploy cloud apps to any target cloud using very simple commands.
The basic api has just three commands:
  1. vmc target cloud.url //targets a cloud
  2. vmc login // login to cloud
  3. vmc push // run your app in the cloud
Three commands and the (cloud) world is your oyster! Very cool.
This may be just me but I found it difficult to follow the install guide for Cloud Foundry on my windows machine. For those of us trapped behind corporate firewalls and proxy servers, things got even more complicated.



After scurrying around the cloud foundry forums and stackoverflow, here are my slightly revised notes for getting Cloud Foundry running on a Windows machine using a proxy server:
1. Apply for a Cloud Foundry account at www.cloudfoundry.com you will be notified by email when your account is activated
2. Install Ruby from www.rubyinstaller.org. The Cloud Foundry cloud controller command line is built in Ruby so this is required. As the installer runs, make sure to check the boxes to add the ruby directory to your command path

3. Start the Windows command line client on windows by typing "run cmd" in start menu
4. Install the Cloud Controller software. Type:gem install vmc
If you are behind a firewall, you will get a nasty error message:
ERROR: Could not find a valid gem 'vmc' (>=0) in any repository
5. Install vmc gem through a proxy server, type:
gem install --http-proxy http://proxy.vmware.com:3128 vmc

Congratulations! The Cloud Foundry Cloud Controller is now installed. From here on, you can type Cloud Foundry commands into the Windows command window.
6. Tell Cloud Foundry which cloud you want to connect to. Type:
vmc target api.cloudfoundry.com
Again, if you are benhind a firewall, you will get the error message
Host is not valid: 'http://api.cloudfoundry.com
7. To communicate with Cloud Foundry through a proxy server, set the environment variable "http_proxy". In the command window, type
set http_proxy=http://proxy.vmware.com:3128vmc target api.cloudfoundry.com
8. Login to Cloud Foundry
vmc login
Enter your email address and password
9. Create a simple Ruby application.
cd \mkdir hellocd hello
The above commands create a "C:\hello" directory. Using a text editor type the following and save the file as "hello.rb"
require 'sinatra'get '/' do "Hello from Cloud Foundry +VMware and may I add you look dashing today?"end
11. Publish the application to the cloud. Type:
vmc push
The following prompts will appear :
Would you like to deploy from the current directory? [Yn] Assuming that you are in the hello directory hit enter (this answers Yes)
Application Name: hello_usernameNOTE: use a unique name for your application best to concat your user name and "hello"
Application Deployed URL: ‘hello_username.cloudfoundry.com’?Press enter to accept default
Detected a Sinatra Application, is this correct? [Yn]Press enter to accept default
Memory Reservation [Default:128M] (64M, 128M, 256M, 512M, 1G or 2G)Press enter to accept default (128MB)
Creating Application: OK...Would you like to bind any services to ‘hello’ [yN]: Press enter, you don’t want to bind any services for this example
12. Launch a web browser and go to your Application Deployment URL.





Now wasn't that easy?
References
Published at DZone with permission of Chris Keene, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

Comments

Rakotoso Mic replied on Wed, 2011/04/20 - 3:12am

I cant reach the link "install guide for Cloud Foundry"

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.