1、安装命令行工具vmc
ubuntu@ip-10-128-97-185:~$ gem install vmc Successfully installed spruz-0.2.13 Successfully installed json_pure-1.5.4 Successfully installed rubyzip2-2.0.1 Successfully installed terminal-table-1.4.4 Successfully installed interact-0.2 Successfully installed vmc-0.3.13 6 gems installed
ubuntu@ip-10-128-97-185:~$ vmc target api.cloudfoundry.com Succesfully targeted to [http://api.cloudfoundry.com]
ubuntu@ip-10-128-97-185:~$ vmc login Email: [email protected] Password: ******** Successfully logged into [http://api.cloudfoundry.com]4、创建测试文件
ubuntu@ip-10-128-97-185:~$ mkdir cloudfoundry ubuntu@ip-10-128-97-185:~$ cd cloudfoundry/ ubuntu@ip-10-128-97-185:~/cloudfoundry$ ubuntu@ip-10-128-97-185:~/cloudfoundry/hello$ nano hello.rb require 'sinatra' get '/' do "Hello*from*Cloud*Foundry" end5、上传
ubuntu@ip-10-128-97-185:~/cloudfoundry/hello$ vmc push Would you like to deploy from the current directory? [Yn]: Application Name: douyw Application Deployed URL ["douyw.cloudfoundry.com"]: Detected a Sinatra Application, is this correct? [Yn]: Memory Reservation ("64M", "128M", "256M", "512M", "1G", "2G") ["128M"]: Creating Application: OK Would you like to bind any services to 'douyw'? [yN]: Uploading Application: Checking for available resources: OK Packing application: OK Uploading (0K): OK Push Status: OK Staging Application: OK Starting Application: OK ubuntu@ip-10-128-97-185:~/cloudfoundry/hello$注意:上面的douyw为应用程序名,是自己输入的。
这时已经发布完成。下面是对上传文件修改之后的步骤。
7、重新编辑并再次上传:
ubuntu@ip-10-128-97-185:~/cloudfoundry/hello$ nano hello.rb 再次上传 ubuntu@ip-10-128-97-185:~/cloudfoundry/hello$ vmc update douyw Uploading Application: Checking for available resources: OK Packing application: OK Uploading (0K): OK Push Status: OK Stopping Application: OK Staging Application: OK Starting Application: OK
Hello from Cloud Foundry and EC2