简体   繁体   English

docker apache passenger:错误无法加载此类文件捆绑程序/安装程序(LoadError)

[英]docker apache passenger: error cannot load such file bundler/setup (LoadError)

I'm trying to build a docker-image with running apache (+passenger), rails and shibboleth. 我正在尝试使用运行的Apache(+ passenger),rails和shibboleth构建一个docker-image。

Unfortunately I can't get apache + passenger running ... I appreciate every hint! 不幸的是,我无法让apache +乘客奔跑。 Maybe it is a permission problem? 也许是权限问题? Everything was installed as root, but obviously some processes are running as nobody (as shown in the error log). 一切都以root身份安装,但是显然某些进程没有任何人运行(如错误日志中所示)。

My docker base-image is "ruby:2.0.0" (debian 8). 我的docker基本映像是“ ruby​​:2.0.0”(debian 8)。 In this image I installed apache2, apache2-threaded-dev, libapr1-dev, libaprutil1-dev via apt-get and passenger via 'gem install passenger -v 4.0.59'. 在此映像中,我通过apt-get安装了apache2,apache2-threaded-dev,libapr1-dev,libaprutil1-dev,并通过“ gem install passenger -v 4.0.59”安装了passenger。 After this I used passenger-install-apache2-module to install the module. 之后,我使用了passenger-install-apache2-module来安装模块。

Here is the error log: 这是错误日志:

cannot load such file -- bundler/setup (LoadError)
  /usr/local/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
  /usr/local/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
  /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:411:in `activate_gem'
  /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:295:in `block in run_load_path_setup_code'
  /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:416:in `running_bundler'
  /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:294:in `run_load_path_setup_code'
  /usr/share/passenger/helper-scripts/rack-preloader.rb:99: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>'

Environment (value of RAILS_ENV, RACK_ENV, WSGI_ENV, NODE_ENV and PASSENGER_APP_ENV)
  development

Ruby interpreter command
  /usr/local/bin/ruby

User and groups
  uid=65534(nobody) gid=65534(nogroup) groups=65534(nogroup)

Apache passenger.load: Apache passenger.load:

LoadModule passenger_module /usr/local/bundle/gems/passenger-4.0.59/buildout/apache2/mod_passenger.so

Apache passenger.conf: Apache passenger.conf:

IfModule mod_passenger.c>
  PassengerRoot /usr/local/bundle/gems/passenger-4.0.59
  PassengerDefaultRuby /usr/local/bin/ruby
</IfModule>

And myapp.conf: 和myapp.conf:

<VirtualHost *:80>
#ServerName yourserver.com

# Tell Apache and Passenger where your app's 'public' directory is
DocumentRoot /var/www/myapp/public

PassengerRuby /usr/local/bin/ruby
RailsEnv development

# Relax Apache security settings
<Directory /var/www/myapp/public>
  Allow from all
  Options -MultiViews
  # Uncomment this if you're on Apache >= 2.4:
  Require all granted
</Directory>

Installed versions: 安装版本:

apache2 -v
Server version: Apache/2.4.10 (Debian)

ruby -v      
ruby 2.0.0p645 (2015-04-13 revision 50299)

gem -v
2.0.14

rails -v
Rails 4.0.5

passenger-config validate-install says "Everything looks good". passenger-config validate-install表示“一切都很好”。 And 'passenger-status': 和“乘客状态”:

Version : 4.0.59                                                               
Date    : 2015-10-13 09:03:32 +0000                                            
Instance: 5578                                                                 
----------- General information -----------                                    
Max pool size : 6                                                              
Processes     : 0                                                              
Requests in top-level queue : 0                                                

----------- Application groups -----------                                     
/var/www/myapp#default:                                                        
  App root: /var/www/myapp                                                     
  Requests in queue: 0 

passenger-memory-stats: 乘客内存统计:

Version: 4.0.59                                                             
Date   : 2015-10-13 09:05:31 +0000                                          

--------- Apache processes ---------                                        
PID   PPID  VMSize    Private  Name                                         
------------------------------------                                        
5578  1     83.2 MB   ?        /usr/sbin/apache2 -k start                   
5599  5578  363.5 MB  ?        /usr/sbin/apache2 -k start                   
5600  5578  491.5 MB  ?        /usr/sbin/apache2 -k start                   
### Processes: 3                                                            
### Total private dirty RSS: 0.00 MB (?)                                    


-------- Nginx processes --------                                           

### Processes: 0                                                            
### Total private dirty RSS: 0.00 MB                                        


---- Passenger processes -----                                              
PID   VMSize    Private  Name                                               
------------------------------                                              
5581  218.3 MB  ?        PassengerWatchdog                                  
5584  564.5 MB  ?        PassengerHelperAgent                               
5590  217.8 MB  ?        PassengerLoggingAgent                              
### Processes: 3                                                            
### Total private dirty RSS: 0.00 MB (?)

All running processes: 所有正在运行的进程:

ps aux                                                                      
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND       
root         1  0.0  0.0  20300  1780 ?        Ss   08:47   0:00 bash          
root      6077  0.0  0.0  85160  3208 ?        Ss   09:11   0:00 /usr/sbin/apache2 -k start
root      6080  0.0  0.0 223500  2044 ?        Ssl  09:11   0:00 PassengerWatchdog
root      6083  0.0  0.0 578092  5556 ?        Sl   09:11   0:00 PassengerHelperAgent
nobody    6089  0.0  0.0 223028  5008 ?        Sl   09:11   0:00 PassengerLoggingAgent
www-data  6098  0.0  0.0 437788  5452 ?        Sl   09:11   0:00 /usr/sbin/apache2 -k start
www-data  6099  0.0  0.0 437780  5300 ?        Sl   09:11   0:00 /usr/sbin/apache2 -k start

EDIT After 2 days searching and trying I found a solution (right after I post here my question ...): 编辑经过两天的搜索和尝试,我找到了一个解决方案(在我将问题发布到这里之后...):

I have to put this into my apache virtual host configuration of my app: 我必须将其放入我的应用程序的apache虚拟主机配置中:

SetEnv GEM_HOME /usr/local/bundle

This solution was postet on https://stackoverflow.com/a/19099768/4846489 此解决方案发布在https://stackoverflow.com/a/19099768/4846489

I don't know why this is necessary, because I don't have a previous installation (as stated there). 我不知道为什么需要这样做,因为我没有以前的安装(如此处所述)。 This is really strange, because this environment variable is already there if I login into my docker container (docker exec -u nobody)... 这真的很奇怪,因为如果我登录到Docker容器(docker exec -u nobody),此环境变量已经存在...

Setting GEM_HOME just patches over the real problem. 设置GEM_HOME只是解决实际问题。 This information here is your hint: 此信息是您的提示:

User and groups:
id=65534(nobody) gid=65534(nogroup) groups=65534(nogroup)

Passenger is trying to run your app as the user 'nobody'. 乘客试图以“ nobody”用户身份运行您的应用。 Most likely, this is not what you meant it to do. 最有可能的是,这不是您要执行的操作。 Your gem bundle is probably installed by a different user, and the 'nobody' user probably does not have access to that installed gem bundle. 您的gem bundle可能是由其他用户安装的,“ nobody”用户可能无权访问该已安装的gem bundle。

Why is Passenger running your app as 'nobody'? 乘客为何以“没人”身份运行您的应用程序? Because of user sandboxing rules , most likely caused by wrong permissions on your app. 由于用户沙箱规则 ,很可能是由于您的应用程序权限错误引起的。 You should fix that. 你应该解决这个问题。

By the way, why are you building your own Docker image? 顺便说一句,为什么要构建自己的Docker映像? Phusion provides its own passenger-docker base image. Phusion提供了自己的乘客-码头工人基本图像。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法加载此类文件 - bundler / setup(loaderror) - Passenger / Apache2 - Cannot load such file — bundler/setup (loaderror) - Passenger / Apache2 Apache / Passenger-无法加载此类文件-捆绑程序/安装程序(LoadError) - Apache/Passenger - cannot load such file — bundler/setup (LoadError) 使用nginx的乘客:无法加载此类文件 - bundler / setup(LoadError) - Passenger with nginx: cannot load such file — bundler/setup (LoadError) Debian Passenger错误:无法加载此类文件-捆绑软件(LoadError) - Debian Passenger error: cannot load such file — bundler (LoadError) Ruby on Rails:错误“require”:无法加载此类文件——bundler/setup (LoadError) - Ruby on Rails: Error `require': cannot load such file -- bundler/setup (LoadError) `require&#39;:无法加载此类文件-捆绑程序/安装程序(LoadError) - `require': cannot load such file — bundler/setup (LoadError) LoadError:无法加载此类文件—捆绑程序/设置capistrano - LoadError: cannot load such file — bundler/setup capistrano 加载错误:无法加载此类文件 -- 捆绑程序/设置 - LoadError: cannot load such file -- bundler/setup 在全新安装的Nginx / Passenger上运行Rails应用程序会导致错误“没有此类文件可加载-捆绑程序/安装程序(LoadError)” - running a Rails app on a fresh installation of Nginx/Passenger causes error “no such file to load — bundler/setup (LoadError)” Passenger RVM错误:无法加载此类文件 - bundler / setup - Passenger RVM Error: cannot load such file — bundler/setup
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM