http://cloudfoundry.com/ 注册完了等一会会收到一个随机密码 登陆系统后可以创建Micro Cloud Foundry,接着可以下载一个可以用VMWare打开的镜像。下面的操作不需要下载这个镜像。 Installing Ruby and RubyGems: sudo apt-get install ruby-full rubygems sudo gem install rubygems-update sudo /var/lib/gems/1.8/bin/update_rubygems Specify the Cloud Foundry target # vmc target api.cloudfoundry.com Successfully targeted to [http://api.cloudfoundry.com] Successfully logged into [http://api.cloudfoundry.com] VMware's Cloud Application Platform For support visit http://support.cloudfoundry.com Target: http://api.cloudfoundry.com (v0.999) Usage: Memory (0B of 2.0G total) A simple Ruby Hello World application using Sintatra Install Sinatra Web framework # mkdir -p /usr/bob/sample-apps/hello # cd /usr/bob/sample-apps/hello/ "Hello from Cloud Foundry" Push hello to cloudfoundry: Would you like to deploy from the current directory? [Yn]: y Application Deployed URL [feisky.cloudfoundry.com]: Detected a Sinatra Application, is this correct? [Yn]: Memory Reservation (64M, 128M, 256M, 512M, 1G, 2G) [128M]: Would you like to bind any services to 'feisky'? [yN]: Checking for available resources: OK +-------------+----+---------+-------------------------+----------+ | Application | # | Health | URLS | Services | +-------------+----+---------+-------------------------+----------+ | feisky | 1 | RUNNING | feisky.cloudfoundry.com | | +-------------+----+---------+-------------------------+----------+ root@localhost:~# vmc files feisky logs (当前有哪些log文件) root@localhost:~# vmc files feisky logs/stdout.log (读log文件的内容) == Sinatra/1.2.1 has taken the stage on 54337 for production with backup from Thin >> Thin web server (v1.2.11 codename Bat-Shit Crazy) >> Maximum connections set to 1024 >> Listening on 0.0.0.0:54337, CTRL+C to stop If you suspect that your application has crashed recently, run vmc crashes <appname>
which will provide you with more information:
prompt$ vmc crashes hotels
Use vmc crashlogs
to get more detailed information about the crash:
prompt$ vmc crashlogs hotels
Managing the Application Lifecycle: # vmc rename old-name new-name
Avoiding Downtime When Updating The Deployment Bits vmc map feisky-new feisky.cloudfoundry.com
+-------------+----+---------+------------------------------------------------------+----------+
| Application | # | Health | URLS | Services |
+-------------+----+---------+------------------------------------------------------+----------+
| feisky | 1 | RUNNING | feisky.cloudfoundry.com | |
| feisky-new | 1 | RUNNING | feisky-new.cloudfoundry.com, feisky.cloudfoundry.com | |
+-------------+----+---------+------------------------------------------------------+----------+
此时,访问feisky.cloudfoundry.com,有的时候会访问到老版本,有的时候会访问到新版本
Disassociate the old application from its original deployment URL: # vmc unmap feisky feisky.cloudfoundry.com
Disassociate the new application from its new deployment URL:
# vmc unmap feisky-new feisky-new.cloudfoundry.com
# vmc stats feisky-new (当前的资源占用情况)
+----------+-------------+----------------+--------------+---------------+
| Instance | CPU (Cores) | Memory (limit) | Disk (limit) | Uptime |
+----------+-------------+----------------+--------------+---------------+
| 0 | 0.0% (4) | 17.2M (128M) | 44.0K (2G) | 0d:0h:12m:20s |
+----------+-------------+----------------+--------------+---------------+
# vmc mem feisky-new 512
Updating Memory Reservation to 512M: OK
Stopping Application: OK
Staging Application: OK
Starting Application: OK
# vmc stats feisky-new (改变应用的内存上限)
+----------+-------------+----------------+--------------+-------------+
| Instance | CPU (Cores) | Memory (limit) | Disk (limit) | Uptime |
+----------+-------------+----------------+--------------+-------------+
| 0 | 3.9% (4) | 17.0M (512M) | 40.0K (2G) | 0d:0h:0m:5s |
+----------+-------------+----------------+--------------+-------------+
# vmc instances feisky-new 4 (将应用的实例数改为4)
Scaling Application instances up to 4: OK
# vmc stats feisky-new
+----------+-------------+----------------+--------------+--------------+
| Instance | CPU (Cores) | Memory (limit) | Disk (limit) | Uptime |
+----------+-------------+----------------+--------------+--------------+
| 0 | 0.1% (4) | 17.0M (512M) | 40.0K (2G) | 0d:0h:1m:21s |
| 1 | 2.7% (4) | 17.0M (512M) | 40.0K (2G) | 0d:0h:0m:6s |
| 2 | 3.6% (4) | 17.0M (512M) | 40.0K (2G) | 0d:0h:0m:6s |
| 3 | 3.4% (4) | 17.0M (512M) | 40.0K (2G) | 0d:0h:0m:6s |
+----------+-------------+----------------+--------------+--------------+
Cloud Foundry是VMware用Ruby实现的业界首个开源PaaS平台,支持多种语言(Ruby、Java、Javascript、Python、 PHP等)以及开发框架(Rails、Sinatra、Spring、NodeJS等),能集成各种后端serivce(Mysql、MongoDB、Redis等) 支持多种云计算平台,能提升开发者的生产力,加速软件开发部署。 本文转自feisky博客园博客,原文链接:http://www.cnblogs.com/feisky/archive/2012/03/24/2416004.html,如需转载请自行联系原作者