Heroku App崩溃

时间:2011-06-02 18:22:50

标签: ruby-on-rails deployment heroku

我在本地测试了我的Rails 3应用程序很多次,最后部署到了Heroku。一切都运行良好一段时间,所有页面都加载,然后我开始得到一个错误页面,说应用程序已崩溃。我检查我的日志,这是输出:

2011-06-02T18:17:18+00:00 heroku[web.1]: State changed from starting to crashed
2011-06-02T18:17:18+00:00 heroku[web.1]: State changed from crashed to created
2011-06-02T18:17:18+00:00 heroku[web.1]: State changed from created to starting
2011-06-02T18:17:23+00:00 heroku[web.1]: Starting process with command: `thin -p 45189 -e production -R /home/heroku_rack/heroku.ru start`
2011-06-02T18:17:25+00:00 app[web.1]: /app/.bundle/gems/ruby/1.8/gems/activerecord-3.0.3/lib/active_record/base.rb:1008:in `method_missing': undefined local variable or method `user_id' for #<Class:0x7fac147671c8> (NameError)
2011-06-02T18:17:25+00:00 app[web.1]:   from /app/app/models/order.rb:23
2011-06-02T18:17:25+00:00 app[web.1]:   from /app/.bundle/gems/ruby/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:in `require'
2011-06-02T18:17:25+00:00 app[web.1]:   from /app/.bundle/gems/ruby/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:in `require'
2011-06-02T18:17:25+00:00 app[web.1]:   from /app/.bundle/gems/ruby/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:227:in `load_dependency'
2011-06-02T18:17:25+00:00 app[web.1]:   from /app/.bundle/gems/ruby/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:in `require'
2011-06-02T18:17:25+00:00 app[web.1]:   from /app/.bundle/gems/ruby/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:346:in `require_or_load'
2011-06-02T18:17:25+00:00 app[web.1]:   from /app/.bundle/gems/ruby/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:300:in `depend_on'
2011-06-02T18:17:25+00:00 app[web.1]:   from /app/.bundle/gems/ruby/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:216:in `require_dependency'
2011-06-02T18:17:25+00:00 app[web.1]:   from /app/.bundle/gems/ruby/1.8/gems/railties-3.0.3/lib/rails/engine.rb:138:in `eager_load!'
2011-06-02T18:17:25+00:00 app[web.1]:   from /app/.bundle/gems/ruby/1.8/gems/railties-3.0.3/lib/rails/engine.rb:137:in `each'
2011-06-02T18:17:25+00:00 app[web.1]:   from /app/.bundle/gems/ruby/1.8/gems/railties-3.0.3/lib/rails/engine.rb:135:in `each'
2011-06-02T18:17:25+00:00 app[web.1]:   from /app/.bundle/gems/ruby/1.8/gems/railties-3.0.3/lib/rails/engine.rb:137:in `eager_load!'
2011-06-02T18:17:25+00:00 app[web.1]:   from /app/.bundle/gems/ruby/1.8/gems/railties-3.0.3/lib/rails/engine.rb:135:in `eager_load!'
2011-06-02T18:17:25+00:00 app[web.1]:   from /app/.bundle/gems/ruby/1.8/gems/railties-3.0.3/lib/rails/application.rb:108:in `eager_load!'
2011-06-02T18:17:25+00:00 app[web.1]:   from /app/.bundle/gems/ruby/1.8/gems/railties-3.0.3/lib/rails/application/finisher.rb:41
2011-06-02T18:17:25+00:00 app[web.1]:   from /app/.bundle/gems/ruby/1.8/gems/railties-3.0.3/lib/rails/initializable.rb:25:in `instance_exec'
2011-06-02T18:17:25+00:00 app[web.1]:   from /app/.bundle/gems/ruby/1.8/gems/railties-3.0.3/lib/rails/initializable.rb:25:in `run'
2011-06-02T18:17:25+00:00 app[web.1]:   from /app/.bundle/gems/ruby/1.8/gems/railties-3.0.3/lib/rails/initializable.rb:50:in `run_initializers'
2011-06-02T18:17:25+00:00 app[web.1]:   from /app/.bundle/gems/ruby/1.8/gems/railties-3.0.3/lib/rails/initializable.rb:49:in `each'
2011-06-02T18:17:25+00:00 app[web.1]:   from /app/.bundle/gems/ruby/1.8/gems/railties-3.0.3/lib/rails/initializable.rb:49:in `run_initializers'
2011-06-02T18:17:25+00:00 app[web.1]:   from /app/.bundle/gems/ruby/1.8/gems/railties-3.0.3/lib/rails/application.rb:134:in `initialize!'
2011-06-02T18:17:25+00:00 app[web.1]:   from /app/.bundle/gems/ruby/1.8/gems/railties-3.0.3/lib/rails/application.rb:77:in `send'
2011-06-02T18:17:25+00:00 app[web.1]:   from config.ru:3
2011-06-02T18:17:25+00:00 heroku[web.1]: Process exited
2011-06-02T18:17:26+00:00 heroku[web.1]: State changed from starting to crashed
2011-06-02T18:17:27+00:00 heroku[router]: Error H10 (App crashed) -> GET domainpolish.heroku.com/orders dyno=none queue=0 wait=0ms service=0ms bytes=0
2011-06-02T18:17:35+00:00 heroku[router]: Error H10 (App crashed) -> GET domainpolish.heroku.com/orders dyno=none queue=0 wait=0ms service=0ms bytes=0
2011-06-02T18:17:37+00:00 heroku[router]: Error H10 (App crashed) -> GET domainpolish.heroku.com/orders dyno=none queue=0 wait=0ms service=0ms bytes=0

有谁知道出了什么问题?提前谢谢!

1 个答案:

答案 0 :(得分:2)

看起来您在推送新代码后可能忘记了迁移。要在Heroku上迁移应用程序的数据库,请运行:

heroku rake db:migrate