Heroku-forward为我们的应用程序工作精美!唯一的问题是当重新启动app / dynos时,我们在日志中看到了这个错误:
2013-06-09T22:21:19.293142+00:00 heroku[web.1]: Starting process with command `bundle exec unicorn -p 41124 -c ./config/unicorn.rb`
2013-06-09T22:21:19.831067+00:00 app[web.1]: Unicorn master intercepting TERM and sending myself QUIT instead
2013-06-09T22:21:19.839532+00:00 app[web.1]: Terminating ProxyServer
2013-06-09T22:21:19.841418+00:00 app[web.1]: Unicorn worker intercepting TERM and doing nothing. Wait for master to sent QUIT
2013-06-09T22:21:19.876112+00:00 app[web.1]: Unicorn worker intercepting TERM and doing nothing. Wait for master to sent QUIT
2013-06-09T22:21:19.951354+00:00 app[web.1]: /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/builder.rb:129:in `to_app': missing run or map statement (RuntimeError)
2013-06-09T22:21:19.951354+00:00 app[web.1]: from config.ru:1:in `<main>'
2013-06-09T22:21:19.951354+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/unicorn-4.6.2/lib/unicorn.rb:44:in `eval'
2013-06-09T22:21:19.951354+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/unicorn-4.6.2/lib/unicorn.rb:44:in `block in builder'
2013-06-09T22:21:19.951354+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/unicorn-4.6.2/lib/unicorn/http_server.rb:722:in `call'
2013-06-09T22:21:19.951354+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/unicorn-4.6.2/lib/unicorn/http_server.rb:722:in `build_app!'
2013-06-09T22:21:19.951354+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/unicorn-4.6.2/lib/unicorn/http_server.rb:140:in `start'
2013-06-09T22:21:19.951354+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/unicorn-4.6.2/bin/unicorn:126:in `<top (required)>'
2013-06-09T22:21:19.951354+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/bin/unicorn:19:in `load'
2013-06-09T22:21:19.951354+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/bin/unicorn:19:in `<main>'
2013-06-09T22:21:22.853675+00:00 app[web.1]: I, [2013-06-09T22:21:22.853347 #2] INFO -- : Refreshing Gem list
2013-06-09T22:21:23.509927+00:00 heroku[web.1]: State changed from starting to up
2013-06-09T22:21:23.881194+00:00 heroku[web.1]: Process exited with status 1
2013-06-09T22:22:38.222124+00:00 app[web.1]: I, [2013-06-09T22:22:38.221884 #5] INFO -- : listening on addr=/tmp/unicorn-20130609-2-130wmqw.sock fd=8
2013-06-09T22:22:38.301586+00:00 app[web.1]: I, [2013-06-09T22:22:38.301333 #5] INFO -- : master process ready
2013-06-09T22:22:38.718708+00:00 app[web.1]: I, [2013-06-09T22:22:38.718418 #13] INFO -- : worker=2 ready
2013-06-09T22:22:38.795721+00:00 app[web.1]: I, [2013-06-09T22:22:38.795417 #7] INFO -- : worker=0 ready
2013-06-09T22:22:38.813390+00:00 app[web.1]: I, [2013-06-09T22:22:38.813064 #10] INFO -- : worker=1 ready
它似乎并不是灾难性的 - 正如你最后看到的那样,dyno确实很快就开始了,代理确实工作得很好(大约一分钟之后......很多宝石加载)。错误消息只是有点令人担忧。有人见过这个吗?
更新
根据Heroku-forward自述文件,这是我们的机架文件:
# my_app.ru
require ::File.expand_path('../config/environment', __FILE__)
run MyApp::Application
和
# config.ru
require 'rubygems'
require 'bundler'
$stdout.sync = true
Bundler.require(:rack)
port = (ARGV.first || ENV['PORT'] || 3000).to_i
env = ENV['RACK_ENV'] || 'development'
require 'em-proxy'
require 'logger'
require 'heroku-forward'
require 'heroku/forward/backends/unicorn'
application = File.expand_path('../my_app.ru', __FILE__)
config_file = File.expand_path('../config/unicorn.rb', __FILE__)
backend = Heroku::Forward::Backends::Unicorn.new(application: application, env: env, config_file: config_file)
proxy = Heroku::Forward::Proxy::Server.new(backend, host: '0.0.0.0', port: port)
proxy.forward!
答案 0 :(得分:0)
这个问题可能不会在新dyno的启动中发生:它更有可能在关闭旧的dyno时。当Rack配置文件没有实际运行应用程序时,会发现类似的问题(config.ru
应以to_app
调用结束)。您使用的是自定义config.ru
文件吗?