Rails 4/Ruby 2.0 앱에 유니콘을 설치하려고합니다. 나는 heroku here에 대한 지침을 사용하여 그것을 설치했다.Unicorn on Rails 4 설정 - 응용 프로그램 충돌
지침은 매우 간단하지만 mktdemo.herokuapp.com에 내 응용 프로그램이 충돌한다고 생각했습니다.
heroku 대시 보드에서 내 procfile을 읽는 중 유니콘이 내 서버로 표시됩니다. heroku (아래)에 표시된 unicorn.rb가 오래된 것입니까?
unicorn.rb에는 ENV [WEB_CONCURRENCY] 변수가 있습니다. yml 파일에 넣어야합니까? 나는 그것이 어디에서 읽히고 있는지에 대해 언급하지 않았다.
내 앱에 delayed_jobs가 설치되어있어 관련이 있는지 잘 모르겠습니다. 여기
#gemfile
gem 'unicorn'
#procfile
web: bundle exec unicorn -p $PORT -c ./config/unicorn.rb
worker: bundle exec rake jobs:work
#config/unicorn.rb
worker_processes Integer(ENV["WEB_CONCURRENCY"] || 3)
timeout 15
preload_app true
before_fork do |server, worker|
Signal.trap 'TERM' do
puts 'Unicorn master intercepting TERM and sending myself QUIT instead'
Process.kill 'QUIT', Process.pid
end
defined?(ActiveRecord::Base) and
ActiveRecord::Base.connection.disconnect!
end
after_fork do |server, worker|
Signal.trap 'TERM' do
puts 'Unicorn worker intercepting TERM and doing nothing. Wait for master to send QUIT'
end
defined?(ActiveRecord::Base) and
ActiveRecord::Base.establish_connection
end
# config/initializers/timeout.rb
Rack::Timeout.timeout = 10 # seconds
내 로그의 마지막 50 줄 정도이다 : 당신이
rack-timeout
보석을 추가 한 것처럼
←[36m2014-10-23T02:42:30.064512+00:00 app[web.1]:←[0m from /app/vendor/bundle/
ruby/2.0.0/gems/railties-4.0.0/lib/rails/initializable.rb:54:in `run_initializer
s'
←[36m2014-10-23T02:42:30.064346+00:00 app[web.1]:←[0m from /app/vendor/ruby-2.
0.0/lib/ruby/2.0.0/
tsort.rb:210:in `block (2 levels) in each_strongly_connected_component_from'
←[36m2014-10-23T02:42:30.064449+00:00 app[web.1]:←[0m from /app/vendor/ruby-2.
0.0/lib/ruby/2.0.0/tsort.rb:182:in `block in each_strongly_connected_component'
←[36m2014-10-23T02:42:30.064465+00:00 app[web.1]:←[0m from /app/vendor/ruby-2.
0.0/lib/ruby/2.0.0/tsort.rb:180:in `each'
←[36m2014-10-23T02:42:30.064481+00:00 app[web.1]:←[0m from /app/vendor/ruby-2.
0.0/lib/ruby/2.0.0/tsort.rb:180:in `each_strongly_connected_component'
←[36m2014-10-23T02:42:30.064558+00:00 app[web.1]:←[0m from /app/vendor/bundle/
ruby/2.0.0/gems/railties-4.0.0/lib/rails/railtie/configurable.rb:30:in `method_m
issing'
←[36m2014-10-23T02:42:30.064427+00:00 app[web.1]:←[0m from /app/vendor/ruby-2.
0.0/lib/ruby/2.0.0/tsort.rb:203:in `each_strongly_connected_component_from'
←[36m2014-10-23T02:42:30.064608+00:00 app[web.1]:←[0m from config.ru:4:in `blo
ck in <main>'
←[36m2014-10-23T02:42:30.064528+00:00 app[web.1]:←[0m from /app/vendor/bundle/
ruby/2.0.0/gems/railties-4.0.0/lib/rails/application.rb:215:in `initialize!'
←[36m2014-10-23T02:42:30.064591+00:00 app[web.1]:←[0m from config.ru:4:in `req
uire'
←[36m2014-10-23T02:42:30.064496+00:00 app[web.1]:←[0m from /app/vendor/ruby-2.
0.0/lib/ruby/2.0.0/tsort.rb:148:in `tsort_each'
←[36m2014-10-23T02:42:30.064575+00:00 app[web.1]:←[0m from /app/config/environ
ment.rb:5:in `<top (required)>'
←[36m2014-10-23T02:42:30.064877+00:00 app[web.1]:←[0m from /app/vendor/bundle/
ruby/2.0.0/gems/unicorn-4.8.3/lib/unicorn/http_server.rb:764:in `build_app!'
←[36m2014-10-23T02:42:30.064790+00:00 app[web.1]:←[0m from config.ru:1:in `new
'
←[36m2014-10-23T02:42:30.064892+00:00 app[web.1]:←[0m from /app/vendor/bundle/
ruby/2.0.0/gems/unicorn-4.8.3/lib/unicorn/http_server.rb:137:in `start'
←[36m2014-10-23T02:42:30.064767+00:00 app[web.1]:←[0m from /app/vendor/bundle/
ruby/2.0.0/gems/rack-1.5.2/lib/rack/builder.rb:55:in `initialize'
←[36m2014-10-23T02:42:30.064630+00:00 app[web.1]:←[0m from /app/vendor/bundle/
ruby/2.0.0/gems/rack-1.5.2/lib/rack/builder.rb:55:in `instance_eval'
←[36m2014-10-23T02:42:30.064924+00:00 app[web.1]:←[0m from /app/vendor/bundle/
ruby/2.0.0/gems/unicorn-4.8.3/bin/unicorn:126:in `<top (required)>'
←[36m2014-10-23T02:42:30.064940+00:00 app[web.1]:←[0m from /app/vendor/bundle/
ruby/2.0.0/bin/unicorn:23:in `load'
←[36m2014-10-23T02:42:30.064830+00:00 app[web.1]:←[0m from /app/vendor/bundle/
ruby/2.0.0/gems/unicorn-4.8.3/lib/unicorn.rb:48:in `eval'
←[36m2014-10-23T02:42:30.064861+00:00 app[web.1]:←[0m from /app/vendor/bundle/
ruby/2.0.0/gems/unicorn-4.8.3/lib/unicorn/http_server.rb:764:in `call'
←[36m2014-10-23T02:42:30.064956+00:00 app[web.1]:←[0m from /app/vendor/bundle/
ruby/2.0.0/bin/unicorn:23:in `<main>'
←[36m2014-10-23T02:42:30.064814+00:00 app[web.1]:←[0m from config.ru:1:in `<ma
in>'
←[36m2014-10-23T02:42:30.064846+00:00 app[web.1]:←[0m from /app/vendor/bundle/
ruby/2.0.0/gems/unicorn-4.8.3/lib/unicorn.rb:48:in `block in builder'
←[36m2014-10-23T02:42:30.897477+00:00 heroku[web.1]:←[0m State changed from star
ting to crashed
←[36m2014-10-23T02:42:30.888021+00:00 heroku[web.1]:←[0m Process exited with sta
tus 1
←[33m2014-10-23T02:44:47.509030+00:00 heroku[router]:←[0m at=error code=H10 desc
="App crashed" method=GET path="/" host=mktdemo.herokuapp.com request_id=6472e28
f-4ba3-4eed-aa0d-8089c0ddcec4 fwd="67.180.31.102" dyno= connect= service= status
=503 bytes=
←[33m2014-10-23T02:51:07.861451+00:00 heroku[router]:←[0m at=error code=H10 desc
="App crashed" method=GET path="/" host=mktdemo.herokuapp.com request_id=c792113
3-fdbd-4614-8425-c90115aa2251 fwd="74.86.158.106" dyno= connect= service= status
=503 bytes=
←[33m2014-10-23T03:05:42.246318+00:00 heroku[router]:←[0m at=error code=H10 desc
="App crashed" method=GET path="/favicon.ico" host=mktdemo.herokuapp.com request
_id=ca8a9d59-9764-4f1c-8b8d-15845c73146e fwd="67.180.31.102" dyno= connect= serv
ice= status=503 bytes=
←[33m2014-10-23T03:05:41.930425+00:00 heroku[router]:←[0m at=error code=H10 desc
="App crashed" method=GET path="/" host=mktdemo.herokuapp.com request_id=dd9b869
8-57c5-4465-810e-f55de098df5e fwd="67.180.31.102" dyno= connect= service= status
=503 bytes=
감사합니다. 그러나, 나의 로컬 호스트는 여전히 초기화되지 않은 타임 아웃 변수로 인해 충돌합니다. ifput 문을 timeput.rb에 두어 프로덕션에만 적용 가능함을 나타내는 방법은 무엇입니까? – Moosa
'Rails.env.production? '으로 타임 아웃을 조건부로 만들 수 있습니다. – infused