The basic api has just three commands:
- vmc target cloud.url //targets a cloud
- vmc login // login to cloud
- vmc push // run your app in the cloud
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
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:
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?