阅读背景:

将基本rails应用程序部署到cloudfoundry时出错

来源:互联网 

I generated a basic scaffold rails application (generated as instructed here)

我生成了一个基本的脚手架rails应用程序(按照此处的说明生成)

The application runs fine when running on local webrick server. However, when deploying it to the (public) cloudfoundry I get an error as below.

在本地webrick服务器上运行时,应用程序运行正常。但是,当将其部署到(公共)cloudfoundry时,我收到如下错误。

I'm using ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux] and Rails 3.2.8. Thoughts?

我正在使用ruby 1.9.3p194(2012-04-20修订版35410)[x86_64-linux]和Rails 3.2.8。思考?

....

....

No RabbitMQ service bound to app.  Skipping auto-reconfiguration.
rake aborted!
/var/vcap/data/dea/apps/myblog-0-0f9f91b4af44340115aeb6e5df89e4a9/app/config/initializers/session_store.rb:3: syntax error, unexpected ':', expecting $end
...sion_store :cookie_store, key: '_blog_session'
                              ^
/var/vcap/data/dea/apps/myblog-0-0f9f91b4af44340115aeb6e5df89e4a9/app/rubygems/ruby/1.8/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:245:in `load'
/var/vcap/data/dea/apps/myblog-0-0f9f91b4af44340115aeb6e5df89e4a9/app/rubygems/ruby/1.8/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:245:in `load'
/var/vcap/data/dea/apps/myblog-0-0f9f91b4af44340115aeb6e5df89e4a9/app/rubygems/ruby/1.8/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:236:in `load_dependency'
/var/vcap/data/dea/apps/myblog-0-0f9f91b4af44340115aeb6e5df89e4a9/app/rubygems/ruby/1.8/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:245:in `load'
/var/vcap/data/dea/apps/myblog-0-0f9f91b4af44340115aeb6e5df89e4a9/app/rubygems/ruby/1.8/gems/railties-3.2.8/lib/rails/engine.rb:588
/var/vcap/data/dea/apps/myblog-0-0f9f91b4af44340115aeb6e5df89e4a9/app/rubygems/ruby/1.8/gems/railties-3.2.8/lib/rails/engine.rb:587:in `each'
/var/vcap/data/dea/apps/myblog-0-0f9f91b4af44340115aeb6e5df89e4a9/app/rubygems/ruby/1.8/gems/railties-3.2.8/lib/rails/engine.rb:587
/var/vcap/data/dea/apps/myblog-0-0f9f91b4af44340115aeb6e5df89e4a9/app/rubygems/ruby/1.8/gems/railties-3.2.8/lib/rails/initializable.rb:30:in `instance_exec'
/var/vcap/data/dea/apps/myblog-0-0f9f91b4af44340115aeb6e5df89e4a9/app/rubygems/ruby/1.8/gems/railties-3.2.8/lib/rails/initializable.rb:30:in `run'
/var/vcap/data/dea/apps/myblog-0-0f9f91b4af44340115aeb6e5df89e4a9/app/rubygems/ruby/1.8/gems/railties-3.2.8/lib/rails/initializable.rb:55:in `run_initializers'
/var/vcap/data/dea/apps/myblog-0-0f9f91b4af44340115aeb6e5df89e4a9/app/rubygems/ruby/1.8/gems/railties-3.2.8/lib/rails/initializable.rb:54:in `each'
/var/vcap/data/dea/apps/myblog-0-0f9f91b4af44340115aeb6e5df89e4a9/app/rubygems/ruby/1.8/gems/railties-3.2.8/lib/rails/initializable.rb:54:in `run_initializers'
/var/vcap/data/dea/apps/myblog-0-0f9f91b4af44340115aeb6e5df89e4a9/app/rubygems/ruby/1.8/gems/railties-3.2.8/lib/rails/application.rb:136:in `initialize!'
/var/vcap/data/dea/apps/myblog-0-0f9f91b4af44340115aeb6e5df89e4a9/app/rubygems/ruby/1.8/gems/railties-3.2.8/lib/rails/railtie/configurable.rb:30:in `send'
/var/vcap/data/dea/apps/myblog-0-0f9f91b4af44340115aeb6e5df89e4a9/app/rubygems/ruby/1.8/gems/railties-3.2.8/lib/rails/railtie/configurable.rb:30:in `method_missing'
/var/vcap/data/dea/apps/myblog-0-0f9f91b4af44340115aeb6e5df89e4a9/app/config/environment.rb:5
/var/vcap/data/dea/apps/myblog-0-0f9f91b4af44340115aeb6e5df89e4a9/app/rubygems/ruby/1.8/gems/railties-3.2.8/lib/rails/application.rb:103:in `require'
/var/vcap/data/dea/apps/myblog-0-0f9f91b4af44340115aeb6e5df89e4a9/app/rubygems/ruby/1.8/gems/railties-3.2.8/lib/rails/application.rb:103:in `require_environment!'
/var/vcap/data/dea/apps/myblog-0-0f9f91b4af44340115aeb6e5df89e4a9/app/rubygems/ruby/1.8/gems/railties-3.2.8/lib/rails/application.rb:295:in `initialize_tasks'
/var/vcap/data/dea/apps/myblog-0-0f9f91b4af44340115aeb6e5df89e4a9/app/rubygems/ruby/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call'
/var/vcap/data/dea/apps/myblog-0-0f9f91b4af44340115aeb6e5df89e4a9/app/rubygems/ruby/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `execute'
/var/vcap/data/dea/apps/myblog-0-0f9f91b4af44340115aeb6e5df89e4a9/app/rubygems/ruby/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'
/var/vcap/data/dea/apps/myblog-0-0f9f91b4af44340115aeb6e5df89e4a9/app/rubygems/ruby/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
/var/vcap/data/dea/apps/myblog-0-0f9f91b4af44340115aeb6e5df89e4a9/app/rubygems/ruby/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `invoke_with_call_chain'
/var/vcap/data/packages/dea_ruby18/7.1/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/var/vcap/data/dea/apps/myblog-0-0f9f91b4af44340115aeb6e5df89e4a9/app/rubygems/ruby/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/var/vcap/data/dea/apps/myblog-0-0f9f91b4af44340115aeb6e5df89e4a9/app/rubygems/ruby/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:176:in `invoke_prerequisites'
/var/vcap/data/dea/apps/myblog-0-0f9f91b4af44340115aeb6e5df89e4a9/app/rubygems/ruby/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:174:in `each'
/var/vcap/data/dea/apps/myblog-0-0f9f91b4af44340115aeb6e5df89e4a9/app/rubygems/ruby/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:174:in `invoke_prerequisites'
/var/vcap/data/dea/apps/myblog-0-0f9f91b4af44340115aeb6e5df89e4a9/app/rubygems/ruby/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:157:in `invoke_with_call_chain'
/var/vcap/data/packages/dea_ruby18/7.1/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/var/vcap/data/dea/apps/myblog-0-0f9f91b4af44340115aeb6e5df89e4a9/app/rubygems/ruby/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/var/vcap/data/dea/apps/myblog-0-0f9f91b4af44340115aeb6e5df89e4a9/app/rubygems/ruby/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
/var/vcap/data/dea/apps/myblog-0-0f9f91b4af44340115aeb6e5df89e4a9/app/rubygems/ruby/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:116:in `invoke_task'
/var/vcap/data/dea/apps/myblog-0-0f9f91b4af44340115aeb6e5df89e4a9/app/rubygems/ruby/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `top_level'
/var/vcap/data/dea/apps/myblog-0-0f9f91b4af44340115aeb6e5df89e4a9/app/rubygems/ruby/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `each'
/var/vcap/data/dea/apps/myblog-0-0f9f91b4af44340115aeb6e5df89e4a9/app/rubygems/ruby/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `top_level'
/var/vcap/data/dea/apps/myblog-0-0f9f91b4af44340115aeb6e5df89e4a9/app/rubygems/ruby/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/var/vcap/data/dea/apps/myblog-0-0f9f91b4af44340115aeb6e5df89e4a9/app/rubygems/ruby/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level'
/var/vcap/data/dea/apps/myblog-0-0f9f91b4af44340115aeb6e5df89e4a9/app/rubygems/ruby/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `run'
/var/vcap/data/dea/apps/myblog-0-0f9f91b4af44340115aeb6e5df89e4a9/app/rubygems/ruby/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/var/vcap/data/dea/apps/myblog-0-0f9f91b4af44340115aeb6e5df89e4a9/app/rubygems/ruby/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/var/vcap/data/dea/apps/myblog-0-0f9f91b4af44340115aeb6e5df89e4a9/app/rubygems/ruby/1.8/gems/rake-0.9.2.2/bin/rake:33
./rubygems/ruby/1.8/bin/rake:23:in `load'
./rubygems/ruby/1.8/bin/rake:23

2 个解决方案

#1


1  

have you included the --runtime=ruby19 flag when you push to make sure Cloud Foundry uses 1.9 instead of 1.8?

当你推动确保Cloud Foundry使用1.9而不是1.8时,你是否包含了--runtime = ruby​​19标志?

vmc push my_project --runtime=ruby19

#2


0  

There is an issue with deploying ruby apps bundled on Windows to CloudFoundry.com (which is Linux-based). The workaround is to modify your Gemfile.lock and delete occurrences of the string -x86-mingw32. Then re-push the app to Cloud Foundry.

将Windows上捆绑的ruby应用程序部署到CloudFoundry.com(基于Linux)存在问题。解决方法是修改Gemfile.lock并删除字符串-x86-mingw32的出现位置。然后将应用程序重新推送到Cloud Foundry。

$ bundle package

$ bundle install

$ bundle exec rake assets:precompile

$ vmc push my_project --runtime=ruby19  or $ vmc update my_project --runtime=ruby19

Hope this helps :)

希望这可以帮助 :)


分享到: