Apache + Passenger无法在容器中运行?

时间:2015-10-04 22:50:32

标签: ruby-on-rails apache passenger phusion

我可以在我的机器上本地运行我的应用程序,但是当我将整个目录移动到容器中时,它无法运行。这是一个相当简单的Rails应用程序 - 在本地运行时使用Thin,但在我的Docker容器中它使用Apache和Passenger运行。似乎乘客未能开始,但我似乎无法深入钻探:

[Sun Oct 04 22:40:45.140406 2015] [mpm_event:notice] [pid 6:tid 140105055864704] AH00489: Apache/2.4.7 (Ubuntu) Phusion_Passenger/5.0.20 configured -- resuming normal operations
[Sun Oct 04 22:40:45.140440 2015] [core:notice] [pid 6:tid 140105055864704] AH00094: Command line: '/usr/sbin/apache2 -D FOREGROUND'
App 515 stdout:
App 515 stdout:
[ 2015-10-04 22:41:50.7810 414/7fe8f826e700 age/Cor/App/Implementation.cpp:303 ]: Could not spawn process for application /home/hark/production/current: An error occured while starting up the preloader.
  Error ID: e7621c04
  Error details saved to: /tmp/passenger-error-RBzpxa.html
  Message from application: stack level too deep (SystemStackError)
  /usr/lib/ruby/2.2.0/open-uri.rb:29:in `respond_to?'
  /usr/lib/ruby/2.2.0/open-uri.rb:29:in `open'
  /usr/lib/ruby/2.2.0/logger.rb:628:in `open_logfile'
  /usr/lib/ruby/2.2.0/logger.rb:643:in `rescue in create_logfile'

  [... Many thousands of lines ...]

  /var/lib/gems/2.2.0/gems/railties-3.2.22/lib/rails/initializable.rb:55:in `block in run_initializers'
  /var/lib/gems/2.2.0/gems/railties-3.2.22/lib/rails/initializable.rb:54:in `each'
  /var/lib/gems/2.2.0/gems/railties-3.2.22/lib/rails/initializable.rb:54:in `run_initializers'
  /var/lib/gems/2.2.0/gems/railties-3.2.22/lib/rails/application.rb:136:in `initialize!'
  /var/lib/gems/2.2.0/gems/railties-3.2.22/lib/rails/railtie/configurable.rb:30:in `method_missing'
  /home/app/current/config/environment.rb:5:in `<top (required)>'
  /home/app/current/config.ru:3:in `require'
  /home/app/current/config.ru:3:in `block in <main>'
  /var/lib/gems/2.2.0/gems/rack-1.4.7/lib/rack/builder.rb:51:in `instance_eval'
  /var/lib/gems/2.2.0/gems/rack-1.4.7/lib/rack/builder.rb:51:in `initialize'
  /home/app/current/config.ru:1:in `new'
  /home/app/current/config.ru:1:in `<main>'
  /usr/share/passenger/helper-scripts/rack-preloader.rb:107:in `eval'
  /usr/share/passenger/helper-scripts/rack-preloader.rb:107:in `preload_app'
  /usr/share/passenger/helper-scripts/rack-preloader.rb:153:in `<module:App>'
  /usr/share/passenger/helper-scripts/rack-preloader.rb:29:in `<module:PhusionPassenger>'
  /usr/share/passenger/helper-scripts/rack-preloader.rb:28:in `<main>'


[ 2015-10-04 22:41:50.7904 414/7fe8faefc700 age/Cor/Req/CheckoutSession.cpp:252 ]: [Client 1-1] Cannot checkout session because a spawning error occurred. The identifier of the error is e7621c04. Please see earlier logs for details about the error.

我的问题是我甚至不确定出现了什么问题 - 这个日志是在apache错误日志中,乘客错误日志(如上所述)没有更多说明。看来Passenger正在尝试编写/打开一些日志文件,但哪一个,哪个?它试图写入的目录是否未正确设置?

1 个答案:

答案 0 :(得分:1)

这里的答案来自NewRelic(遗忘在上面几千行中)。我最终不得不在logger.rb中进入该行,手动输出一些值到/ tmp(``echo "values #{filename} >> /tmp/foobar.log``),并看到它试图写入一个无法通过有限权限进程apache写入的目录正在/正在运行。

将这个输出放在logger.rb中会很好。