原文在我另外一个博客上,地址:http://caok1231.com/blog/2013/03/23/deploy-rails-app-with-cloud-foundry/
这里直接拷贝过来的,就不在另外排版了。
Cloud Foundry是VMware于2011年4月12日推出的业界第一个开源PaaS云平台,它支持多种框架、语言、运行时环境、云平台及应用服务,使开发人员能够在几秒钟内进行应用程序的部署和扩展,无需担心任何基础架构的问题。
我去年刚听说Cloud Foundry的时候就试用了下,隔了有些日子了,今天重新去使用的时候遇到了一些问题,记录下。
vmc需事先安装好了ruby
1.安装vmc
gem install vmc
如果刚安装后出现”command not found: vmc”的情况
rbenv rehash
我这使用的是rbenv
2.与Cloud Foundry建立连接
vmc target api.cloudfoundry.com
3.登录cloud foundry
当然你已经注册好了Cloud Foundry的帐号,如果没有的话赶紧去Cloud Foundry去注册一个
vmc login
登录成功后就可以开始部署了.
4.部署rails应用
cloudfoundry上不支持sqlite3,如果你使用的还是sqlite3的话,可以在Gemfile这么修改下
Gemfile
# If you use a different database in development, hide it from Cloud Foundry.
group :development do
gem 'sqlite3'
end
# Rails 3.1 can use the latest mysql2 gem.
group :production do
gem 'mysql2'
end
配置信息处也需要修改下
config/environments/production.rb
config.serve_static_assets = true
Bundle your application:
bundle package
bundle install
Assets
rake assets:precompile
Deploy
vmc push --runtime ruby19
发布过程
Name> example # 设置应用的名称
Instances> 1
1: rails3
2: other
Framework> rails3
1: 64M
2: 128M
3: 256M
4: 512M
5: 1G
Memory Limit> 256M
Creating example... OK
1: example.cloudfoundry.com
2: none
Domain> example.cloudfoundry.com
Updating example... OK
Create services for application?> y
1: mongodb 2.0
2: mysql 5.1
3: postgresql 9.0
4: rabbitmq 2.4
5: redis 2.2
6: redis 2.4
7: redis 2.6
What kind?> 2
Name?> example_datebase # 设置数据库名称
Creating service example_datebase... OK
Binding example_datebase to example... OK
Create another service?> n
Bind other services to application?> n
Save configuration?> y
Saving to manifest.yml... OK
Uploading example... OK
Starting example... OK
Checking example...
0/1 instances: 1 starting
0/1 instances: 1 down
0/1 instances: 1 down
0/1 instances: 1 flapping
Application failed to start.
这里解释下,vmc push后会产生一个manifest.yml的文件,刚才所有的设置都会记录在其中。
很明显这里应用没有启动成功,那问题处在哪里呢?
首先我查看下应用的状态
vmc apps
Getting applications... OK
name status usage runtime url
example 0% 1 x 256M ruby19 example.cloudfoundry.com
vmc services
Getting services... OK
name service version
example_datebase mysql 5.1
这里我们可以看到数据库和应用都是正确的,只是在启动的时候发生的意外。这时我们可以直接查看下日志
vmc logs example
Using manifest file manifest.yml
Getting logs for example #0... OK
Reading logs/migration.log... OK
/var/vcap/data/dea/apps/example-0-db496108f915e5d9ec906e10a6ee9f12/app/rubygems/ruby/1.9.1/gems/bundler-1.2.1/lib/bundler/source.rb:801:in `rescue in load_spec_files': git://github.com/nadarei/mina.git (at master) is not checked out. Please run `bundle install` (Bundler::GitError)
from /var/vcap/data/dea/apps/example-0-db496108f915e5d9ec906e10a6ee9f12/app/rubygems/ruby/1.9.1/gems/bundler-1.2.1/lib/bundler/source.rb:799:in `load_spec_files'
...........
这里我们可以发现是mina造成的bundle的错误,修改一下相应的错误后重新发布
vmc push
Using manifest file manifest.yml
Uploading example... OK
Stopping example... OK
Starting example... OK
Checking example...
0/1 instances: 1 starting
0/1 instances: 1 starting
0/1 instances: 1 starting
1/1 instances: 1 running
OK
这次很顺利没有再出现问题,它直接调用manifest.yml保存的部署设置。访问下example.cloudfoundry.com就可以直接看到你刚部署的应用。
5.vmc其他命令
vmc help
vmc update [APP]
vmc stop [APP]
vmc start [APP]
vmc restart [APP]
vmc delete [APP]
vmc logs [APP]
vmc instances [APP] # 列出你有的instances
vmc scale [APP] # 更新应用的instances/memory limit
原文在我另外一个博客上,地址:http://caok1231.com/blog/2013/03/23/deploy-rails-app-with-cloud-foundry/
相关推荐
Get started with Cloud Foundry, the leading Platform as a Service (PaaS) that’s dramatically changing how developers, operations practitioners, and especially DevOps teams deploy applications and ...
Cloud Foundry is a platform that helps you develop and deploy applications and tasks with velocity.
他们的演讲题目分为两部分,第一部分由彭麟来介绍CloudFoundry的架构,后面一部分由EMC颜开来介绍一下Openstack的部署,他们在上海交大做了很多的合作,颜开还会有一个五分钟的视频演示,讲述如何把CloudFoundry部署...
Deploy an OpenStack private cloud to a Hadoop MapReduce environment
cloudfoundry-deploy-buildkite-plugin:用于部署到Cloud Foundry的Buildkite插件
Hello World(CodeBox 插件) CodeBox 的 HelloWorld 插件( )。
This concise teaches you how to use the power of Docker and Kubernetes to deploy your Rails applications easily and efficiently. Docker and Kubernetes are increasing in popularity every day, but what ...
安装在上创建一个帐户在仪表板中创建或导入项目在 codenvy 的根目录项目上创建manifest.yml (请参阅: ://docs.cloudfoundry.org/devguide/deploy-apps/manifest.html) 在您的环境中点击底部的标签runner 。...
Scalable Cloud Ops with Fugue Declare, Deploy, and Automate the Cloud 英文无水印pdf pdf所有页面使用FoxitReader和PDF-XChangeViewer测试都可以打开 本资源转载自网络,如有侵权,请联系上传者或csdn删除 ...
Rails 经典开发参考书, Ruby on rails 系近年来在西方日渐盛行的一套网页开发工具,其高度集成化时开发时间大大缩短.
开发人员将应用程序推送到Cloud Foundry的指南 本指南为开发人员提供了有关在Cloud Foundry中运行的应用程序进行部署和故障排除的指南。 这是进入完整文档集的几个存储库之一。 这里的内容被构造为主题存储库,...
Scalable Cloud Ops with Fugue Declare, Deploy, and Automate the Cloud 英文epub 本资源转载自网络,如有侵权,请联系上传者或csdn删除 本资源转载自网络,如有侵权,请联系上传者或csdn删除
Scalable Cloud Ops with Fugue Declare, Deploy, and Automate the Cloud 英文azw3 本资源转载自网络,如有侵权,请联系上传者或csdn删除 本资源转载自网络,如有侵权,请联系上传者或csdn删除
前端开源库-ember-cli-deploy-appshellember cli部署appshell,基于applicationcache的shell,用于加载ember应用程序
This practical guide shows intermediate and advanced web and mobile app developers how to build highly scalable Java applications in the cloud with Google App Engine. The flagship of Google's Cloud ...
flask-app-gcp-deploy 在Google Cloud Platform(GCP)上部署的Flask应用程序。 持续部署与Cloud Build协调。 对于这个项目,我跟踪。如何使用要在GCP上部署此应用并设置连续部署,您可以按照以下步骤操作:建立一个...
What you will learnSet up a working development environment and create a simple web service to demonstrate the basicsLearn how to make your service more usable by adding a database and an app server ...
Pivotal Cloud Foundry蓝绿色部署示例 脚步: - Build the application using Maven: mvn clean package - Set your pivotal api end point. run >>cf api - Login with your pivotal credentials : >> cf login...
If you're an experienced Java developer in the enterprise, this practical, hands-on book shows you how to use OSGi to design, develop, and deploy modular cloud applications. You'll quickly learn how ...