Cloud Foundry Setup
Skip to end of metadata
Go to start of metadata
Refer to http://start.cloudfoundry.com/getting-started.html for more details
- Register a Cloudfoundry account at
- Enter your email and promo code: CFOpenTour2012 https://my.cloudfoundry.com/signup
- Installing VMC (VMware ommand line tool for Cloudfoundry implemented in Ruby)
- Install Ruby 1.9.2
- copy from usb or download 1.9.2 installer from http://www.rubyinstaller.org/downloads/
- run installer to install to default folder c:\Rub192
- check off "add ruby to PATH"
- Update RubyGems & install VMC
- open DOS window
- run gem update --system
- gem install vmc
- run vmc target api.cloudfoundry.com to verify vmc is working
- Install Ruby 1.9.2
- Install VM Player
- copy from usb or download 4.0.2 from http://downloads.vmware.com/d/info/desktop_end_user_computing/vmware_player/4_0
- run installer
- restart machine to complete installation
- Register Micro Cloudfoundry domain
- Go to https://www.cloudfoundry.com/micro/dns
- log in using your cloudfoundry account acquired at step 1
- use your name or other meaningful word for your domain name
- node down the token to be used later
- Start Micro Cloudfoundry VM
- mkdir c:\dev\cfoundry
- unzip micro-1.2.0.zip to c:\dev\cfoundry (the drive has to be NTFS or file system that supports file larger than 2G, FAT won't work)
- start VMWare Player and open c:\dev\cfoundr\micro\micro.vmx
- Click on the loaded VM
- if you see VT warning for 64bit operation, see Troubleshooting section below
- Configure VM
- At the Welcome screen, select 1 to configure.
- Set a password for Micro Cloud Foundry by entering and confirming the new password.
- At the Select network: prompt, enter 1 to configure networking with DHCP.
- At the HTTP proxy: prompt, press Enter to choose none for HTTP proxy.
- If you are behind an HTTP proxy, enter the URL for the proxy server, for example http://192.168.1.125:8023.
- Enter the configuration token from the Micro Cloud Foundry Web site.
- Note: if running into No such file or directory - /var/vcap/monit/monit.user. error, you will need to log into console #2 to fix a ruby script file as followed,
- see Troubleshooting section
- Register a new user against your micro VM (replace YOUR_DOMAIN with what you have registered at www.cloudfoundry.com
- open DOS
- vmc target api.YOUR_DOMAIN.cloudfoundry.me (replace this with the URL shown in your VM console)
- vmc register
- enter email and password for the new Micro Cloudfoundry user
- vmc login
- use the email and password for the new user you created
- Deploy your first app
- gem install sinatra
- cd c:\dev\cfoundry
- mkdir rubyapp
- cd rubyapp
- notepad hello.rb (enter the following and save the file)
require 'rubygems'
require 'sinatra'
get '/' do
"Hello from TCL Cloud Foundry"
end - vmc push
- use hello as your application name
- for all other options, just press enter to use default value
- access http://hello.YOUR_DOMAIN.cloudfoundry.me
- update the string in hello.rb and do vmc update hello
- access the url to see changes to your applicaiton
- Deploy other kinds of apps
- Useful VMC commands
- vmc info (see which server you are connecting(targeting) to and the user you logged in)
- vmc apps (list apps deployed and their URLs)
- vmc help
Deploy Maven Project
You can use cf-maven-plugin to deploy your Maven projects via cf:push or cf:update. Make sure you configure your Eclipse to use your own 3.0.3 installation, so it reads the right settins.xml if not using mvn command line. You will configure the following,
settings.xml
<
servers
>
...
<
server
>
<
id
>mycloudfoundry-instance</
id
>
<
username
>yourRegisteredEmail</
username
>
<
password
>yourPassword</
password
>
</
server
>
</
servers
>
|
pom.xml
<
build
>
<
plugins
>
....
<
plugin
>
<
groupId
>org.cloudfoundry</
groupId
>
<
artifactId
>cf-maven-plugin</
artifactId
>
<
version
>1.0.0.M1</
version
>
<
configuration
>
<
server
>mycloudfoundry-instance</
server
>
<
url
>tcl2.tcltest.cloudfoundry.me</
url
>
<
memory
>256</
memory
>
</
configuration
>
</
plugin
>
....
</
plugins
>
</
build
>
...
<
pluginRepositories
>
....
<
pluginRepository
>
<
id
>repository.springframework.maven.milestone</
id
>
<
name
>Spring Framework Maven Milestone Repository</
name
>
</
pluginRepository
>
</
pluginRepositories
>
|
Troubleshooting
VT warning for 64bit operation
- Restart your machine to enter BIOS (press f12 while booting)
- Enable VT (e.g. for Thinkpad, go to Security->Virtualization)
- Save BIOS settings and reboot
No such file or directory - /var/vcap/monit/monit.user. error
- delete the VM file and extract again from usb
- get a new token at https://www.cloudfoundry.com/micro/dns
- hit alt-f2 when the console is up to enter console #2
- enter user as vcap
- enter password as ca$hc0w
- vi /var/vcap/micro/lib/micro/network.rb
- add .to_s at the end of line 50, so it looks like
- dns.getaddress(name).to_s
- save the changes, esc then colon then wq
- alt-f1 to return to console #1
- hit ctrl-c and answer yes to reload console
- select option 1 to proceed configuration
- see http://support.cloudfoundry.com/entries/21042938-mcf-1-2-0-configuration-error-s for more details
See Also