I am trying to get a ruby app running via Phusion_Passenger (6.0.15) and Apache (2.4.54). The app is OpenProject (v12) and the system is a Raspberry PI4, but I guess this does not matter for the problem at hand.
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
bundle install --deployment
./vendor/bundle
foldervendor/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?
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
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.