Monday, October 3, 2011

Install VMC under Windows

  1. Install rubyinstaller-1.9.2-p290.exe from http://www.rubyinstaller.org (make sure to check the boxes to add the ruby directory to your command path)
  2. In console mode, 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 
  3. Install vmc gem through a proxy server, type:
    gem install --http-proxy http://proxy.vmware.com:3128 (this proxy url is proxy server of your company) vmc
  4. Tell Cloud Foundry which cloud you want to connect to. Type:
    vmc target api.cloudfoundry.com (in general, you have to set the hosts info in your hosts document) 
  •  the hosts document located in C:\Windows\System32\drivers\hosts
  • add localhost name and its DNS, for example
  •  11.111.111.22   api.cf-controller.test.com.tw
     11.111.111.22   test.cf-controller.test.com.tw
  •  
  1. To communicate with Cloud Foundry through a proxy server, set the environment variable "http_proxy". In the command window, type
  2. set http_proxy=http://proxy.vmware.com:3128 (this proxy url is proxy server of your company) vmc target api.cloudfoundry.com 
  3. Login to Cloud Foundry
    vmc login
    Enter your email address and password
  4. Create a simple Ruby application.
    • c:\> md helloTest 
    • c:\> cd helloTest
    • c:\helloTest\> copy nul helloTest.rb
    • type the following sample code in helloTest.rb using a test editor :
    • require 'sinatra'
      get '/' do
          "Hello from Cloud Foundry"
      end
  5. Publish the application to the cloud. Type:
    • c:\helloTest>vmc push helloTest (helloTest only without extension (.rb))
     
  6. Would you like to deploy from the current directory? [Yn]: y
    • Application Deployed URL: 'helloTest.cf-controller.cht.com.tw'? y
    • Detected a Sinatra Application, is this correct? [Yn]: y
    • Memory Reservation [Default:128M] (64M, 128M, 256M, 512M or 1G)
    • Creating Application: OK
    • Would you like to bind any services to 'helloTest'? [yN]: n
    • Uploading Application:
    •  Checking for available resources: OK
    •  Packing application: OK
    •  Uploading (0K): OK
    • Push Status: OK
    • Staging Application: OK
    • Starting Application: OK
  7. modify C:\Windows\System32\drivers\hosts and add your application info:  
    • 11.111.111.22 helloTest.cf-controller.testcom.tw
  8. Launch a web browser and go to your Application Deployment URL (helloTest.cf-controller.testcom.tw)
Reference:
  1. http://cloud.dzone.com/news/world-your-oyster-installing
  2. http://support.cloudfoundry.com/entries/20425003-error-creating-war-file
  3. http://support.cloudfoundry.com/entries/20014132-vmc-push-failed-error-300-invalid-application-description

      No comments:

      Post a Comment