简体   繁体   English

Passenger + Bundler - 未从已部署应用程序加载的 Gem

[英]Passenger + Bundler - Gems Not Loaded from Deployed App

I am trying to get a ruby app running via Phusion_Passenger (6.0.15) and Apache (2.4.54).我正在尝试通过 Phusion_Passenger (6.0.15) 和 Apache (2.4.54) 运行 ruby 应用程序。 The app is OpenProject (v12) and the system is a Raspberry PI4, but I guess this does not matter for the problem at hand.该应用程序是 OpenProject (v12),系统是 Raspberry PI4,但我想这对于手头的问题无关紧要。

When loading the app via Passenger I have the problem that gems are incorrectly loaded from the "system" gem list and not the openproject app vendor/bundle folder通过 Passenger 加载应用程序时,我遇到的问题是从“系统”gem 列表而不是 openproject app vendor/bundle 文件夹中错误地加载了 gem

  • gems installed as given in Gemfile.lock via bundle install --deployment通过bundle install --deployment --deployment 在 Gemfile.lock 中安装的 gems
  • manually confirmed that the gems are indeed all correctly available in ./vendor/bundle folder手动确认这些宝石确实在./vendor/bundle文件夹中正确可用
  • Passenger loads and reports an error loading the app乘客加载并报告加载应用程序错误
  • Looking into the errors it shows that it is incorrect versions and / or missing gems due to the fact that apparently only gems from the system wide locations (more specifically: from the user space gems that are also around) are pulled, not from vendor/bundle查看错误,它表明它是不正确的版本和/或丢失的宝石,因为显然只有来自系统范围位置的宝石(更具体地说:来自也在附近的用户空间宝石)被拉出,而不是来自vendor/bundle
  • Passenger bundler/setup seems to be working somehow but something is wrong with the load paths apparently乘客捆绑器/设置似乎以某种方式工作,但负载路径显然有问题
  • looking at "activated_gems" from the log files (Passenger friendly error pages) it shows that it is all the wrong versions, ie not from vendor/bundle;从日志文件(乘客友好的错误页面)中查看“activated_gems”,它表明它是所有错误的版本,即不是来自供应商/捆绑包; if I remove a gem from the default, it then also disappears from the "activated_gems"如果我从默认值中删除一个 gem,它也会从“activated_gems”中消失
  • user and users rights seem to be correct;用户和用户权限似乎是正确的; passenger reports the user ("openproject") under which the app should be running, vendor/bundle directories and sub-folders are owned by this user and accessible passenger 报告应用程序应在其下运行的用户(“openproject”),vendor/bundle 目录和子文件夹归该用户所有并可访问

Below are some more details from the error pages / log provided by passenger以下是乘客提供的错误页面/日志中的更多详细信息

Are there any ideas what could be wrong and causing passenger bundler to not pick up the gems from the vendor/bundle folder?有什么想法可能是错误的并导致乘客捆绑器无法从vendor/bundle文件夹中提取宝石吗?

ruby_info红宝石信息

RUBY_VERSION = 3.1.2
RUBY_PLATFORM = aarch64-linux
RUBY_ENGINE = ruby
RubyGems version = 3.3.25
RubyGems paths = ["/home/openproject/openproject/vendor/bundle/ruby/3.1.0"]

Environment Variables环境变量

USER = openproject
TEXTDOMAIN = Linux-PAM
SHLVL = 0
HOME = /home/openproject
WSGI_ENV = development
PYTHONUNBUFFERED = 1
PASSENGER_USE_FEEDBACK_FD = true
APACHE_RUN_DIR = /var/run/apache2
APACHE_PID_FILE = /var/run/apache2/apache2.pid
LOGNAME = openproject
JOURNAL_STREAM = 8:19903
SERVER_SOFTWARE = Apache/2.4.54 (Debian) Phusion_Passenger/6.0.15
RACK_ENV = development
RBENV_SHELL = bash
PATH = /home/openproject/openproject/vendor/bundle/ruby/3.1.0/bin:/home/openproject/.nodenv/shims:/home/openproject/.nodenv/bin:/home/openproject/.rbenv/shims:/home/openproject/.rbenv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games
INVOCATION_ID = fcc115b63f334260aa3d8095470cde64
APACHE_LOCK_DIR = /var/lock/apache2
LANG = C
PASSENGER_SPAWN_WORK_DIR = /tmp/passenger.spawn.XXXXA4E1WH
SHELL = /bin/bash
IN_PASSENGER = 1
NODE_PATH = /home/openproject/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/passenger-6.0.15/src/nodejs_supportlib
APACHE_RUN_GROUP = www-data
APACHE_RUN_USER = www-data
APACHE_LOG_DIR = /var/log/apache2
RAILS_ENV = development
SECRET_KEY_BASE = 1f1b879d25c6e48581ea65067c808ac965bd7598eb0bdf2ba497865e32113cbf5e5a290b59bfab62e882c03eac3ff61efb4cbc954984c422c5770ee931d0c4d0
NODENV_SHELL = bash
PWD = /home/openproject/openproject
PASSENGER_APP_ENV = development
NODE_ENV = development
BUNDLER_ORIG_BUNDLE_BIN_PATH = BUNDLER_ENVIRONMENT_PRESERVER_INTENTIONALLY_NIL
BUNDLER_ORIG_BUNDLE_GEMFILE = BUNDLER_ENVIRONMENT_PRESERVER_INTENTIONALLY_NIL
BUNDLER_ORIG_BUNDLER_VERSION = BUNDLER_ENVIRONMENT_PRESERVER_INTENTIONALLY_NIL
BUNDLER_ORIG_GEM_HOME = BUNDLER_ENVIRONMENT_PRESERVER_INTENTIONALLY_NIL
BUNDLER_ORIG_GEM_PATH = BUNDLER_ENVIRONMENT_PRESERVER_INTENTIONALLY_NIL
BUNDLER_ORIG_MANPATH = BUNDLER_ENVIRONMENT_PRESERVER_INTENTIONALLY_NIL
BUNDLER_ORIG_PATH = /home/openproject/.nodenv/shims:/home/openproject/.nodenv/bin:/home/openproject/.rbenv/shims:/home/openproject/.rbenv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games
BUNDLER_ORIG_RB_USER_INSTALL = BUNDLER_ENVIRONMENT_PRESERVER_INTENTIONALLY_NIL
BUNDLER_ORIG_RUBYLIB = BUNDLER_ENVIRONMENT_PRESERVER_INTENTIONALLY_NIL
BUNDLER_ORIG_RUBYOPT = BUNDLER_ENVIRONMENT_PRESERVER_INTENTIONALLY_NIL
GEM_PATH = 
GEM_HOME = /home/openproject/openproject/vendor/bundle/ruby/3.1.0
BUNDLE_BIN_PATH = /home/openproject/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.12/exe/bundle
BUNDLE_GEMFILE = /home/openproject/openproject/Gemfile
BUNDLER_VERSION = 2.3.12
RUBYOPT = -r/home/openproject/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.12/lib/bundler/setup
RUBYLIB = /home/openproject/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.12/lib

Ok, in the end I figured it out.好的,最后我想通了。 Probably more of a workaround.可能更多的是一种解决方法。 Also according to the documentation I have read it should not have been necessary, but anyways.另外,根据我阅读过的文档,应该没有必要,但无论如何。

Adding添加

SetEnv GEM_PATH /home/openproject/openproject/vendor/bundle/ruby/3.1.0

to /etc/apache2/sites-available/openproject.conf到 /etc/apache2/sites-available/openproject.conf

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

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