Project

General

Profile

Redmine 4.2.1, Passenger, and SELinux

Added by Fletcher Johnston over 3 years ago

Hello,

Let me open by saying I'm a huge fan of Redmine. Having used a number of other, similar tools I think it's far and away the best thing going.

I'm trying to upgrade my installation, and I've been running into some issues I'm hoping someone can give me a hand with. I've been trying to get Redmine 4.2.1 running on CentOS7, with Apache2, Passenger, and SELinux and have been having a really tough time. I've tried following both these How To's, but they both appear to be somewhat out of date and neither works for me:
https://www.redmine.org/projects/redmine/wiki/Install_Redmine_346_on_Centos_75
https://redmine.org/projects/redmine/wiki/RedmineAndSELinuxOnCentOS

The main issues I'm running into is SELinux permissions/policies, but I refuse to shut it off (like most people suggest) as I feel it does a lot of good.

Here's what I've tried:

Installation as described on https://www.redmine.org/projects/redmine/wiki/Install_Redmine_346_on_Centos_75. I'm using slightly newer versions of Ruby (2.7.2) and Passenger (6.0.8) but I can actually get this to run if I disable SELinux. If I enable it, I run into all kinds of permission issues with the GEM install of Passenger since it doesn't include any SELinux policies, and the steps in the SELinux How To appear to be for a much older version of Passenger. I tried using SELinux troubleshooting tools to analyze the audit logs, but this led me down a rabbit hole of apparently conflicting policies. I also tried setting `export USE_SELINUX=yes` before running the Passenger install bin, but it didn't appear to help.

When installing the Passenger GEM I get a notice explaining that the preferred method (because of SELinux) is to use RPMs, so I followed the steps here (https://www.phusionpassenger.com/library/install/apache/install/oss/el7/) to install Passenger from an RPM. This appears to work much better, but then I get the following error from Redmine:

method `source' not defined in Gem::Specification (NameError)
  /usr/local/rvm/gems/ruby-2.7.2/gems/bundler-2.2.17/lib/bundler/rubygems_ext.rb:17:in `remove_method'
  /usr/local/rvm/gems/ruby-2.7.2/gems/bundler-2.2.17/lib/bundler/rubygems_ext.rb:17:in `<class:Specification>'
  /usr/local/rvm/gems/ruby-2.7.2/gems/bundler-2.2.17/lib/bundler/rubygems_ext.rb:14:in `<module:Gem>'
  /usr/local/rvm/gems/ruby-2.7.2/gems/bundler-2.2.17/lib/bundler/rubygems_ext.rb:13:in `<top (required)>'
  /usr/local/rvm/gems/ruby-2.7.2/gems/bundler-2.2.17/lib/bundler.rb:10:in `require_relative'
  /usr/local/rvm/gems/ruby-2.7.2/gems/bundler-2.2.17/lib/bundler.rb:10:in `<top (required)>'
  /usr/local/rvm/gems/ruby-2.7.2/gems/bundler-2.2.17/lib/bundler/setup.rb:6:in `require_relative'
  /usr/local/rvm/gems/ruby-2.7.2/gems/bundler-2.2.17/lib/bundler/setup.rb:6:in `<top (required)>'
  /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require'
  /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require'
  /usr/share/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:373:in `activate_gem'
  /usr/share/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:221:in `block in run_load_path_setup_code'
  /usr/share/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:537:in `running_bundler'
  /usr/share/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:220:in `run_load_path_setup_code'
  /usr/share/passenger/helper-scripts/rack-preloader.rb:91:in `preload_app'
  /usr/share/passenger/helper-scripts/rack-preloader.rb:189:in `block in <module:App>'
  /usr/share/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:390:in `run_block_and_record_step_progress'
  /usr/share/passenger/helper-scripts/rack-preloader.rb:188:in `<module:App>'
  /usr/share/passenger/helper-scripts/rack-preloader.rb:30:in `<module:PhusionPassenger>'
  /usr/share/passenger/helper-scripts/rack-preloader.rb:29:in `<main>'

Has anyone seen an error like this before? I'm not a Ruby export, but it looks like Redmine is unable to find certain functions relating to Passenger that it needs.

Any advice on how to install Redmine without using the Passenger GEM, and instead using the Passenger RPM?

Thanks everyone!


Replies (2)

RE: Redmine 4.2.1, Passenger, and SELinux - Added by Fletcher Johnston over 3 years ago

If it's helpful, here is the output of bin/about:

Environment:
Redmine version 4.2.1.stable
Ruby version 2.7.2-p137 (2020-10-01) [x86_64-linux]
Rails version 5.2.5
Environment production
Database adapter Mysql2
Mailer queue ActiveJob::QueueAdapters::AsyncAdapter
Mailer delivery smtp

RE: Redmine 4.2.1, Passenger, and SELinux - Added by Fletcher Johnston over 3 years ago

I was able to figure this out.
The issue was that the default install of Passenger package connects to the system version of Ruby (2.0.0 on CentOS7) and I needed to tell it to use the newer version installed by RVM.

    (1-2/2)