cloud foundry 培训第一天

Cloud Foundry Setup

Skip to end of metadata Go to start of metadata
  1. Register a Cloudfoundry account at 
    1. Enter your email and promo code: CFOpenTour2012  https://my.cloudfoundry.com/signup
  2. Installing VMC (VMware ommand line tool for Cloudfoundry implemented in Ruby)
    1. Install Ruby 1.9.2
      1. copy from usb or download 1.9.2 installer from  http://www.rubyinstaller.org/downloads/
      2. run installer to install to default folder c:\Rub192
        1. check off "add ruby to PATH" 
    2. Update RubyGems & install VMC
      1. open DOS window
      2. run gem update --system
      3. gem install vmc
      4. run vmc target api.cloudfoundry.com to verify vmc is working
  3. Install VM Player
    1. copy from usb or download 4.0.2 from  http://downloads.vmware.com/d/info/desktop_end_user_computing/vmware_player/4_0
    2. run installer
    3. restart machine to complete installation
  4. Register Micro Cloudfoundry domain
    1. Go to  https://www.cloudfoundry.com/micro/dns
    2. log in using your cloudfoundry account acquired at step 1
    3. use your name or other meaningful word for your domain name
    4. node down the token to be used later
  5. Start Micro Cloudfoundry VM
    1. mkdir c:\dev\cfoundry
    2. 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)
    3. start VMWare Player and open c:\dev\cfoundr\micro\micro.vmx
    4. Click on the loaded VM
      1. if you see VT warning for 64bit operation, see Troubleshooting section below
  6. Configure VM
    1. At the Welcome screen, select 1 to configure.
    2. Set a password for Micro Cloud Foundry by entering and confirming the new password.
    3. At the Select network: prompt, enter 1 to configure networking with DHCP.
    4. At the HTTP proxy: prompt, press Enter to choose none for HTTP proxy.
      1. If you are behind an HTTP proxy, enter the URL for the proxy server, for example http://192.168.1.125:8023.
    5. Enter the configuration token from the Micro Cloud Foundry Web site.
    6. 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,
      1. see Troubleshooting section
  7. Register a new user against your micro VM (replace YOUR_DOMAIN with what you have registered at www.cloudfoundry.com
    1. open DOS
    2. vmc target api.YOUR_DOMAIN.cloudfoundry.me   (replace this with the URL shown in your VM console)
    3. vmc register
    4. enter email and password for the new Micro Cloudfoundry user
    5. vmc login
    6. use the email and password for the new user you created
  8. Deploy your first app
    1. gem install sinatra
    2. cd c:\dev\cfoundry
    3. mkdir rubyapp
    4. cd rubyapp
    5. notepad hello.rb (enter the following and save the file)
      require 'rubygems'
      require 'sinatra'
      get '/' do
        "Hello from TCL Cloud Foundry"
      end
    6. vmc push
      1. use hello as your application name
      2. for all other options, just press enter to use default value
    7. access http://hello.YOUR_DOMAIN.cloudfoundry.me
    8. update the string in hello.rb and do vmc update hello
    9. access the url to see changes to your applicaiton
  9. Deploy other kinds of apps
    1. Node.js: http://docs.cloudfoundry.com/frameworks/nodejs/nodejs.html
    2. Spring: http://docs.cloudfoundry.com/frameworks/java/spring/spring.html 
  10. Useful VMC commands
    1. vmc info  (see which server you are connecting(targeting) to and the user you logged in)
    2. vmc apps (list apps deployed and their URLs)
    3. 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 >
                    < target >http://api.tcltest.cloudfoundry.me</ target >
                    < 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 >
        < url >http://maven.springframework.org/milestone</ url >
    </ 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

 See Also

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值