Rails应用程序在Heroku上崩溃

时间:2013-12-06 12:38:24

标签: ruby-on-rails heroku mongoid

Ruby 2 + Rails 4 + Mongoid 4应用程序完全适用于开发。但当我推送到Heroku时,应用程序崩溃了。我试过分析Heroku日志,但无法解决问题。我甚至试图禁用我认为可能是原因的宝石,但这没用。

我正在使用的其他一些宝石有android_market_apidevises3_direct_upload。请帮助!

2013-12-06T12:31:34+00:00 heroku[slug-compiler]: Slug compilation finished
2013-12-06T12:31:35.094147+00:00 heroku[web.1]: State changed from crashed to starting
2013-12-06T12:31:40.754686+00:00 heroku[web.1]: Starting process with command `bundle exec unicorn -p 3309 -c ./config/unicorn.rb`
2013-12-06T12:31:46.061981+00:00 app[web.1]: I, [2013-12-06T12:31:46.061146 #2]  INFO -- : Refreshing Gem list
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)
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'
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'
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'
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'
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'
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'
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'
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'
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>'
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'
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'
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'
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'
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'
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>'
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'
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'
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'
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'
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'
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'
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'
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'
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'
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'
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'
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!'
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'
2013-12-06T12:31:50.812798+00:00 app[web.1]:    from /app/config/environment.rb:5:in `<top (required)>'
2013-12-06T12:31:50.813214+00:00 app[web.1]:    from config.ru:4:in `require'
2013-12-06T12:31:50.813214+00:00 app[web.1]:    from config.ru:4:in `block in <main>'
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'
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'
2013-12-06T12:31:50.813214+00:00 app[web.1]:    from config.ru:1:in `new'
2013-12-06T12:31:50.813214+00:00 app[web.1]:    from config.ru:1:in `<main>'
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'
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'
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'
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!'
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'
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)>'
2013-12-06T12:31:50.813391+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/bin/unicorn:23:in `load'
2013-12-06T12:31:50.813391+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/bin/unicorn:23:in `<main>'
2013-12-06T12:31:52.499941+00:00 heroku[web.1]: Process exited with status 1
2013-12-06T12:31:52.522399+00:00 heroku[web.1]: State changed from starting to crashed

2 个答案:

答案 0 :(得分:17)

根据Heroku's recommendation for MongoHQ configuration文件mongoid.yml应包含以下选项:

skip_version_check: true
safe: true

这两个选项都从mongoid 4 gem中删除,即安全模式现在是默认模式。宝石尚未最终确定,但您可以查看CHANGELOG。因此,要使用Rails 4和mongoid 4 gem在Heroku上部署应用程序,请注释掉选项,如下所示:

staging:
  sessions:
    default:
      uri: <%= ENV['MONGOHQ_URL'] %>
      options:
        # skip_version_check: true
        # safe: true

答案 1 :(得分:1)

好吧,问题似乎是由于我使用了来自Github Master的Mongoid 4。由于我不能使用Rails 4.0.0的mongoid gem,我不得不降级到Ruby 1.9.3Rails 3.2.3

无论如何,如果你想看到的话,这是我的新Gemfile

source 'https://rubygems.org'

ruby '1.9.3'
gem 'rails', '3.2.3'

group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'
  gem 'uglifier',     '>= 1.0.3'
end

group :production do
    gem 'unicorn'
    gem 'rails_12factor'
end

gem 'jquery-rails'
gem 'therubyracer'
gem 'turbolinks'
gem 'execjs'

gem 'mongoid'
gem 'devise'

gem 'aws-sdk'
gem 's3_direct_upload'
相关问题