简体   繁体   中英

Apache + Passenger fails to run in a container?

I can run my application locally on my machine, but when I take the entire directory and move it into a container, it fails to run. It's a fairly simple Rails app - locally in runs using Thin, but in my Docker container it runs using Apache and Passenger. It appears Passenger is failing to start, but I cannot seem to drill any deeper than this:

[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.

My issue is that I'm not even sure what's going wrong - this log is in the apache error log, and the passenger error log (mentioned above) doesn't say anything more. It appears that Passenger is trying to write/open some log file, but which one, and where? Did the directory that it's trying to write to just not get set properly?

The answer here came from NewRelic (sadly hidden in the above thousands of lines). I ended up having to go into that line in logger.rb, manually output some values to /tmp ( ``echo "values #{filename} >> /tmp/foobar.log`` ), and saw that it was trying to write to a directory that was not writeable by the limited rights process apache was/is running in.

Would have been nice to have that output in logger.rb.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM