0

我可以在我的机器上本地运行我的应用程序,但是当我将整个目录移动到容器中时,它无法运行。这是一个相当简单的 Rails 应用程序 - 在本地使用 Thin 运行,但在我的 Docker 容器中它使用 Apache 和Passenger 运行。似乎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 错误日志中,而乘客错误日志(上面提到的)没有再说什么。似乎乘客正在尝试写入/打开一些日志文件,但是是哪一个,在哪里?它试图写入的目录是否设置不正确?

4

1 回答 1

1

这里的答案来自NewRelic(遗憾地隐藏在上面的数千行中)。我最终不得不进入 logger.rb 中的那一行,手动将一些值输出到 /tmp ( ``echo "values #{filename} >> /tmp/foobar.log``),并看到它正在尝试写入一个无法被 apache 正在/正在运行的受限权限进程写入的目录.

如果在 logger.rb 中有该输出,那就太好了。

于 2015-10-05T00:48:06.140 回答