ruby-on-rails – Rails应用程序在Heroku上崩溃

前端之家收集整理的这篇文章主要介绍了ruby-on-rails – Rails应用程序在Heroku上崩溃前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我有 Ruby 2 Rails 4 Mongoid 4应用程序,完美的发展.但是当我推到Heroku,应用程序崩溃.我尝试分析Heroku日志,但是无法解决问题.我甚至尝试禁用我认为可能是原因的宝石,但没有用.

我使用的其他几个宝石是android_market_api,devise和s3_direct_upload.请帮忙!

  1. 2013-12-06T12:31:34+00:00 heroku[slug-compiler]: Slug compilation finished
  2. 2013-12-06T12:31:35.094147+00:00 heroku[web.1]: State changed from crashed to starting
  3. 2013-12-06T12:31:40.754686+00:00 heroku[web.1]: Starting process with command `bundle exec unicorn -p 3309 -c ./config/unicorn.rb`
  4. 2013-12-06T12:31:46.061981+00:00 app[web.1]: I,[2013-12-06T12:31:46.061146 #2] INFO -- : Refreshing Gem list
  5. 2013-12-06T12:31:50.812324+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/optionable-0.2.0/lib/optionable.rb:32:in `block in validate_strict': :skip_version_check is an unknown option. Valid options are: :write,:read,:database,:max_retries,:pool_size,:retry_interval,:refresh_interval,:down_interval,:ssl,:timeout,:instrumenter. (Optionable::Unknown)
  6. 2013-12-06T12:31:50.812324+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/optionable-0.2.0/lib/optionable.rb:27:in `each_pair'
  7. 2013-12-06T12:31:50.812324+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/optionable-0.2.0/lib/optionable.rb:27:in `validate_strict'
  8. 2013-12-06T12:31:50.812324+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/moped-2.0.0.beta4/lib/moped/session.rb:255:in `initialize'
  9. 2013-12-06T12:31:50.812324+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/bundler/gems/mongoid-f8b439dd9a59/lib/mongoid/sessions/factory.rb:66:in `new'
  10. 2013-12-06T12:31:50.812324+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/bundler/gems/mongoid-f8b439dd9a59/lib/mongoid/sessions/factory.rb:66:in `create_session'
  11. 2013-12-06T12:31:50.812324+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/bundler/gems/mongoid-f8b439dd9a59/lib/mongoid/sessions/factory.rb:43:in `default'
  12. 2013-12-06T12:31:50.812324+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/bundler/gems/mongoid-f8b439dd9a59/lib/mongoid/sessions.rb:37:in `default'
  13. 2013-12-06T12:31:50.812324+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/bundler/gems/mongoid-f8b439dd9a59/lib/mongoid.rb:62:in `default_session'
  14. 2013-12-06T12:31:50.812324+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/bundler/gems/mongoid-f8b439dd9a59/lib/mongoid/railtie.rb:117:in `block in <class:Railtie>'
  15. 2013-12-06T12:31:50.812508+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/lazy_load_hooks.rb:36:in `call'
  16. 2013-12-06T12:31:50.812508+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook'
  17. 2013-12-06T12:31:50.812508+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/lazy_load_hooks.rb:45:in `block in run_load_hooks'
  18. 2013-12-06T12:31:50.812508+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/lazy_load_hooks.rb:44:in `each'
  19. 2013-12-06T12:31:50.812508+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/lazy_load_hooks.rb:44:in `run_load_hooks'
  20. 2013-12-06T12:31:50.812508+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/application/finisher.rb:62:in `block in <module:Finisher>'
  21. 2013-12-06T12:31:50.812508+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/initializable.rb:30:in `instance_exec'
  22. 2013-12-06T12:31:50.812508+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/initializable.rb:30:in `run'
  23. 2013-12-06T12:31:50.812508+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/initializable.rb:55:in `block in run_initializers'
  24. 2013-12-06T12:31:50.812508+00:00 app[web.1]: from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:150:in `block in tsort_each'
  25. 2013-12-06T12:31:50.812798+00:00 app[web.1]: from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:183:in `block (2 levels) in each_strongly_connected_component'
  26. 2013-12-06T12:31:50.812798+00:00 app[web.1]: from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:219:in `each_strongly_connected_component_from'
  27. 2013-12-06T12:31:50.812798+00:00 app[web.1]: from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:182:in `block in each_strongly_connected_component'
  28. 2013-12-06T12:31:50.812798+00:00 app[web.1]: from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:180:in `each'
  29. 2013-12-06T12:31:50.812798+00:00 app[web.1]: from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:180:in `each_strongly_connected_component'
  30. 2013-12-06T12:31:50.812798+00:00 app[web.1]: from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:148:in `tsort_each'
  31. 2013-12-06T12:31:50.812798+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/initializable.rb:54:in `run_initializers'
  32. 2013-12-06T12:31:50.812798+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/application.rb:215:in `initialize!'
  33. 2013-12-06T12:31:50.812798+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/railtie/configurable.rb:30:in `method_missing'
  34. 2013-12-06T12:31:50.812798+00:00 app[web.1]: from /app/config/environment.rb:5:in `<top (required)>'
  35. 2013-12-06T12:31:50.813214+00:00 app[web.1]: from config.ru:4:in `require'
  36. 2013-12-06T12:31:50.813214+00:00 app[web.1]: from config.ru:4:in `block in <main>'
  37. 2013-12-06T12:31:50.813214+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/builder.rb:55:in `instance_eval'
  38. 2013-12-06T12:31:50.813214+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/builder.rb:55:in `initialize'
  39. 2013-12-06T12:31:50.813214+00:00 app[web.1]: from config.ru:1:in `new'
  40. 2013-12-06T12:31:50.813214+00:00 app[web.1]: from config.ru:1:in `<main>'
  41. 2013-12-06T12:31:50.813214+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/unicorn-4.7.0/lib/unicorn.rb:48:in `eval'
  42. 2013-12-06T12:31:50.813214+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/unicorn-4.7.0/lib/unicorn.rb:48:in `block in builder'
  43. 2013-12-06T12:31:50.813214+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/unicorn-4.7.0/lib/unicorn/http_server.rb:750:in `call'
  44. 2013-12-06T12:31:50.813214+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/unicorn-4.7.0/lib/unicorn/http_server.rb:750:in `build_app!'
  45. 2013-12-06T12:31:50.813391+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/unicorn-4.7.0/lib/unicorn/http_server.rb:145:in `start'
  46. 2013-12-06T12:31:50.813391+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/unicorn-4.7.0/bin/unicorn:126:in `<top (required)>'
  47. 2013-12-06T12:31:50.813391+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/bin/unicorn:23:in `load'
  48. 2013-12-06T12:31:50.813391+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/bin/unicorn:23:in `<main>'
  49. 2013-12-06T12:31:52.499941+00:00 heroku[web.1]: Process exited with status 1
  50. 2013-12-06T12:31:52.522399+00:00 heroku[web.1]: State changed from starting to crashed

解决方法

根据 Heroku’s recommendation for MongoHQ configuration文件,mongoid.yml应包括以下选项:
  1. skip_version_check: true
  2. safe: true

这两个选项都从mongoid 4 gem中删除,即安全模式现在是默认的.宝石还不是最后的,但是您可以查看CHANGELOG.所以,要在Heroku上部署一个应用程序,Rails 4和mongoid 4 gem注释出选项,如下所示:

  1. staging:
  2. sessions:
  3. default:
  4. uri: <%= ENV['MONGOHQ_URL'] %>
  5. options:
  6. # skip_version_check: true
  7. # safe: true

猜你在找的Ruby相关文章