2013-04-23 42 views
14

我製作了一個新的Rails 4測試版應用程序,並將它部署到Heroku(使用Ruby 2.0.0,並通過Procfile使用Unicorn)。Heroku上的Rails 4應用程序是500,但日誌中沒有錯誤消息

運行良好局部與foreman start,但是當我訪問了部署應用程序的主頁,我只是得到標準的Heroku 500錯誤:

We're sorry, but something went wrong. 
If you are the application owner check the logs for more information. 

然而,在日誌中,沒有錯誤 。我不知道是什麼原因造成的500

這裏是我最後git push heroku master輸出:

Counting objects: 6, done. 
Delta compression using up to 8 threads. 
Compressing objects: 100% (4/4), done. 
Writing objects: 100% (4/4), 656 bytes, done. 
Total 4 (delta 2), reused 0 (delta 0) 

-----> Ruby/Rails app detected 
-----> Using Ruby version: ruby-2.0.0 
-----> Installing dependencies using Bundler version 1.3.2 
     Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin --deployment 
     Using rake (10.0.4) 
     Using i18n (0.6.4) 
     Using minitest (4.7.3) 
     Using multi_json (1.7.2) 
     Using atomic (1.1.8) 
     Using thread_safe (0.1.0) 
     Using tzinfo (0.3.37) 
     Using activesupport (4.0.0.beta1) 
     Using builder (3.1.4) 
     Using erubis (2.7.0) 
     Using rack (1.5.2) 
     Using rack-test (0.6.2) 
     Using actionpack (4.0.0.beta1) 
     Using mime-types (1.23) 
     Using polyglot (0.3.3) 
     Using treetop (1.4.12) 
     Using mail (2.5.3) 
     Using actionmailer (4.0.0.beta1) 
     Using activemodel (4.0.0.beta1) 
     Using activerecord-deprecated_finders (0.0.3) 
     Using arel (4.0.0) 
     Using activerecord (4.0.0.beta1) 
     Using coffee-script-source (1.6.2) 
     Using execjs (1.4.0) 
     Using coffee-script (2.2.0) 
     Using json (1.7.7) 
     Using rdoc (3.12.2) 
     Using thor (0.18.1) 
     Using railties (4.0.0.beta1) 
     Using coffee-rails (4.0.0) 
     Using hike (1.2.2) 
     Using jbuilder (1.0.2) 
     Using jquery-rails (2.2.1) 
     Using kgio (2.8.0) 
     Using mysql2 (0.3.11) 
     Using bundler (1.3.2) 
     Using tilt (1.3.7) 
     Using sprockets (2.9.3) 
     Using sprockets-rails (2.0.0.rc4) 
     Using rails (4.0.0.beta1) 
     Using raindrops (0.11.0) 
     Using sass (3.2.8) 
     Using sass-rails (4.0.0.rc1) 
     Using turbolinks (1.1.1) 
     Using uglifier (2.0.1) 
     Using unicorn (4.6.2) 
     Your bundle is complete! It was installed into ./vendor/bundle 
     Cleaning up the bundler cache. 
-----> Preparing app for Rails asset pipeline 
     Running: rake assets:precompile 
     I, [2013-04-23T22:28:44.559735 #871] INFO -- : Writing /tmp/build_33m76p0rij8a5/public/assets/rails-d8fb6a2617998f32edf5edb354fc5326.png 
     I, [2013-04-23T22:28:49.911890 #871] INFO -- : Writing /tmp/build_33m76p0rij8a5/public/assets/application-d4a508061cd56ce9e544945495285e0c.js 
     I, [2013-04-23T22:28:50.120141 #871] INFO -- : Writing /tmp/build_33m76p0rij8a5/public/assets/application-a3b89b66a8471f3e75abb239e3b35c7d.css 
     Asset precompilation completed (8.30s) 
-----> Rails plugin injection 
-----> Discovering process types 
     Procfile declares types  -> web 
     Default types for Ruby/Rails -> console, rake, worker 

-----> Compiled slug size: 35.0MB 
-----> Launching... done, v21 
     http://blofs.herokuapp.com deployed to Heroku 

To [email protected]:blofs.git 
    32e51a2..37d989c master -> master 

這裏是從推日誌:

2013-04-23T22:28:06.650049+00:00 heroku[slugc]: Slug compilation started 
2013-04-23T22:29:11.194613+00:00 heroku[api]: Release v21 created by [email protected] 
2013-04-23T22:29:11.365908+00:00 heroku[api]: Deploy 37d989c by [email protected] 
2013-04-23T22:29:11.441066+00:00 heroku[web.1]: State changed from up to starting 
2013-04-23T22:29:11.932952+00:00 heroku[slugc]: Slug compilation finished 
2013-04-23T22:29:12.858139+00:00 heroku[web.1]: Stopping all processes with SIGTERM 
2013-04-23T22:29:13.194707+00:00 app[web.1]: I, [2013-04-23T22:29:13.194495 #2] INFO -- : reaped #<Process::Status: pid 5 exit 0> worker=0 
2013-04-23T22:29:13.194902+00:00 app[web.1]: I, [2013-04-23T22:29:13.194747 #2] INFO -- : master complete 
2013-04-23T22:29:14.312014+00:00 heroku[web.1]: Process exited with status 0 
2013-04-23T22:29:14.338943+00:00 heroku[web.1]: Starting process with command `bundle exec unicorn -p 25281 -E $RACK_ENV` 
2013-04-23T22:29:15.717687+00:00 app[web.1]: I, [2013-04-23T22:29:15.717387 #2] INFO -- : listening on addr=0.0.0.0:25281 fd=7 
2013-04-23T22:29:15.717916+00:00 app[web.1]: I, [2013-04-23T22:29:15.717861 #2] INFO -- : worker=0 spawning... 
2013-04-23T22:29:15.721526+00:00 app[web.1]: I, [2013-04-23T22:29:15.721385 #2] INFO -- : master process ready 
2013-04-23T22:29:15.723623+00:00 app[web.1]: I, [2013-04-23T22:29:15.723389 #5] INFO -- : worker=0 spawned pid=5 
2013-04-23T22:29:15.723805+00:00 app[web.1]: I, [2013-04-23T22:29:15.723750 #5] INFO -- : Refreshing Gem list 
2013-04-23T22:29:16.305653+00:00 heroku[web.1]: State changed from starting to up 
2013-04-23T22:29:16.891063+00:00 app[web.1]: I, [2013-04-23T22:29:16.890882 #5] INFO -- : worker=0 ready 

之後,我試圖在瀏覽器中加載主頁,這些是日誌中出現的唯一兩條額外的行:

2013-04-23T22:29:26.685651+00:00 heroku[router]: at=info method=GET path=/ host=blofs.herokuapp.com fwd="46.65.16.44" dyno=web.1 connect=2ms service=156ms status=500 bytes=706 
2013-04-23T22:29:26.973073+00:00 heroku[router]: at=info method=GET path=/favicon.ico host=blofs.herokuapp.com fwd="46.65.16.44" dyno=web.1 connect=1ms service=5ms status=200 bytes=0 

有沒有人有任何想法可能是什麼問題?

其他的事情,可能是相關的:

  • 我已禁用標準的Heroku Postgres的插件和現在用的是MySQL的ClearDB插件代替。
  • 我試過手動更改DATABASE_URL環境變量從以前的值(即使刪除postgres插件後仍然是postgres URL)到與CLEARDB_DATABASE_URL var(mysql之一)相同的值。這似乎沒有任何區別。
  • 我已將ruby '2.0.0'添加到我的Gemfile中,並添加了mysql2unicorn寶石。我已經使用了config/unicorn.rbhttps://devcenter.heroku.com/articles/rails-unicorn
  • 我Procfile建議只包含:web: bundle exec unicorn -p $PORT -E $RACK_ENV
  • 它正常工作與當地foreman start
  • 除了上述修改之外,它基本上是一個用rails new創建的開箱即用應用程序。
+3

它看起來不像你有英雄導軌4寶石。見https://devcenter.heroku.com/articles/rails4 – 2013-04-24 04:07:44

回答

34

您需要將gem 'rails_12factor'添加到您的Gemfile中。這是一個臨時的修復從Heroku使Rails 4+與他們的服務工作。

請參閱Getting Started with Rails 4.x on HerokuGetting Started with Rails 5.x on Heroku

+1

你應該接受這個答案,因爲它很可能是解決你的問題的關鍵。 – MoMolog 2013-11-07 22:39:31

+1

確保在production.rb中更改'config.log_level =:debug'以獲取完整的調試日誌。 – 2014-06-26 07:37:04

+0

這個工作適合我!我首先添加該寶石,然後我得到了更詳細的日誌錯誤。然後我運行'heroku run rake db:migrate',之後這個應用程序正在運行! – adripanico 2015-10-18 13:06:07

1

這些答案告訴您如何打開日誌,以便您可以查找錯誤,但並沒有真正回答這個問題:'可能會出錯?

從答覆@Lauren到 this question建議

除此之外,這裏的另一種可能性 - 如果您嘗試訪問ENV不斷在生產環境中,並沒有通過heroku config:set設置,這也將導致一個很沉默的500錯誤。

相關問題