ruby-on-rails 乘客+捆绑商-未从部署的应用程序加载Gems

5jdjgkvh  于 2022-11-19  发布在  Ruby
关注(0)|答案(1)|浏览(151)

我试图通过Phusion_Passenger(6.0.15)和Apache(2.4.54)运行一个ruby应用程序,该应用程序是OpenProject(v12),系统是Raspberry PI 4,但我想这对手头的问题并不重要。
当通过Passenger加载应用程序时,我遇到的问题是gem错误地从“system”gem列表加载,而不是从openproject应用程序供应商/捆绑包文件夹加载

  • 通过bundle install --deployment按照Gemfile.lock中的指定安装gem
  • 手动确认gem确实都在./vendor/bundle文件夹中正确可用
  • 乘客加载并报告加载应用程序时出错
  • 查看错误,它显示它是不正确的版本和/或丢失的gem,因为事实上,显然只有gem从系统范围的位置(更具体地说:从周围的用户空间gem),而不是从vendor/bundle
  • 乘客捆绑器/设置似乎在某种程度上工作,但负载路径显然有问题
  • 查看日志文件(乘客友好错误页面)中的“activated_gems”,发现其版本均错误,即不是来自供应商/捆绑包;如果我从默认设置中删除一个gem,它也会从“activated_gems”中消失
  • 用户和用户权利似乎是正确;乘客报告应用程序应在其下运行的用户(“openproject”),供应商/捆绑包目录和子文件夹由该用户拥有并可访问

以下是乘客提供的错误页面/日志中的更多详细信息
有什么想法可能是错误的,并导致乘客捆绑器没有拿起宝石从vendor/bundle文件夹?

拼音信息

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"]

环境变量

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
polhcujo

polhcujo1#

好的,最后我想通了。可能更多的是一个变通办法。而且根据我读过的文档,它应该没有必要,但无论如何。
正在添加

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

/etc/apache2/apache2/apache2/apache2/apache2/apache2/apache2/apache2/apache2/apache2/apache2/apache2/apache2/apache2/apache2/apache2/apache2/apache2/apache2/apache2/apache2/apache2/apache2/apache2/apache2/apache2/apache2/apache2/apache2/apache2/apache2/apache2/apache2/apache2/apache2/apache2/apache2/apache2/apache2/apache2/apache2/apache2/apache2/apache2/apache2/apache2/apache2/apache2/apache2/

相关问题