ruby:redmine

Redmine

Redmine 4.2.1
本家: Redmine.JP - プロジェクト管理ソフトウェアRedmine 日本語情報サイト
ソースコード: Redmine - Subversion リポジトリ

Redmine (レッドマイン) は Web ベースのプロジェクト管理ソフトウェアである。設計はTracに影響を受けている。課題管理、ガントチャート、リポジトリブラウザ、Wiki、フォーラムなど、プロジェクトの運営を支援するためのさまざまな機能を備えている。Ruby on Rails で開発されている。
Redmine - Wikipedia より

Redmine のインストール

Redmine に対応する Ruby バージョンを調べる。

$ cd redmine-4.2.1
$ grep -E "ruby .*'$" Gemfile

ruby '>= 2.4.0', '< 2.8.0'

anyenv の rbenv で Redmine に対応するバージョンの Ruby をインストールする。

$ rbenv install --list | column -x -c 128
Only latest stable releases for each Ruby implementation are shown.
Use 'rbenv install --list-all / -L' to show all local versions.
2.6.8                       2.7.4                       3.0.2                       jruby-9.2.19.0
mruby-3.0.0                 rbx-5.0                     truffleruby-21.2.0          truffleruby+graalvm-21.2.0
$ rbenv install 2.7.4
Downloading ruby-2.7.4.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.7/ruby-2.7.4.tar.bz2
Installing ruby-2.7.4...
Installed ruby-2.7.4 to /home/redmine/.anyenv/envs/rbenv/versions/2.7.4

.ruby-version を生成してプロジェクトの Ruby バージョンを設定する。

$ rbenv local 2.7.4
$ ruby -v
ruby 2.7.4p191 (2021-07-07 revision a21a3b7d23) [x86_64-linux]

Bundlerをインストールする。

$ gem install bundler
Fetching bundler-2.2.24.gem
Successfully installed bundler-2.2.24
Parsing documentation for bundler-2.2.24
Installing ri documentation for bundler-2.2.24
Done installing documentation for bundler after 2 seconds
1 gem installed

Redmine を実行するために必要なすべての gem をインストールする。

$ bundle config set path 'vendor/bundle'
$ bundle config set without 'development test'
$ bundle config

Settings are listed in order of priority. The top value will be used.
path
Set for the current user (/home/redmine/.bundle/config): "vendor/bundle"

without
Set for the current user (/home/redmine/.bundle/config): [:development, :test]

Bundler を実行する。

$ bundle install

Fetching gem metadata from https://rubygems.org/
Fetching gem metadata from https://rubygems.org/............
Fetching gem metadata from https://rubygems.org/............
Fetching rake 13.0.6
Installing rake 13.0.6
Fetching concurrent-ruby 1.1.9
Fetching minitest 5.14.4
Installing minitest 5.14.4
Fetching thread_safe 0.3.6
Installing concurrent-ruby 1.1.9
Installing thread_safe 0.3.6
Fetching builder 3.2.4
Fetching erubi 1.10.0
Installing builder 3.2.4
Installing erubi 1.10.0
Fetching racc 1.5.2
Fetching crass 1.0.6
Installing crass 1.0.6
Fetching rack 2.2.3
Installing rack 2.2.3
Installing racc 1.5.2 with native extensions
Fetching nio4r 2.5.7
Installing nio4r 2.5.7 with native extensions
Fetching websocket-extensions 0.1.5
Fetching mini_mime 1.0.3
Installing websocket-extensions 0.1.5
Fetching method_source 1.0.0
Installing mini_mime 1.0.3
Fetching thor 1.1.0
Installing method_source 1.0.0
Fetching arel 9.0.0
Installing thor 1.1.0
Installing arel 9.0.0
Fetching marcel 1.0.1
Fetching public_suffix 4.0.6
Installing marcel 1.0.1
Using bundler 2.2.24
Fetching chunky_png 1.4.0
Installing public_suffix 4.0.6
Fetching csv 3.1.9
Installing chunky_png 1.4.0
Installing csv 3.1.9
Fetching htmlentities 4.3.4
Installing htmlentities 4.3.4
Fetching mini_magick 4.11.0
Fetching net-ldap 0.17.0
Installing mini_magick 4.11.0
Fetching pg 1.2.3
Installing net-ldap 0.17.0
Fetching ruby-openid 2.9.2
Installing pg 1.2.3 with native extensions
Installing ruby-openid 2.9.2
Fetching rbpdf-font 1.19.1
Fetching redcarpet 3.5.1
Installing redcarpet 3.5.1 with native extensions
Installing rbpdf-font 1.19.1
Fetching rotp 6.2.0
Fetching rouge 3.26.0
Installing rotp 6.2.0
Fetching rqrcode_core 1.1.0
Installing rqrcode_core 1.1.0
Fetching rubyzip 2.3.2
Installing rubyzip 2.3.2
Fetching tzinfo 1.2.9
Installing tzinfo 1.2.9
Fetching i18n 1.8.10
Installing i18n 1.8.10
Fetching rack-test 1.1.0
Installing rack-test 1.1.0
Fetching sprockets 4.0.2
Installing rouge 3.26.0
Installing sprockets 4.0.2
Fetching request_store 1.5.0
Installing request_store 1.5.0
Fetching nokogiri 1.11.7 (x86_64-linux)
Fetching websocket-driver 0.7.5
Installing websocket-driver 0.7.5 with native extensions
Fetching mail 2.7.1
Installing nokogiri 1.11.7 (x86_64-linux)
Installing mail 2.7.1
Fetching addressable 2.8.0
Fetching rack-openid 1.4.2
Installing addressable 2.8.0
Fetching rbpdf 1.20.1
Installing rack-openid 1.4.2
Fetching rqrcode 2.0.0
Installing rbpdf 1.20.1
Fetching activesupport 5.2.5
Installing rqrcode 2.0.0
Fetching loofah 2.10.0
Installing loofah 2.10.0
Fetching css_parser 1.9.0
Installing activesupport 5.2.5
Installing css_parser 1.9.0
Fetching rails-html-sanitizer 1.3.0
Installing rails-html-sanitizer 1.3.0
Fetching roadie 4.0.0
Fetching rails-dom-testing 2.0.3
Installing rails-dom-testing 2.0.3
Installing roadie 4.0.0
Fetching globalid 0.4.2
Fetching activemodel 5.2.5
Installing globalid 0.4.2
Fetching actionview 5.2.5
Installing activemodel 5.2.5
Fetching activejob 5.2.5
Installing actionview 5.2.5
Installing activejob 5.2.5
Fetching activerecord 5.2.5
Fetching actionpack 5.2.5
Installing actionpack 5.2.5
Installing activerecord 5.2.5
Fetching actioncable 5.2.5
Fetching actionmailer 5.2.5
Installing actioncable 5.2.5
Fetching railties 5.2.5
Installing actionmailer 5.2.5
Fetching sprockets-rails 3.2.2
Installing sprockets-rails 3.2.2
Fetching activestorage 5.2.5
Installing railties 5.2.5
Installing activestorage 5.2.5
Fetching actionpack-xml_parser 2.0.1
Fetching rails 5.2.5
Installing rails 5.2.5
Installing actionpack-xml_parser 2.0.1
Fetching roadie-rails 2.2.0
Installing roadie-rails 2.2.0
Bundle complete! 36 Gemfile dependencies, 63 gems now installed.
Gems in the groups 'development', 'test' and 'mysql2' were not installed.
Bundled gems are installed into `./vendor/bundle`
Post-install message from rubyzip:
RubyZip 3.0 is coming!
**********************

The public API of some Rubyzip classes has been modernized to use named
parameters for optional arguments. Please check your usage of the
following classes:
  * `Zip::File`
  * `Zip::Entry`
  * `Zip::InputStream`
  * `Zip::OutputStream`

Please ensure that your Gemfiles and .gemspecs are suitably restrictive
to avoid an unexpected breakage when 3.0 is released (e.g. ~> 2.3.0).
See https://github.com/rubyzip/rubyzip for details. The Changelog also
lists other enhancements and bugfixes that have been implemented since
version 2.3.0.

Rails はセッションハイジャックを防ぐために、セッション情報を格納する cookie をエンコードする。
この処理で使われるランダムなキーを生成する。

$ bundle exec rake generate_secret_token

データベース上に Redmine テーブルを作成する。

$ RAILS_ENV=production bundle exec rake db:migrate
== 1 Setup: migrating =========================================================
-- adapter_name()
   -> 0.0000s
〜省略〜
== 20180923091603 ChangeSqliteBooleansDefault: migrating ======================
== 20180923091603 ChangeSqliteBooleansDefault: migrated (0.0000s) =============

デフォルトデータをデータベースに登録する。

$ RAILS_ENV=production REDMINE_LANG=ja bundle exec rake redmine:load_default_data
Default configuration data loaded.
$ sudo mkdir /var/www/vhosts/redmine.tomoyan.net
$ sudo mv /home/redmine/redmine-4.0.1 /var/www/vhosts/redmine.tomoyan.net/redmine
$ sudo chown redmine.redmine /var/www/vhosts/redmine.tomoyan.net/redmine -R

※ Passenger は config/environment.rb ファイルのオーナーでアプリを実行する。

※Puma か Passenger の何れかをインストール

$ su - redmine
$ cd /var/www/vhosts/redmine.tomoyan.net/redmine

設定ファイルの作成

$ nano config/puma.rb
config/puma.rb
app_root = '/var/www/vhosts/redmine.tomoyan.net/redmine'
directory app_root
environment 'production'
pidfile "#{app_root}/tmp/pids/puma.pid"
state_path "#{app_root}/tmp/pids/puma.state"
bind "unix:#{app_root}/tmp/sockets/redmine.socket"
activate_control_app

pids ディレクトリを準備する

$ mkdir /var/www/vhosts/redmine.tomoyan.net/redmine/tmp/pids

redmine の Gemfile ファイルに puma を追記

$ nano Gemfile
Gemfile
source 'https://rubygems.org'
 
ruby '>= 2.4.0', '< 2.8.0'
gem 'bundler', '>= 1.12.0'
 
gem 'rails', '5.2.5'
gem 'sprockets', '~> 3.7.2' if RUBY_VERSION < '2.5'
gem 'rouge', '~> 3.26.0'
gem 'request_store', '~> 1.5.0'
gem "mini_mime", "~> 1.0.1"
gem "actionpack-xml_parser"
gem 'roadie-rails', (RUBY_VERSION < '2.5' ? '~> 1.3.0' : '~> 2.2.0')
gem 'marcel'
gem "mail", "~> 2.7.1"
gem 'csv', (RUBY_VERSION < '2.5' ? ['>= 3.1.1', '<= 3.1.5'] : '~> 3.1.1')
gem 'nokogiri', (RUBY_VERSION < '2.5' ? '~> 1.10.0' : '~> 1.11.1')
gem 'i18n', '~> 1.8.2'
gem "rbpdf", "~> 1.20.0"
gem 'addressable'
gem 'rubyzip', '~> 2.3.0'
gem 'puma' # <- 追記
 
...
$ bundle install
Your Gemfile lists the gem puma (>= 0) more than once.
You should probably keep only one of them.
Remove any duplicate entries and specify the gem only once.
While it's not a problem now, it could cause errors if you change the version of one of them later.
Fetching gem metadata from https://rubygems.org/
Fetching gem metadata from https://rubygems.org/..........
Fetching gem metadata from https://rubygems.org/..........
Using rake 13.0.6
Using concurrent-ruby 1.1.9
Using thread_safe 0.3.6
Using builder 3.2.4
Using minitest 5.14.4
Using erubi 1.10.0
Using racc 1.5.2
Using rack 2.2.3
Using nio4r 2.5.7
Using websocket-extensions 0.1.5
Using mini_mime 1.0.3
Using method_source 1.0.0
Using thor 1.1.0
Using arel 9.0.0
Using marcel 1.0.1
Using public_suffix 4.0.6
Using bundler 2.2.24
Using chunky_png 1.4.0
Using csv 3.1.9
Using htmlentities 4.3.4
Using mini_magick 4.11.0
Using net-ldap 0.17.0
Using pg 1.2.3
Using ruby-openid 2.9.2
Using rbpdf-font 1.19.1
Using redcarpet 3.5.1
Using rotp 6.2.0
Using rouge 3.26.0
Using rqrcode_core 1.1.0
Using rubyzip 2.3.2
Using i18n 1.8.10
Using tzinfo 1.2.9
Using nokogiri 1.11.7 (x86_64-linux)
Using rack-test 1.1.0
Using crass 1.0.6
Using sprockets 4.0.2
Using request_store 1.5.0
Using websocket-driver 0.7.5
Using mail 2.7.1
Using addressable 2.8.0
Using rack-openid 1.4.2
Using rbpdf 1.20.1
Using rqrcode 2.0.0
Using activesupport 5.2.5
Using rails-dom-testing 2.0.3
Using loofah 2.10.0
Using globalid 0.4.2
Using activemodel 5.2.5
Using css_parser 1.9.0
Fetching puma 5.3.2
Using rails-html-sanitizer 1.3.0
Using activejob 5.2.5
Using activerecord 5.2.5
Using roadie 4.0.0
Using actionview 5.2.5
Using actionpack 5.2.5
Using actioncable 5.2.5
Using actionmailer 5.2.5
Using railties 5.2.5
Using activestorage 5.2.5
Using sprockets-rails 3.2.2
Using actionpack-xml_parser 2.0.1
Using rails 5.2.5
Using roadie-rails 2.2.0
Installing puma 5.3.2 with native extensions
Bundle complete! 37 Gemfile dependencies, 64 gems now installed.
Gems in the groups 'development', 'test' and 'mysql2' were not installed.
Bundled gems are installed into `./vendor/bundle`

systemd で Puma を起動する場合は以下の設定を記述する

/etc/systemd/system/redmine.service
[Unit]
Description=Redmine Puma Server
 
[Service]
WorkingDirectory=/var/www/vhosts/redmine.tomoyan.net/redmine
Environment=RAILS_ENV=production
SyslogIdentifier=redmine
PIDFile=/var/www/vhosts/redmine.tomoyan.net/redmine/tmp/pids/puma.pid
ExecStart=/home/redmine/.anyenv/envs/rbenv/shims/bundle exec puma -C /var/www/vhosts/redmine.tomoyan.net/redmine/config/puma.rb
Restart=always
User=redmine
Group=redmine
 
[Install]
WantedBy=multi-user.target

パーミッション設定(実行ユーザーのホームディレクトリの制限を緩める必要がある)

$ sudo chmod o+x /home/redmine

Redmine を実行するために使う Phusion Passenger をインストールする。

$ su - redmine
$ gem install passenger
Building native extensions. This could take a while...
Successfully installed passenger-6.0.1
Parsing documentation for passenger-6.0.1
Done installing documentation for passenger after 20 seconds
1 gem installed

PassengerのApache用モジュールをインストールする。

$ passenger-install-apache2-module --auto --languages ruby
Welcome to the Phusion Passenger Apache 2 module installer, v6.0.1.

This installer will guide you through the entire installation process. It
shouldn't take more than 3 minutes in total.

Here's what you can expect from the installation process:

 1. The Apache 2 module will be installed for you.
 2. You'll learn how to configure Apache.
 3. You'll learn how to deploy a Ruby on Rails application.

Don't worry if anything goes wrong. This installer will advise you on how to
solve any problems.

Press Enter to continue, or Ctrl-C to abort.

--------------------------------------------

Which languages are you interested in?

Override selection with --languages.

 ‣ ⬢  Ruby
   ⬡  Python
   ⬡  Node.js
   ⬡  Meteor

--------------------------------------------

Warning: some directories may be inaccessible by the web server!

The web server typically runs under a separate user account for security
reasons. That user must be able to access the Phusion Passenger files.
However, it appears that some directories have too strict permissions. This
may prevent the web server user from accessing Phusion Passenger files.

It is recommended that you relax permissions as follows:

  sudo chmod o+x "/home/redmine"

Press Ctrl-C to return to the shell. (Recommended)
After relaxing permissions, re-run this installer.
  -OR-
Press Enter to continue anyway.

--------------------------------------------

Checking for required software...

 * Checking for C compiler...
      Found: yes
      Location: /usr/bin/cc
 * Checking for C++ compiler...
      Found: yes
      Location: /usr/bin/c++
 * Checking for Curl development headers with SSL support...
      Found: yes
      curl-config location: /usr/bin/curl-config
      Header location: somewhere, not sure where
      Version: libcurl 7.61.1
      Usable: yes
      Supports SSL: yes
 * Checking for Zlib development headers...
      Found: yes
      Location: true
 * Checking for Apache 2...
      Found: yes
      Location of httpd: /usr/sbin/httpd
      Apache version: 2.4.37
 * Checking for Rake (associated with /usr/bin/ruby)...
      Found: yes
      Location: /usr/bin/ruby /home/redmine/bin/rake
 * Checking for OpenSSL support for Ruby...
      Found: yes
 * Checking for RubyGems...
      Found: yes
 * Checking for Ruby development headers...
      Found: yes
      Location: /usr/include/ruby.h
 * Checking for rack...
      Found: yes
 * Checking for OpenSSL development headers...
      Found: yes
      Location: true
 * Checking for Apache 2 development headers...
      Found: yes
      Location of apxs2: /usr/bin/apxs
 * Checking for Apache Portable Runtime (APR) development headers...
      Found: yes
      Location: /usr/bin/apr-1-config
      Version: 1.6.5
 * Checking for Apache Portable Runtime Utility (APU) development headers...
      Found: yes
      Location: /usr/bin/apu-1-config
      Version: 1.6.1

--------------------------------------------

Checking whether there are multiple Apache installations...
Only a single installation detected. This is good.

--------------------------------------------
Compiling and installing Apache 2 module...
〜省略〜

Apache用の設定内容を確認する。

$ passenger-install-apache2-module --snippet
LoadModule passenger_module /home/redmine/.gem/ruby/gems/passenger-6.0.1/buildout/apache2/mod_passenger.so
<IfModule mod_passenger.c>
  PassengerRoot /home/redmine/.gem/ruby/gems/passenger-6.0.1
  PassengerDefaultRuby /usr/bin/ruby
</IfModule>

Apache のバーチャルホストの設定と Passenger の設定を行う。

$ sudo vi /etc/httpd/conf.d/redmine.tomoyan.net.conf
/etc/httpd/conf.d/redmine.tomoyan.net.conf
# Passengerの基本設定。
# passenger-install-apache2-module --snippet で表示された設定を記述。
# 環境によって設定値が異なるため以下の5行はそのまま転記せず、必ず
# passenger-install-apache2-module --snippet で表示されたものを使用すること。
#
LoadModule passenger_module /home/redmine/.gem/ruby/gems/passenger-6.0.1/buildout/apache2/mod_passenger.so
<IfModule mod_passenger.c>
    PassengerRoot /home/redmine/.gem/ruby/gems/passenger-6.0.1
    PassengerDefaultRuby /usr/bin/ruby
</IfModule>
 
# Passenger の実行ユーザーも redmine にする。
PassengerUserSwitching off
PassengerDefaultUser redmine
 
# Passengerが追加するHTTPヘッダを削除するための設定(任意)
Header always unset "X-Powered-By"
Header always unset "X-Rack-Cache"
Header always unset "X-Content-Digest"
Header always unset "X-Runtime"
 
# 必要に応じてPassengerのチューニングのための設定を追加(任意)
# 詳しくはPhusion Passenger users guide を参照
# (http://www.modrails.com/documentation/Users%20guide%20Apache.html)
PassengerMaxPoolSize 20
PassengerMaxInstancesPerApp 4
PassengerPoolIdleTime 3600
PassengerHighPerformance on
PassengerStatThrottleRate 10
PassengerSpawnMethod smart
RailsAppSpawnerIdleTime 86400
PassengerMaxPreloaderIdleTime 0
 
<VirtualHost *:80>
    DocumentRoot "/var/www/vhosts/redmine.tomoyan.net/redmine/public"
    ServerName redmine.tomoyan.net
    # Redmineの画像ファイル・CSSファイル等へのアクセスを許可する設定。
    # Apache 2.4のデフォルトではサーバ上の全ファイルへのアクセスが禁止されている。
    <Directory "/var/www/vhosts/redmine.tomoyan.net/redmine/public">
        Require all granted
    </Directory>
 
    Header always unset "X-Powered-By"
    Header always unset "X-Runtime"
</VirtualHost>

Apache の設定チェック

Apache のシンタックスチェックを実行する。

$ sudo httpd -t
Syntax OK

Apache のリロード

$ sudo systemctl reload httpd.service

管理者パスワード変更

https://redmine.tomoyan.net/
admin でログインして管理者のパスワード変更を行う。
Redmine をインストールした直後であれば以下のユーザー名、パスワードでログイン出来る。

ログインID: admin
パスワード: admin

日本語での利用に適した設定

Redmineを日本語環境で使いやすいように設定する。

以下の設定を行う。

  • 「デフォルトの言語」を「日本語 (Japanese)」に設定
  • 「ユーザー名の表示形式」を姓が先に来るよう設定
  • リポジトリブラウザで文字コードの自動判別を設定
「デフォルトの言語」と「ユーザー名の表示形式」の設定
  1. 画面左上の「管理」をクリックする。
  2. 管理画面の「設定」をクリックする。
  3. 「表示」タブを開き、以下のように設定を行う。
    デフォルトの言語: Japanese(日本語)
    ユーザー名の表示形式: Tomo Yan
  4. 「保存」をクリックして設定を反映する。
リポジトリブラウザで文字コードの自動判別を設定
  1. 画面左上の「管理」をクリックする。
  2. 管理画面の「設定」をクリックする。
  3. 「ファイル」タブを開き、以下のように設定を行う。
    添付ファイルとリポジトリのエンコーディング: utf-8,cp932,euc-jp
  4. 「保存」をクリックして設定を反映する。

メールに含まれるRedmineのアドレスを正しく設定

ホスト名の設定
  1. 画面左上の「管理」をクリックする。
  2. 管理画面の「設定」をクリックする。
  3. 「全般」タブを開き、以下のように設定を行う。
    ホスト名とパス: redmine.tomoyan.net
    プロトコル: HTTPS
  4. 「保存」をクリックして設定を反映する。
プロトコルの設定

通常は HTTP、SSL で Redmine にアクセスする場合は HTTPS を選択する。

プロトコル: HTTPS

ユーザー追加のデフォルト設定

  1. 画面左上の「管理」をクリックする。
  2. 管理画面の「設定」をクリックする。
  3. 「ユーザー」タブを開き、以下のように設定を行う。
    タイムゾーン: (GMT+09:00) Sapporo
  4. 「保存」をクリックして設定を反映する。

リポジトリ追加のデフォルト設定

  1. 画面左上の「管理」をクリックする。
  2. 管理画面の「設定」をクリックする。
  3. 「リポジトリ」タブを開き、以下のように設定を行う。
    使用するバージョン管理システム
      [v] Subversion
      [v] Mercurial
      [ ] Cvs
      [ ] Bazaar
      [v] Git
      [v] Filesystem
  4. 「保存」をクリックして設定を反映する。

ユーザーの追加

  1. 画面左上の「管理」をクリックする。
  2. 管理画面の「ユーザー」をクリックする。
  3. ユーザー画面の右上にある「新しいユーザー」をクリックする。
  4. 新しいユーザー画面に新しいユーザーについての下記の情報を入力する。
    情報
      ログインID: tomoyan
      名: Yan
      姓: Tomo
      メールアドレス: tomoyan@tomoyan.net
      システム管理者: チェックを入れると Redmine の管理者として登録できる。
    
    認証
      パスワード: ********
      パスワードの確認: ********
    
    設定
      タイムゾーン: (GMT+09:00) Sapporo
      
    [v] アカウント情報をユーザーに送信
  5. 「作成」をクリックしてユーザー追加を反映する。

プロジェクトの追加

Redmine で業務を管理するためにはプロジェクトを作成する。

  1. 画面左上の「管理」をクリックする。
  2. 管理画面の「プロジェクト」をクリックする。
  3. プロジェクト画面の右上にある「新しいプロジェクト」をクリックする。
  4. 新しいプロジェクト画面に新しいプロジェクトについての下記の情報を入力する。
    名称: tomoyan プロジェクト
    説明: プロジェクトについての説明を入力する。
    識別子: Redmine 内部でプロジェクト識別するための名称を入力する。
  5. 「作成」をクリックする。

プロジェクトのメンバーを追加

Redmine のプロジェクトに追加されているユーザをそのプロジェクトのメンバーという。
この手順ではプロジェクトのメンバーを追加する。

  1. 画面左上の「管理」をクリックする。
  2. 管理画面の「プロジェクト」をクリックする。
  3. メンバーを追加したい「プロジェクト名称」をクリックする。
  4. 設定画面の「メンバー」タブをクリックして画面左上の「新しいメンバー」をクリックする。
  5. 追加するメンバーとロールを選び「追加」をクリックする。

プロジェクトのリポジトリを追加

この手順では Redmine のプロジェクトで管理するリポジトリを追加する。

  1. 画面左上の「管理」をクリックする。
  2. 管理画面の「プロジェクト」をクリックする。
  3. メンバーを追加したい「プロジェクト名称」をクリックする。
  4. 設定画面の「リポジトリ」タブをクリックして画面左上の「新しいリポジトリ」をクリックする。
  5. 新しいリポジトリの画面に以下の情報を入力する。
    バージョン管理システム: Mercurial
    識別子: tomoyan_project_repo
    リポジトリのパス: /var/hg/redmine_repos/tomoyan_project_repo
    パスのエンコーディング: UTF-8
  6. 「作成」をクリックしてリポジトリを作成する。

※ Redmine は hg init はしてくれないので自分でリポジトリを作成する必要がある。

$ ssh tomoyan@redmine.tomoyan.net hg init /var/hg/redmine_repos/tomoyan_project_repo

Wiki テキスト書式の変更

Redmine 全体の Wiki 構文は、標準の設定では Textile です。
これを以下の手順で変更できる。

  1. 画面左上の「管理」をクリックする。
  2. 管理画面の「設定」をクリックする。
  3. 「全般」タブの「テキスト書式」を変更する。
    なし
    Textile
    Markdown
    CommonMark Markdown (GitHub Flavored) - experimental
  4. 「保存」をクリックする。

この手順では Redmine の作業分類を追加する。

  1. 画面左上の「管理」をクリックする。
  2. 管理画面の「選択肢の値」をクリックする。
  3. 「選択肢の値」の画面で「作業分類 (時間管理)」の「新しい値」をクリックする。
  4. 「作業分類 (時間管理) » 新しい値」の画面に以下の情報を入力する。
    名称: 構築作業
    有効: [v]
  5. 「作成」をクリックして作業分類を作成する。

Mercurial と連携する場合

Mercurial をインストールする。

$ sudo dnf install mercurial

Mercurial の動作確認。

$ hg --version
Mercurial Distributed SCM (version 4.5.3)
(see https://mercurial-scm.org for more information)

Copyright (C) 2005-2018 Matt Mackall and others
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

今までは restart.txt を touch していまいたが、

$ touch redmine/tmp/restart.txt

passenger-config を使う方法に変わりました。

$ su - redmine
$ passenger-config restart-app

バックアップ

現在稼働している Redmine をバックアップする。

$ su - redmine
$ tar Jcvf /var/www/vhosts/redmine.tomoyan.net/20240130_redmine-5.0.4.tar.xz /var/www/vhosts/redmine.tomoyan.net/redmine/

データベースをバックアップする。

$ pg_dump redmine_db -U redmine -v -b > ~/20240130_redmine_db.dmp
$ tar Jcvf /var/www/vhosts/redmine.tomoyan.net/20240130_redmine_db.dmp.tar.xz ~/20240130_redmine_db.dmp
$ rm ~/20240130_redmine_db.dmp

アップグレードの実行

パッケージのダウンロードと展開

ダウンロード — Redmine.JP から最新の Redmine(redmine-5.0.4.tar.gz) をダウンロードする。

$ su - redmine
$ curl -LO https://www.redmine.org/releases/redmine-5.1.1.tar.gz
$ tar zxvf redmine-5.1.1.tar.gz
データベースに接続するための設定

現在動いている Redmine からコピーしてくる。

$ cd redmine-5.1.1
$ cp /var/www/vhosts/redmine.tomoyan.net/redmine/config/database.yml config/database.yml
依存するソフトウェアのインストール

Bundlerをインストールする。

$ gem install bundler

Fetching bundler-2.5.5.gem
Successfully installed bundler-2.5.5
Parsing documentation for bundler-2.5.5
Installing ri documentation for bundler-2.5.5
Done installing documentation for bundler after 0 seconds
1 gem installed

Puma を使用する場合は Gemfile に追記する。

$ nano Gemfile

source 'https://rubygems.org'
 
ruby '>= 2.7.0', '< 3.3.0'
 
gem 'rails', '6.1.7.6'
gem 'rouge', '~> 4.2.0'
gem 'request_store', '~> 1.5.0'
gem 'mini_mime', '~> 1.1.0'
gem "actionpack-xml_parser"
gem 'roadie-rails', '~> 3.1.0'
gem 'marcel'
gem 'mail', '~> 2.8.1'
gem 'nokogiri', '~> 1.15.2'
gem 'i18n', '~> 1.14.1'
gem 'rbpdf', '~> 1.21.3'
gem 'addressable'
gem 'rubyzip', '~> 2.3.0'
gem 'puma' # <-追記
...

Puma で pid ファイルを tmp/pids に配置している場合はアップグレード時もディレクトリを作成しておかないと Puma が起動不能になる。

$ mkdir tmp/pids

Redmineを実行するために必要なすべてのgemをインストールする。

$ bundle install --path vendor/bundle --without development test

[DEPRECATED] The `--path` flag is deprecated because it relies on being remembered across bundler invocations,
 which bundler will no longer do in future versions. Instead please use `bundle config set path 'vendor/bundle
'`, and stop using this flag                                                                                  
[DEPRECATED] The `--without` flag is deprecated because it relies on being remembered across bundler invocatio
ns, which bundler will no longer do in future versions. Instead please use `bundle config set without 'develop
ment test'`, and stop using this flag                                                                         
Your Gemfile lists the gem puma (>= 0) more than once.                                                        
You should probably keep only one of them.                                                                    
Remove any duplicate entries and specify the gem only once.                                                   
While it's not a problem now, it could cause errors if you change the version of one of them later.           
Fetching gem metadata from https://rubygems.org/.........                                                     
Resolving dependencies...                                                                                     
Fetching rake 13.1.0                                                                                          
Installing rake 13.1.0                                                                                        
Fetching concurrent-ruby 1.2.3                                                                                
Fetching minitest 5.21.2                                                                                      
Installing concurrent-ruby 1.2.3                                                                              
Installing minitest 5.21.2                                                                                    
Fetching zeitwerk 2.6.12                                                                                      
Fetching builder 3.2.4                                                                                        
Installing zeitwerk 2.6.12                                                                                    
Fetching erubi 1.12.0                                                                                         
Installing builder 3.2.4                                                                                      
Fetching racc 1.7.3                                                                                           
Installing erubi 1.12.0                                                                                       
Fetching crass 1.0.6                                                                                          
Installing racc 1.7.3 with native extensions                                                                  
Installing crass 1.0.6                                                                                        
Fetching rack 2.2.8                                                                                           
Installing rack 2.2.8                                                                                         
Fetching nio4r 2.7.0                                                                                          
Installing nio4r 2.7.0 with native extensions                                                                 
Fetching websocket-extensions 0.1.5                                                                           
Installing websocket-extensions 0.1.5                                                                         
Fetching marcel 1.0.2                                                                                         
Installing marcel 1.0.2                                                                                       
Fetching mini_mime 1.1.5                                                                                      
Installing mini_mime 1.1.5                                                                                    
Fetching date 3.3.4                                                                                           
Installing date 3.3.4 with native extensions
Fetching timeout 0.4.1
Installing timeout 0.4.1
Fetching method_source 1.0.0
Installing method_source 1.0.0
Fetching thor 1.3.0
Installing thor 1.3.0
Fetching public_suffix 5.0.4
Installing public_suffix 5.0.4
Fetching chunky_png 1.4.0
Installing chunky_png 1.4.0 
Fetching commonmarker 0.23.10
Installing commonmarker 0.23.10 with native extensions
Fetching csv 3.2.8
Installing csv 3.2.8
Fetching htmlentities 4.3.4 
Installing htmlentities 4.3.4
Fetching mini_magick 4.12.0 
Installing mini_magick 4.12.0
Fetching net-ldap 0.17.1
Installing net-ldap 0.17.1
Fetching pg 1.5.4
Installing pg 1.5.4 with native extensions
Fetching rbpdf-font 1.19.1
Installing rbpdf-font 1.19.1
Fetching redcarpet 3.6.0
Installing redcarpet 3.6.0 with native extensions
Fetching rexml 3.2.6
Installing rexml 3.2.6
Fetching rotp 6.3.0
Installing rotp 6.3.0
Fetching rouge 4.2.0
Installing rouge 4.2.0
Fetching rqrcode_core 1.2.0 
Installing rqrcode_core 1.2.0
Fetching rubyzip 2.3.2
Installing rubyzip 2.3.2
Fetching i18n 1.14.1
Installing i18n 1.14.1
Fetching tzinfo 2.0.6
Installing tzinfo 2.0.6
Fetching rack-test 2.1.0
Installing rack-test 2.1.0
Fetching sprockets 4.2.1
Installing sprockets 4.2.1
Fetching request_store 1.5.1
Installing request_store 1.5.1
Fetching nokogiri 1.15.5 (x86_64-linux)
Installing nokogiri 1.15.5 (x86_64-linux)
Fetching websocket-driver 0.7.6
Installing websocket-driver 0.7.6 with native extensions
Fetching puma 6.4.2
Installing puma 6.4.2 with native extensions
Fetching net-protocol 0.2.2 
Installing net-protocol 0.2.2
Fetching addressable 2.8.6
Installing addressable 2.8.6
Fetching rbpdf 1.21.3
Installing rbpdf 1.21.3
Fetching rqrcode 2.2.0
Installing rqrcode 2.2.0
Fetching activesupport 6.1.7.6
Installing activesupport 6.1.7.6
Fetching loofah 2.22.0
Installing loofah 2.22.0
Fetching sanitize 6.1.0
Installing sanitize 6.1.0
Fetching net-imap 0.3.7
Installing net-imap 0.3.7
Fetching net-pop 0.1.2
Installing net-pop 0.1.2
Fetching net-smtp 0.3.4
Installing net-smtp 0.3.4
Fetching css_parser 1.16.0
Installing css_parser 1.16.0
Fetching rails-dom-testing 2.2.0
Installing rails-dom-testing 2.2.0
Fetching globalid 1.2.1
Installing globalid 1.2.1
Fetching activemodel 6.1.7.6
Installing activemodel 6.1.7.6
Fetching html-pipeline 2.13.2
Installing html-pipeline 2.13.2
Fetching rails-html-sanitizer 1.6.0
Installing rails-html-sanitizer 1.6.0
Fetching mail 2.8.1
Installing mail 2.8.1
Fetching roadie 5.2.0
Installing roadie 5.2.0
Fetching activejob 6.1.7.6
Installing activejob 6.1.7.6
Fetching activerecord 6.1.7.6
Installing activerecord 6.1.7.6
Fetching deckar01-task_list 2.3.2
Installing deckar01-task_list 2.3.2
Fetching actionview 6.1.7.6 
Installing actionview 6.1.7.6
Fetching actionpack 6.1.7.6 
Installing actionpack 6.1.7.6
Fetching actioncable 6.1.7.6
Installing actioncable 6.1.7.6
Fetching activestorage 6.1.7.6
Installing activestorage 6.1.7.6
Fetching actionmailer 6.1.7.6
Installing actionmailer 6.1.7.6
Fetching railties 6.1.7.6
Installing railties 6.1.7.6 
Fetching sprockets-rails 3.4.2
Installing sprockets-rails 3.4.2
Fetching actionmailbox 6.1.7.6
Installing actionmailbox 6.1.7.6
Fetching actiontext 6.1.7.6 
Installing actiontext 6.1.7.6
Fetching actionpack-xml_parser 2.0.1
Installing actionpack-xml_parser 2.0.1
Fetching roadie-rails 3.1.0 
Installing roadie-rails 3.1.0
Fetching rails 6.1.7.6
Installing rails 6.1.7.6
Bundle complete! 42 Gemfile dependencies, 74 gems now installed.
Gems in the groups 'development' and 'test' were not installed.
Bundled gems are installed into `./vendor/bundle`
Post-install message from html-pipeline:
-------------------------------------------------
Thank you for installing html-pipeline!
You must bundle Filter gem dependencies.
See html-pipeline README.md for more details.
https://github.com/jch/html-pipeline#dependencies
-------------------------------------------------
Post-install message from rubyzip:
RubyZip 3.0 is coming!
**********************

The public API of some Rubyzip classes has been modernized to use named
parameters for optional arguments. Please check your usage of the
following classes:
  * `Zip::File`
  * `Zip::Entry`
  * `Zip::InputStream`
  * `Zip::OutputStream`

Please ensure that your Gemfiles and .gemspecs are suitably restrictive
to avoid an unexpected breakage when 3.0 is released (e.g. ~> 2.3.0).
See https://github.com/rubyzip/rubyzip for details. The Changelog also
lists other enhancements and bugfixes that have been implemented since
version 2.3.0.

セッションストア秘密鍵の生成

Rails はセッションハイジャックを防ぐために、セッション情報を格納する cookie をエンコードする。
この処理で使われるランダムなキーを生成する。

$ bundle exec rake generate_secret_token
files を移行する

現在動いている Redmine から files ディレクトリをコピーする。

$ cp -rf /var/www/vhosts/redmine.tomoyan.net/redmine/files .
plugins を移行する

現在動いている Redmine から plugins ディレクトリをコピーする。

$ cp -rf /var/www/vhosts/redmine.tomoyan.net/redmine/plugins .
データベースのアップデート

データベースを新しい Redmine 用にアップデートする。

$ bundle exec rake db:migrate RAILS_ENV=production

プラグインをインストールしている場合は、以下も実行しておく。

$ bundle exec rake redmine:plugins:migrate RAILS_ENV=production


データベースのアップデートで以下のエラーが出る場合は PostgreSQL の pg_hba.conf の設定を見直す。
OS をアップグレードしたばかりの場合など、以前に設定した pg_hba.conf の設定内容が置き換わっている事がある。

rake aborted!
PG::ConnectionBad: FATAL:  ユーザ"redmine"のIdent認証に失敗しました
$ sudo vi /var/lib/pgsql/data/pg_hba.conf
# "local" is for Unix domain socket connections only
local   all         all                               md5
# IPv4 local connections:
host    all         all         127.0.0.1/32          md5
# IPv6 local connections:
host    all         all         ::1/128               md5
$ sudo systemctl restart postgresql
$ su - redmine
$ cd redmine-4.0.3
$ bundle exec rake db:migrate RAILS_ENV=production
Redmine の設定

現在動いている Redmine からメールサーバへ接続するための設定や日本語フォントファイルのパスを記述した設定ファイルをコピーする。

$ cp /var/www/vhosts/redmine.tomoyan.net/redmine/config/configuration.yml config/configuration.yml
Puma の場合

設定ファイルをコピーする。

$ cp /var/www/vhosts/redmine.tomoyan.net/redmine/config/puma.rb config/puma.rb

Redmine の配置

現在動作している Redmine は用済みなので削除する。

$ rm -rf /var/www/vhosts/redmine.tomoyan.net/redmine
or
$ mv /var/www/vhosts/redmine.tomoyan.net/redmine /var/www/vhosts/redmine.tomoyan.net/redmine_bak

そして、新しい Redmine を配置する。

$ cd ~
$ mv /home/redmine/redmine-5.1.1 /var/www/vhosts/redmine.tomoyan.net/redmine
$ chown redmine:redmine /var/www/vhosts/redmine.tomoyan.net/redmine -R

※ Passenger は config/environment.rb ファイルのオーナーでアプリを実行する。

Passenger の場合は最新化する

Redmine を実行するために使う Phusion Passenger をインストールする。

$ su - redmine
$ cd ~
$ rbenv global 2.7.4
$ ruby -v
ruby 2.7.4p191 (2021-07-07 revision a21a3b7d23) [x86_64-linux]
$ gem install passenger
Fetching passenger-6.0.10.gem
Fetching rack-2.2.3.gem
Successfully installed rack-2.2.3
Building native extensions. This could take a while...
Successfully installed passenger-6.0.10
Parsing documentation for rack-2.2.3
Installing ri documentation for rack-2.2.3
Parsing documentation for passenger-6.0.10
Installing ri documentation for passenger-6.0.10
Done installing documentation for rack, passenger after 41 seconds
2 gems installed

PassengerのApache用モジュールをインストールする。

$ passenger-install-apache2-module --auto --languages ruby

Welcome to the Phusion Passenger Apache 2 module installer, v6.0.2.

This installer will guide you through the entire installation process. It
shouldn't take more than 3 minutes in total.

Here's what you can expect from the installation process:

 1. The Apache 2 module will be installed for you.
 2. You'll learn how to configure Apache.
 3. You'll learn how to deploy a Ruby on Rails application.

Don't worry if anything goes wrong. This installer will advise you on how to
solve any problems.

Press Enter to continue, or Ctrl-C to abort.

--------------------------------------------

Which languages are you interested in?

Override selection with --languages.

 ‣ ⬢  Ruby
   ⬡  Python
   ⬡  Node.js
   ⬡  Meteor

--------------------------------------------

Checking for required software...

 * Checking for C compiler...
      Found: yes
      Location: /usr/bin/cc
 * Checking for C++ compiler...
      Found: yes
      Location: /usr/bin/c++
 * Checking for Curl development headers with SSL support...
      Found: yes
      curl-config location: /usr/bin/curl-config
      Header location: somewhere, not sure where
      Version: libcurl 7.64.0
      Usable: yes
      Supports SSL: yes
 * Checking for Zlib development headers...
      Found: yes
      Location: true
 * Checking for Apache 2...
      Found: yes
      Location of httpd: /usr/sbin/httpd
      Apache version: 2.4.39
 * Checking for Rake (associated with /usr/bin/ruby)...
      Found: yes
      Location: /usr/bin/ruby /home/redmine/bin/rake
 * Checking for OpenSSL support for Ruby...
      Found: yes
 * Checking for RubyGems...
      Found: yes
 * Checking for Ruby development headers...
      Found: yes
      Location: /usr/include/ruby.h
 * Checking for rack...
      Found: yes
 * Checking for OpenSSL development headers...
      Found: yes
      Location: true
 * Checking for Apache 2 development headers...
      Found: yes
      Location of apxs2: /usr/bin/apxs
 * Checking for Apache Portable Runtime (APR) development headers...
      Found: yes
      Location: /usr/bin/apr-1-config
      Version: 1.6.5
 * Checking for Apache Portable Runtime Utility (APU) development headers...
      Found: yes
      Location: /usr/bin/apu-1-config
      Version: 1.6.1

--------------------------------------------

Checking whether there are multiple Apache installations...
Only a single installation detected. This is good.

--------------------------------------------
Compiling and installing Apache 2 module...
〜省略〜

Apache用の設定内容を確認する。

$ passenger-install-apache2-module --snippet
LoadModule passenger_module /home/redmine/.anyenv/envs/rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/passenger-6.0.10/buildout/apache2/mod_passenger.so
<IfModule mod_passenger.c>
  PassengerRoot /home/redmine/.anyenv/envs/rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/passenger-6.0.10
  PassengerDefaultRuby /home/redmine/.anyenv/envs/rbenv/versions/2.7.4/bin/ruby
</IfModule>

Apache の設定

Apache のバーチャルホストの設定と Passenger の設定を行う。

$ sudo nano /etc/httpd/conf.d/redmine.tomoyan.net.conf
/etc/httpd/conf.d/redmine.tomoyan.net.conf
# Passengerの基本設定。
# passenger-install-apache2-module --snippet で表示された設定を記述。
# 環境によって設定値が異なるため以下の5行はそのまま転記せず、必ず
# passenger-install-apache2-module --snippet で表示されたものを使用すること。
#
LoadModule passenger_module /home/redmine/.anyenv/envs/rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/passenger-6.0.10/buildout/apache2/mod_passenger.so
<IfModule mod_passenger.c>
  PassengerRoot /home/redmine/.anyenv/envs/rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/passenger-6.0.10
  PassengerDefaultRuby /home/redmine/.anyenv/envs/rbenv/versions/2.7.4/bin/ruby
</IfModule>
 
# Passenger の実行ユーザーも redmine にする。
PassengerUserSwitching off
PassengerDefaultUser redmine
 
# Passengerが追加するHTTPヘッダを削除するための設定(任意)
Header always unset "X-Powered-By"
Header always unset "X-Rack-Cache"
Header always unset "X-Content-Digest"
Header always unset "X-Runtime"
 
# 必要に応じてPassengerのチューニングのための設定を追加(任意)
# 詳しくはPhusion Passenger users guide を参照
# (http://www.modrails.com/documentation/Users%20guide%20Apache.html)
PassengerMaxPoolSize 20
PassengerMaxInstancesPerApp 4
PassengerPoolIdleTime 3600
PassengerHighPerformance on
PassengerStatThrottleRate 10
PassengerSpawnMethod smart
RailsAppSpawnerIdleTime 86400
PassengerMaxPreloaderIdleTime 0
 
<VirtualHost *:80>
    DocumentRoot "/var/www/vhosts/redmine.tomoyan.net/redmine/public"
    ServerName redmine.tomoyan.net
    # Redmineの画像ファイル・CSSファイル等へのアクセスを許可する設定。
    # Apache 2.4のデフォルトではサーバ上の全ファイルへのアクセスが禁止されている。
    <Directory "/var/www/vhosts/redmine.tomoyan.net/redmine/public">
        Require all granted
    </Directory>
 
    Header always unset "X-Powered-By"
    Header always unset "X-Runtime"
</VirtualHost>

Apache の設定チェック

Apache のシンタックスチェックを実行する。

$ sudo httpd -t
Syntax OK

Apache のリロード

$ sudo systemctl reload httpd.service
$ su - redmine
$ cd /var/www/vhosts/redmine.tomoyan.net/redmine/
$ bundle exec rails console production
DEPRECATION WARNING: Passing the environment's name as a regular argument is deprecated and will be removed in the next Rails version. Please, use the -e option instead. (called from require at bin/rails:4)
Loading production environment (Rails 5.2.5)
irb(main):001:0> User.find_by_login('admin').update!(password: 'NewPasswd!')
=> true
irb(main):002:0> quit

おそらく OS の仮想メモリーが足りていないので、仮想メモリーを増やすために設定を変更する。
Fedora 33 以降で標準になった ZRAM スワップの容量を拡張する

ssh セッションを tmux で保護していても、tmux のセッションもご臨終する😅💦
Passenger ビルドでフリーズ

Redmine の動作環境は以下の通りである。

Environment:
  Redmine version                4.2.1.stable
  Ruby version                   2.7.4-p191 (2021-07-07) [x86_64-linux]
  Rails version                  5.2.5
  Environment                    production
  Database adapter               PostgreSQL
  Mailer queue                   ActiveJob::QueueAdapters::AsyncAdapter
  Mailer delivery                smtp
SCM:
  Mercurial                      5.7.1
  Git                            2.31.1
  Filesystem
Redmine plugins:
  google_analytics_plugin        1.0.0
  redmine_sitemap                0.0.1

mercurial を Python 3 版に入れ替えると…

$ sudo dnf remove mercurial
依存関係が解決しました。
====================================================================================================
 Package                     Architecture        Version                 Repository            Size
====================================================================================================
削除中:
 mercurial-py2               x86_64              5.2-4.fc32              @fedora               20 M
未使用の依存関係の削除:
 mercurial-lang              x86_64              5.2-4.fc32              @fedora              5.0 M

トランザクションの概要
====================================================================================================
削除  2 パッケージ

解放された容量: 25 M
これでよろしいですか? [y/N]: y
トランザクションの確認を実行中
トランザクションの確認に成功しました。
トランザクションのテストを実行中
トランザクションのテストに成功しました。
トランザクションを実行中
  準備             :                                                                            1/1
  scriptletの実行中: mercurial-py2-5.2-4.fc32.x86_64                                            1/2
  削除             : mercurial-py2-5.2-4.fc32.x86_64                                            1/2
  削除             : mercurial-lang-5.2-4.fc32.x86_64                                           2/2
  scriptletの実行中: mercurial-lang-5.2-4.fc32.x86_64                                           2/2
  検証             : mercurial-lang-5.2-4.fc32.x86_64                                           1/2
  検証             : mercurial-py2-5.2-4.fc32.x86_64                                            2/2

削除しました:
  mercurial-lang-5.2-4.fc32.x86_64                  mercurial-py2-5.2-4.fc32.x86_64

完了しました!
$ sudo dnf install mercurial-py3
メタデータの期限切れの最終確認: 3:17:37 時間前の 2020年12月16日 02時41分45秒 に実施しました。
依存関係が解決しました。
====================================================================================================
 Package                     Architecture        Version                 Repository            Size
====================================================================================================
インストール:
 mercurial-py3               x86_64              5.2-5.fc32              updates              3.9 M
依存関係のインストール:
 mercurial-lang              x86_64              5.2-5.fc32              updates              1.0 M

トランザクションの概要
====================================================================================================
インストール  2 パッケージ

ダウンロードサイズの合計: 4.9 M
インストール済みのサイズ: 23 M
これでよろしいですか? [y/N]: y
パッケージのダウンロード:
(1/2): mercurial-lang-5.2-5.fc32.x86_64.rpm                         3.6 MB/s | 1.0 MB     00:00
(2/2): mercurial-py3-5.2-5.fc32.x86_64.rpm                          6.5 MB/s | 3.9 MB     00:00
----------------------------------------------------------------------------------------------------
合計                                                                4.5 MB/s | 4.9 MB     00:01
トランザクションの確認を実行中
トランザクションの確認に成功しました。
トランザクションのテストを実行中
トランザクションのテストに成功しました。
トランザクションを実行中
  準備             :                                                                            1/1
  インストール中   : mercurial-lang-5.2-5.fc32.x86_64                                           1/2
  インストール中   : mercurial-py3-5.2-5.fc32.x86_64                                            2/2
  scriptletの実行中: mercurial-py3-5.2-5.fc32.x86_64                                            2/2
  検証             : mercurial-lang-5.2-5.fc32.x86_64                                           1/2
  検証             : mercurial-py3-5.2-5.fc32.x86_64                                            2/2

インストール済み:
  mercurial-lang-5.2-5.fc32.x86_64                  mercurial-py3-5.2-5.fc32.x86_64

完了しました!
$ hg version
Mercurial Distributed SCM (version 5.2)
(see https://mercurial-scm.org for more information)

Copyright (C) 2005-2019 Matt Mackall and others
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Redmine で mercurial リポジトリが 404 で表示されなくなる。
Redmine mercurial リポジトリ 404

Apache のエラーログを調べる。

$ sudo tail -f /var/log/httpd/error_log

Redmine の mercurial 用 SCM アダプタがエラーを吐いている。

App 2999 output: (did you mean summary?)
App 2999 output: *** failed to import extension redminehelper from /var/www/vhosts/redmine.tomoyan.net/redmine/lib/redmine/scm/adapters/mercurial/redminehelper.py: module 'cgi' has no attribute 'escape'
App 2999 output: hg: unknown command 'rhmanifest'
App 2999 output: (did you mean manifest?)
App 2999 output: *** failed to import extension redminehelper from /var/www/vhosts/redmine.tomoyan.net/redmine/lib/redmine/scm/adapters/mercurial/redminehelper.py: module 'cgi' has no attribute 'escape'
App 2999 output: hg: unknown command 'rhsummary'
App 2999 output: (did you mean summary?)
App 2999 output: *** failed to import extension redminehelper from /var/www/vhosts/redmine.tomoyan.net/redmine/lib/redmine/scm/adapters/mercurial/redminehelper.py: module 'cgi' has no attribute 'escape'
App 2999 output: hg: unknown command 'rhmanifest'
App 2999 output: (did you mean manifest?)

ここの情報を参考にパッチを当ててみる。
Feature #33784: Updating Mercurial helper to work with Python3 - Redmine

redmine/lib/redmine/scm/adapters/mercurial/redminehelper.py
# redminehelper: Redmine helper extension for Mercurial
#
# Copyright 2010 Alessio Franceschelli (alefranz.net)
# Copyright 2010-2011 Yuya Nishihara <yuya@tcha.org>
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
"""helper commands for Redmine to reduce the number of hg calls
 
To test this extension, please try::
 
    $ hg --config extensions.redminehelper=redminehelper.py rhsummary
 
I/O encoding:
 
:file path: urlencoded, raw string
:tag name: utf-8
:branch name: utf-8
:node: hex string
 
Output example of rhsummary::
 
    <?xml version="1.0"?>
    <rhsummary>
      <repository root="/foo/bar">
        <tip revision="1234" node="abcdef0123..."/>
        <tag revision="123" node="34567abc..." name="1.1.1"/>
        <branch .../>
        ...
      </repository>
    </rhsummary>
 
Output example of rhmanifest::
 
    <?xml version="1.0"?>
    <rhmanifest>
      <repository root="/foo/bar">
        <manifest revision="1234" path="lib">
          <file name="diff.rb" revision="123" node="34567abc..." time="12345"
                 size="100"/>
          ...
          <dir name="redmine"/>
          ...
        </manifest>
      </repository>
    </rhmanifest>
"""
import re, time, html, urllib
from mercurial import cmdutil, commands, node, error, hg, registrar
 
cmdtable = {}
command = registrar.command(cmdtable) if hasattr(registrar, 'command') else cmdutil.command(cmdtable)
 
_x = lambda s: html.escape(s.decode('utf-8')).encode('utf-8')
_u = lambda s: html.escape(urllib.parse.quote(s)).encode('utf-8')
 
def unquote_plus(*args, **kwargs):
    return urllib.parse.unquote_to_bytes(*args, **kwargs).replace(b'+', b' ')
 
def _changectx(repo, rev):
    if isinstance(rev, bytes):
       rev = repo.lookup(rev)
    if hasattr(repo, 'changectx'):
        return repo.changectx(rev)
    else:
        return repo[rev]
 
def _tip(ui, repo):
    # see mercurial/commands.py:tip
    def tiprev():
        try:
            return len(repo) - 1
        except TypeError:  # Mercurial < 1.1
            return repo.changelog.count() - 1
    tipctx = _changectx(repo, tiprev())
    ui.write(b'<tip revision="%d" node="%s"/>\n'
             % (tipctx.rev(), _x(node.hex(tipctx.node()))))
 
_SPECIAL_TAGS = (b'tip',)
 
def _tags(ui, repo):
    # see mercurial/commands.py:tags
    for t, n in reversed(repo.tagslist()):
        if t in _SPECIAL_TAGS:
            continue
        try:
            r = repo.changelog.rev(n)
        except error.LookupError:
            continue
        ui.write(b'<tag revision="%d" node="%s" name="%s"/>\n'
                 % (r, _x(node.hex(n)), _u(t)))
 
def _branches(ui, repo):
    # see mercurial/commands.py:branches
    def iterbranches():
        if getattr(repo, 'branchtags', None) is not None:
            # Mercurial < 2.9
            for t, n in repo.branchtags().iteritems():
                yield t, n, repo.changelog.rev(n)
        else:
            for tag, heads, tip, isclosed in repo.branchmap().iterbranches():
                yield tag, tip, repo.changelog.rev(tip)
    def branchheads(branch):
        try:
            return repo.branchheads(branch, closed=False)
        except TypeError:  # Mercurial < 1.2
            return repo.branchheads(branch)
    def lookup(rev, n):
        try:
            return repo.lookup(str(rev).encode('utf-8'))
        except RuntimeError:
            return n
    for t, n, r in sorted(iterbranches(), key=lambda e: e[2], reverse=True):
        if lookup(r, n) in branchheads(t):
            ui.write(b'<branch revision="%d" node="%s" name="%s"/>\n'
                     % (r, _x(node.hex(n)), _x(t)))
 
def _manifest(ui, repo, path, rev):
    ctx = _changectx(repo, rev)
    ui.write(b'<manifest revision="%d" path="%s">\n'
             % (ctx.rev(), _u(path)))
 
    known = set()
    pathprefix = (path.decode('utf-8').rstrip('/') + '/').lstrip('/')
    for f, n in sorted(ctx.manifest().iteritems(), key=lambda e: e[0]):
        fstr = f.decode('utf-8')
        if not fstr.startswith(pathprefix):
            continue
        name = re.sub(r'/.*', '/', fstr[len(pathprefix):])
        if name in known:
            continue
        known.add(name)
 
        if name.endswith('/'):
            ui.write(b'<dir name="%s"/>\n'
                    %_x(urllib.parse.quote(name[:-1]).encode('utf-8')))
        else:
            fctx = repo.filectx(f, fileid=n)
            tm, tzoffset = fctx.date()
            ui.write(b'<file name="%s" revision="%d" node="%s" '
                     b'time="%d" size="%d"/>\n'
                     % (_u(name), fctx.rev(), _x(node.hex(fctx.node())),
                        tm, fctx.size(), ))
 
    ui.write(b'</manifest>\n')
 
@command(b'rhannotate',
         [(b'r', b'rev', b'', b'revision'),
          (b'u', b'user', None, b'list the author (long with -v)'),
          (b'n', b'number', None, b'list the revision number (default)'),
          (b'c', b'changeset', None, b'list the changeset'),
         ],
         b'hg rhannotate [-r REV] [-u] [-n] [-c] FILE...')
def rhannotate(ui, repo, *pats, **opts):
    rev = unquote_plus(opts.pop('rev', None))
    opts['rev'] = rev
    return commands.annotate(ui, repo, *map(unquote_plus, pats), **opts)
 
@command(b'rhcat',
               [(b'r', b'rev', b'', b'revision')],
               b'hg rhcat ([-r REV] ...) FILE...')
def rhcat(ui, repo, file1, *pats, **opts):
    rev = unquote_plus(opts.pop('rev', b''))
    opts['rev'] = rev
    return commands.cat(ui, repo, unquote_plus(file1), *map(unquote_plus, pats), **opts)
 
@command(b'rhdiff',
               [(b'r', b'rev', [], b'revision'),
                (b'c', b'change', b'', b'change made by revision')],
               b'hg rhdiff ([-c REV] | [-r REV] ...) [FILE]...')
def rhdiff(ui, repo, *pats, **opts):
    """diff repository (or selected files)"""
    change = opts.pop('change', None)
    if change:  # add -c option for Mercurial<1.1
        base = _changectx(repo, change).parents()[0].rev()
        opts['rev'] = [str(base), change]
    opts['nodates'] = True
    return commands.diff(ui, repo, *map(unquot_eplus, pats), **opts)
 
@command(b'rhlog',
                   [
                    (b'r', b'rev', [], b'show the specified revision'),
                    (b'b', b'branch', [],
                       b'show changesets within the given named branch'),
                    (b'l', b'limit', b'',
                         b'limit number of changes displayed'),
                    (b'd', b'date', b'',
                         b'show revisions matching date spec'),
                    (b'u', b'user', [],
                      b'revisions committed by user'),
                    (b'', b'from', b'',
                      b''),
                    (b'', b'to', b'',
                      b''),
                    (b'', b'rhbranch', b'',
                      b''),
                    (b'', b'template', b'',
                       b'display with template')],
                   b'hg rhlog [OPTION]... [FILE]')
def rhlog(ui, repo, *pats, **opts):
    rev      = opts.pop('rev')
    bra0     = opts.pop('branch')
    from_rev = unquote_plus(opts.pop('from', b''))
    to_rev   = unquote_plus(opts.pop('to'  , b''))
    bra      = unquote_plus(opts.pop('rhbranch', b''))
    from_rev = from_rev.replace(b'"', b'\\"')
    to_rev   = to_rev.replace(b'"', b'\\"')
    if (from_rev != b'') or (to_rev != b''):
        if from_rev != b'':
            quotefrom = b'"%s"' % (from_rev)
        else:
            quotefrom = from_rev
        if to_rev != b'':
            quoteto = b'"%s"' % (to_rev)
        else:
            quoteto = to_rev
        opts['rev'] = [b'%s:%s' % (quotefrom, quoteto)]
    else:
        opts['rev'] = rev
    if (bra != b''):
        opts['branch'] = [bra]
    return commands.log(ui, repo, *map(unquote_plus, pats), **opts)
 
@command(b'rhmanifest',
                   [(b'r', b'rev', b'', b'show the specified revision')],
                   b'hg rhmanifest -r REV [PATH]')
def rhmanifest(ui, repo, path=b'', **opts):
    """output the sub-manifest of the specified directory"""
    ui.write(b'<?xml version="1.0"?>\n')
    ui.write(b'<rhmanifest>\n')
    ui.write(b'<repository root="%s">\n' % _u(repo.root))
    try:
        _manifest(ui, repo, unquote_plus(path), unquote_plus(opts.get('rev')))
    finally:
        ui.write(b'</repository>\n')
        ui.write(b'</rhmanifest>\n')
 
@command(b'rhsummary',[], b'hg rhsummary')
def rhsummary(ui, repo, **opts):
    """output the summary of the repository"""
    ui.write(b'<?xml version="1.0"?>\n')
    ui.write(b'<rhsummary>\n')
    ui.write(b'<repository root="%s">\n' % _u(repo.root))
    try:
        _tip(ui, repo)
        _tags(ui, repo)
        _branches(ui, repo)
        # TODO: bookmarks in core (Mercurial>=1.8)
    finally:
        ui.write(b'</repository>\n')
        ui.write(b'</rhsummary>\n')

バッチリ SCM アダプタの Python 3 対応ができました。
Redmine mercurial リポジトリ 404 Fix

Apache のエラーログを調べる。

$ sudo tail -f /var/log/httpd/error_log
App 163759 output: Ignoring passenger-6.0.7 because its extensions are not built. Try: gem pristine passenger --version 6.0.7
App 163759 output: Ignoring passenger-6.0.2 because its extensions are not built. Try: gem pristine passenger --version 6.0.2
App 163759 output: Ignoring passenger-6.0.1 because its extensions are not built. Try: gem pristine passenger --version 6.0.1
App 163759 output: Error: The application encountered the following error: Your Ruby version is 3.0.1, but your Gemfile specified >= 2.3.0, < 2.8.0 (Bundler::RubyVersionMismatch)
App 163759 output:     /home/redmine/.gem/ruby/gems/bundler-2.1.4/lib/bundler/definition.rb:495:in `validate_ruby!'
App 163759 output:     /home/redmine/.gem/ruby/gems/bundler-2.1.4/lib/bundler/definition.rb:470:in `validate_runtime!'
App 163759 output:     /home/redmine/.gem/ruby/gems/bundler-2.1.4/lib/bundler.rb:143:in `setup'
App 163759 output:     /home/redmine/.gem/ruby/gems/bundler-2.1.4/lib/bundler/setup.rb:20:in `block in <top (required)>'
App 163759 output:     /home/redmine/.gem/ruby/gems/bundler-2.1.4/lib/bundler/ui/shell.rb:136:in `with_level'
App 163759 output:     /home/redmine/.gem/ruby/gems/bundler-2.1.4/lib/bundler/ui/shell.rb:88:in `silence'
App 163759 output:     /home/redmine/.gem/ruby/gems/bundler-2.1.4/lib/bundler/setup.rb:20:in `<top (required)>'
App 163759 output:     <internal:/usr/share/rubygems/rubygems/core_ext/kernel_require.rb>:85:in `require'
App 163759 output:     <internal:/usr/share/rubygems/rubygems/core_ext/kernel_require.rb>:85:in `require'
App 163759 output:     /home/redmine/.gem/ruby/gems/passenger-6.0.7/src/ruby_supportlib/phusion_passenger/loader_shared_helpers.rb:365:in `activate_gem'
App 163759 output:     /home/redmine/.gem/ruby/gems/passenger-6.0.7/src/ruby_supportlib/phusion_passenger/loader_shared_helpers.rb:221:in `block in run_load_path_setup_code'
App 163759 output:     /home/redmine/.gem/ruby/gems/passenger-6.0.7/src/ruby_supportlib/phusion_passenger/loader_shared_helpers.rb:529:in `running_bundler'
App 163759 output:     /home/redmine/.gem/ruby/gems/passenger-6.0.7/src/ruby_supportlib/phusion_passenger/loader_shared_helpers.rb:220:in `run_load_path_setup_code'
App 163759 output:     /home/redmine/.gem/ruby/gems/passenger-6.0.7/src/helper-scripts/rack-preloader.rb:91:in `preload_app'
App 163759 output:     /home/redmine/.gem/ruby/gems/passenger-6.0.7/src/helper-scripts/rack-preloader.rb:189:in `block in <module:App>'
App 163759 output:     /home/redmine/.gem/ruby/gems/passenger-6.0.7/src/ruby_supportlib/phusion_passenger/loader_shared_helpers.rb:382:in `run_block_and_record_step_progress'
App 163759 output:     /home/redmine/.gem/ruby/gems/passenger-6.0.7/src/helper-scripts/rack-preloader.rb:188:in `<module:App>'
App 163759 output:     /home/redmine/.gem/ruby/gems/passenger-6.0.7/src/helper-scripts/rack-preloader.rb:30:in `<module:PhusionPassenger>'
App 163759 output:     /home/redmine/.gem/ruby/gems/passenger-6.0.7/src/helper-scripts/rack-preloader.rb:29:in `<main>'
[ E 2021-07-21 02:51:53.1609 3991/Te1 age/Cor/App/Implementation.cpp:221 ]: Could not spawn process for application /var/www/vhosts/redmine.tomoyan.net/redmine: The application encountered the following error: Your Ruby version is 3.0.1, but your Gemfile specified >= 2.3.0, < 2.8.0 (Bundler::RubyVersionMismatch)
  Error ID: b8c6ec73
  Error details saved to: /tmp/passenger-error-gOYISp.html

[ E 2021-07-21 02:51:53.1678 3991/Tb age/Cor/Con/CheckoutSession.cpp:274 ]: [Client 2-50] Cannot checkout session because a spawning error occurred. The identifier of the error is b8c6ec73. Please see earlier logs for details about the error.

Fedora の更新で ruby バージョンが 3.0.1 になり…

$ ruby -v
ruby 3.0.1p64 (2021-04-05 revision 0fb782ee38) [x86_64-linux]

redmine 配下の Gemfile を書き換えて、redmine を ruby 2.7 対応に書き換える。

$ sudo nano Gemfile
Gemfile
ruby '>= 2.3.0', '< 2.8.0' if Bundler::VERSION >= '1.12.0'

 ↓

Gemfile
ruby '>= 2.3.0', '< 3.1.0'
$ sudo -s
# su - redmine
$ cd /var/www/vhosts/redmine.tomoyan.net/redmine/
$ bundle update

Ignoring passenger-6.0.7 because its extensions are not built. Try: gem pristine passenger --version 6.0.7
Ignoring passenger-6.0.2 because its extensions are not built. Try: gem pristine passenger --version 6.0.2
Ignoring passenger-6.0.1 because its extensions are not built. Try: gem pristine passenger --version 6.0.1
The dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x64-mingw32, x86-mswin32. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x64-mingw32 x86-mswin32`.
The dependency ffi (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x64-mingw32, x86-mswin32. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x64-mingw32 x86-mswin32`.
Fetching gem metadata from https://rubygems.org/..........
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies....
Fetching rake 13.0.6 (was 13.0.1)
Installing rake 13.0.6 (was 13.0.1)
Fetching concurrent-ruby 1.1.9 (was 1.1.7)
Installing concurrent-ruby 1.1.9 (was 1.1.7)
Fetching i18n 1.6.0
Installing i18n 1.6.0
Fetching minitest 5.14.4 (was 5.14.2)
Installing minitest 5.14.4 (was 5.14.2)
Fetching thread_safe 0.3.6
Installing thread_safe 0.3.6
Fetching tzinfo 1.2.9 (was 1.2.8)
Installing tzinfo 1.2.9 (was 1.2.8)
Fetching activesupport 5.2.4.2
Installing activesupport 5.2.4.2
Fetching builder 3.2.4
Installing builder 3.2.4
Fetching erubi 1.10.0
Installing erubi 1.10.0
Fetching mini_portile2 2.4.0
Installing mini_portile2 2.4.0
Fetching nokogiri 1.10.10
Installing nokogiri 1.10.10 with native extensions
Fetching rails-dom-testing 2.0.3
Installing rails-dom-testing 2.0.3
Fetching crass 1.0.6
Installing crass 1.0.6
Fetching loofah 2.10.0 (was 2.8.0)
Installing loofah 2.10.0 (was 2.8.0)
Fetching rails-html-sanitizer 1.3.0
Installing rails-html-sanitizer 1.3.0
Fetching actionview 5.2.4.2
Installing actionview 5.2.4.2
Fetching rack 2.2.3
Installing rack 2.2.3
Fetching rack-test 1.1.0
Installing rack-test 1.1.0
Fetching actionpack 5.2.4.2
Installing actionpack 5.2.4.2
Fetching nio4r 2.5.7 (was 2.5.4)
Installing nio4r 2.5.7 (was 2.5.4) with native extensions
Fetching websocket-extensions 0.1.5
Installing websocket-extensions 0.1.5
Fetching websocket-driver 0.7.5 (was 0.7.3)
Installing websocket-driver 0.7.5 (was 0.7.3) with native extensions
Fetching actioncable 5.2.4.2
Installing actioncable 5.2.4.2
Fetching globalid 0.4.2
Installing globalid 0.4.2
Fetching activejob 5.2.4.2
Installing activejob 5.2.4.2
Fetching mini_mime 1.0.3 (was 1.0.2)
Installing mini_mime 1.0.3 (was 1.0.2)
Fetching mail 2.7.1
Installing mail 2.7.1
Fetching actionmailer 5.2.4.2
Installing actionmailer 5.2.4.2
Fetching method_source 1.0.0
Installing method_source 1.0.0
Fetching thor 1.1.0 (was 1.0.1)
Installing thor 1.1.0 (was 1.0.1)
Fetching railties 5.2.4.2
Installing railties 5.2.4.2
Fetching actionpack-xml_parser 2.0.1
Installing actionpack-xml_parser 2.0.1
Fetching activemodel 5.2.4.2
Installing activemodel 5.2.4.2
Fetching arel 9.0.0
Installing arel 9.0.0
Fetching activerecord 5.2.4.2
Installing activerecord 5.2.4.2
Fetching mimemagic 0.3.10 (was 0.3.5)
Installing mimemagic 0.3.10 (was 0.3.5) with native extensions
Fetching marcel 0.3.3
Installing marcel 0.3.3
Fetching activestorage 5.2.4.2
Installing activestorage 5.2.4.2
Fetching public_suffix 4.0.6
Installing public_suffix 4.0.6
Fetching addressable 2.8.0 (was 2.7.0)
Installing addressable 2.8.0 (was 2.7.0)
Using bundler 2.1.4
Fetching css_parser 1.9.0 (was 1.7.1)
Installing css_parser 1.9.0 (was 1.7.1)
Using csv 3.1.9
Fetching htmlentities 4.3.4
Installing htmlentities 4.3.4
Fetching mini_magick 4.9.5
Installing mini_magick 4.9.5
Fetching net-ldap 0.16.3
Installing net-ldap 0.16.3
Fetching pg 1.1.4
Installing pg 1.1.4 with native extensions
Fetching ruby-openid 2.9.2
Installing ruby-openid 2.9.2
Fetching rack-openid 1.4.2
Installing rack-openid 1.4.2
Fetching sprockets 4.0.2
Installing sprockets 4.0.2
Fetching sprockets-rails 3.2.2
Installing sprockets-rails 3.2.2
Fetching rails 5.2.4.2
Installing rails 5.2.4.2
Fetching rbpdf-font 1.19.1
Installing rbpdf-font 1.19.1
Fetching rbpdf 1.20.1
Installing rbpdf 1.20.1
Fetching redcarpet 3.5.1 (was 3.5.0)
Installing redcarpet 3.5.1 (was 3.5.0) with native extensions
Fetching request_store 1.4.1
Installing request_store 1.4.1
Fetching roadie 4.0.0
Installing roadie 4.0.0
Fetching roadie-rails 2.1.1
Installing roadie-rails 2.1.1
Fetching rouge 3.12.0
Installing rouge 3.12.0
Bundle updated!
Gems in the groups development and test were not updated.
Post-install message from i18n:

HEADS UP! i18n 1.1 changed fallbacks to exclude default locale.
But that may break your application.

Please check your Rails app for 'config.i18n.fallbacks = true'.
If you're using I18n (>= 1.1.0) and Rails (< 5.2.2), this should be
'config.i18n.fallbacks = [I18n.default_locale]'.
If not, fallbacks will be broken in your app by I18n 1.1.x.

For more info see:
https://github.com/svenfuchs/i18n/releases/tag/v1.1.0

$ gem update passenger
$ passenger-install-apache2-module --auto --languages ruby
$ passenger-install-apache2-module --snippet
LoadModule passenger_module /home/redmine/.gem/ruby/gems/passenger-6.0.10/buildout/apache2/mod_passenger.so
<IfModule mod_passenger.c>
  PassengerRoot /home/redmine/.gem/ruby/gems/passenger-6.0.10
  PassengerDefaultRuby /usr/bin/ruby
</IfModule>
$ sudo nano /etc/httpd/conf.d/redmine.tomoyan.net.conf
/etc/httpd/conf.d/redmine.tomoyan.net.conf
# Passengerの基本設定。
# passenger-install-apache2-module --snippet で表示された設定を記述。
# 環境によって設定値が異なるため以下の5行はそのまま転記せず、必ず
# passenger-install-apache2-module --snippet で表示されたものを使用すること。
#
LoadModule passenger_module /home/redmine/.gem/ruby/gems/passenger-6.0.10/buildout/apache2/mod_passenger.so
<IfModule mod_passenger.c>
  PassengerRoot /home/redmine/.gem/ruby/gems/passenger-6.0.10
  PassengerDefaultRuby /usr/bin/ruby
</IfModule>
 
# Passenger の実行ユーザーも redmine にする。
PassengerUserSwitching off
PassengerDefaultUser redmine
 
# Passengerが追加するHTTPヘッダを削除するための設定(任意)
Header always unset "X-Powered-By"
Header always unset "X-Rack-Cache"
Header always unset "X-Content-Digest"
Header always unset "X-Runtime"
 
# 必要に応じてPassengerのチューニングのための設定を追加(任意)
# 詳しくはPhusion Passenger users guide を参照
# (http://www.modrails.com/documentation/Users%20guide%20Apache.html)
PassengerMaxPoolSize 2
PassengerMaxInstancesPerApp 0
PassengerPoolIdleTime 3600
PassengerHighPerformance on
PassengerStatThrottleRate 10
PassengerSpawnMethod smart
RailsAppSpawnerIdleTime 86400
PassengerMaxPreloaderIdleTime 0
 
<VirtualHost *:80>
    DocumentRoot "/var/www/vhosts/letsencrypt"
    ErrorLog "logs/redmine.tomoyan.net-error_log"
    CustomLog "logs/redmine.tomoyan.net-access_log" common
    ServerName redmine.tomoyan.net
#    Redirect "/" "https://redmine.tomoyan.net/"
    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^(redmine\.)?tomoyan\.net
    RewriteRule ^/.well-known/ - [L]
    RewriteRule ^/(.*)$ https://redmine.tomoyan.net/$1 [R=301,L]
 
    Protocols h2 h2c http/1.1
    <Directory "/var/www/vhosts/letsencrypt">
        Require all granted
        Options All
        AllowOverride All
        DirectoryIndex index.php index.html
    </Directory>
</VirtualHost>
<VirtualHost *:443>
    DocumentRoot "/var/www/vhosts/redmine.tomoyan.net/redmine/public"
    ErrorLog "logs/redmine.tomoyan.net-ssl_error_log"
    CustomLog "logs/redmine.tomoyan.net-ssl_access_log" common
    ServerName redmine.tomoyan.net
 
    SSLEngine on
    SSLProtocol all -SSLv2 -SSLv3
    SSLCipherSuite !3DES:!aNULL:EDH+HIGH:ECDH+HIGH:-AES128:-3DES:-DSS:ECDHE-RSA-AES128-SHA:DHE-RSA-AES128-SHA
    SSLHonorCipherOrder on
    SSLCertificateFile /etc/letsencrypt/live/tomoyan.net/cert.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/tomoyan.net/privkey.pem
    SSLCertificateChainFile /etc/letsencrypt/live/tomoyan.net/chain.pem
    # Redmineの画像ファイル・CSSファイル等へのアクセスを許可する設定。
    # Apache 2.4のデフォルトではサーバ上の全ファイルへのアクセスが禁止されている。
    Protocols h2 h2c http/1.1
    <Directory "/var/www/vhosts/redmine.tomoyan.net/redmine/public">
        Require all granted
    </Directory>
 
    Header always unset "X-Powered-By"
    Header always unset "X-Runtime"
</VirtualHost>

reload ではなく restart する。

$ sudo systemctl restart httpd

Apache のエラーログを調べる。

$ sudo tail -f /var/log/httpd/error_log
App 36650 output: Ignoring passenger-6.0.7 because its extensions are not built. Try: gem pristine passenger --version 6.0.7
App 36650 output: Ignoring passenger-6.0.2 because its extensions are not built. Try: gem pristine passenger --version 6.0.2
App 36650 output: Ignoring passenger-6.0.1 because its extensions are not built. Try: gem pristine passenger --version 6.0.1
App 36650 output: Error: The application encountered the following error: wrong number of arguments (given 3, expected 2) (ArgumentError)
App 36650 output:     /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/3.0.0/gems/activerecord-5.2.4.2/lib/active_record/type/adapter_specific_registry.rb:9:in `add_modifier'
App 36650 output:     /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/3.0.0/gems/activerecord-5.2.4.2/lib/active_record/type.rb:27:in `add_modifier'
App 36650 output:     /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/3.0.0/gems/activerecord-5.2.4.2/lib/active_record/connection_adapters/postgresql_adapter.rb:842:in `<class:PostgreSQLAdapter>'
App 36650 output:     /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/3.0.0/gems/activerecord-5.2.4.2/lib/active_record/connection_adapters/postgresql_adapter.rb:80:in `<module:ConnectionAdapters>'
App 36650 output:     /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/3.0.0/gems/activerecord-5.2.4.2/lib/active_record/connection_adapters/postgresql_adapter.rb:52:in `<module:ActiveRecord>'
App 36650 output:     /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/3.0.0/gems/activerecord-5.2.4.2/lib/active_record/connection_adapters/postgresql_adapter.rb:30:in `<top (required)>'
App 36650 output:     /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/3.0.0/gems/activesupport-5.2.4.2/lib/active_support/dependencies.rb:291:in `require'
App 36650 output:     /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/3.0.0/gems/activesupport-5.2.4.2/lib/active_support/dependencies.rb:291:in `block in require'
App 36650 output:     /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/3.0.0/gems/activesupport-5.2.4.2/lib/active_support/dependencies.rb:257:in `load_dependency'
App 36650 output:     /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/3.0.0/gems/activesupport-5.2.4.2/lib/active_support/dependencies.rb:291:in `require'
App 36650 output:     /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/3.0.0/gems/activerecord-5.2.4.2/lib/active_record/connection_adapters/connection_specification.rb:191:in `spec'
App 36650 output:     /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/3.0.0/gems/activerecord-5.2.4.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:975:in `establish_connection'
App 36650 output:     /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/3.0.0/gems/activerecord-5.2.4.2/lib/active_record/connection_handling.rb:60:in `establish_connection'
App 36650 output:     /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/3.0.0/gems/activerecord-5.2.4.2/lib/active_record/railtie.rb:136:in `block (2 levels) in <class:Railtie>'
App 36650 output:     /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/3.0.0/gems/activesupport-5.2.4.2/lib/active_support/lazy_load_hooks.rb:71:in `instance_eval'
App 36650 output:     /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/3.0.0/gems/activesupport-5.2.4.2/lib/active_support/lazy_load_hooks.rb:71:in `block in execute_hook'
App 36650 output:     /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/3.0.0/gems/activesupport-5.2.4.2/lib/active_support/lazy_load_hooks.rb:62:in `with_execution_control'
App 36650 output:     /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/3.0.0/gems/activesupport-5.2.4.2/lib/active_support/lazy_load_hooks.rb:67:in `execute_hook'
App 36650 output:     /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/3.0.0/gems/activesupport-5.2.4.2/lib/active_support/lazy_load_hooks.rb:52:in `block in run_load_hooks'
App 36650 output:     /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/3.0.0/gems/activesupport-5.2.4.2/lib/active_support/lazy_load_hooks.rb:51:in `each'
App 36650 output:     /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/3.0.0/gems/activesupport-5.2.4.2/lib/active_support/lazy_load_hooks.rb:51:in `run_load_hooks'
App 36650 output:     /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/3.0.0/gems/activerecord-5.2.4.2/lib/active_record/base.rb:328:in `<module:ActiveRecord>'
App 36650 output:     /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/3.0.0/gems/activerecord-5.2.4.2/lib/active_record/base.rb:27:in `<top (required)>'
App 36650 output:     /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/3.0.0/gems/activesupport-5.2.4.2/lib/active_support/dependencies.rb:291:in `require'
App 36650 output:     /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/3.0.0/gems/activesupport-5.2.4.2/lib/active_support/dependencies.rb:291:in `block in require'
App 36650 output:     /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/3.0.0/gems/activesupport-5.2.4.2/lib/active_support/dependencies.rb:257:in `load_dependency'
App 36650 output:     /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/3.0.0/gems/activesupport-5.2.4.2/lib/active_support/dependencies.rb:291:in `require'
App 36650 output:     /var/www/vhosts/redmine.tomoyan.net/redmine/lib/plugins/acts_as_activity_provider/init.rb:4:in `block in <top (required)>'
App 36650 output:     /var/www/vhosts/redmine.tomoyan.net/redmine/config/initializers/00-core_plugins.rb:14:in `eval'
App 36650 output:     /var/www/vhosts/redmine.tomoyan.net/redmine/config/initializers/00-core_plugins.rb:14:in `block in <top (required)>'
App 36650 output:     /var/www/vhosts/redmine.tomoyan.net/redmine/config/initializers/00-core_plugins.rb:4:in `each'
App 36650 output:     /var/www/vhosts/redmine.tomoyan.net/redmine/config/initializers/00-core_plugins.rb:4:in `<top (required)>'
App 36650 output:     /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/3.0.0/gems/activesupport-5.2.4.2/lib/active_support/dependencies.rb:285:in `load'
App 36650 output:     /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/3.0.0/gems/activesupport-5.2.4.2/lib/active_support/dependencies.rb:285:in `block in load'
App 36650 output:     /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/3.0.0/gems/activesupport-5.2.4.2/lib/active_support/dependencies.rb:257:in `load_dependency'
App 36650 output:     /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/3.0.0/gems/activesupport-5.2.4.2/lib/active_support/dependencies.rb:285:in `load'
App 36650 output:     /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/3.0.0/gems/railties-5.2.4.2/lib/rails/engine.rb:663:in `block in load_config_initializer'
App 36650 output:     /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/3.0.0/gems/activesupport-5.2.4.2/lib/active_support/notifications.rb:170:in `instrument'
App 36650 output:     /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/3.0.0/gems/railties-5.2.4.2/lib/rails/engine.rb:662:in `load_config_initializer'
App 36650 output:     /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/3.0.0/gems/railties-5.2.4.2/lib/rails/engine.rb:620:in `block (2 levels) in <class:Engine>'
App 36650 output:     /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/3.0.0/gems/railties-5.2.4.2/lib/rails/engine.rb:619:in `each'
App 36650 output:     /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/3.0.0/gems/railties-5.2.4.2/lib/rails/engine.rb:619:in `block in <class:Engine>'
App 36650 output:     /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/3.0.0/gems/railties-5.2.4.2/lib/rails/initializable.rb:32:in `instance_exec'
App 36650 output:     /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/3.0.0/gems/railties-5.2.4.2/lib/rails/initializable.rb:32:in `run'
App 36650 output:     /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/3.0.0/gems/railties-5.2.4.2/lib/rails/initializable.rb:61:in `block in run_initializers'
App 36650 output:     /usr/share/ruby/tsort.rb:228:in `block in tsort_each'
App 36650 output:     /usr/share/ruby/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
App 36650 output:     /usr/share/ruby/tsort.rb:422:in `block (2 levels) in each_strongly_connected_component_from'
App 36650 output:     /usr/share/ruby/tsort.rb:431:in `each_strongly_connected_component_from'
App 36650 output:     /usr/share/ruby/tsort.rb:421:in `block in each_strongly_connected_component_from'
App 36650 output:     /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/3.0.0/gems/railties-5.2.4.2/lib/rails/initializable.rb:50:in `each'
App 36650 output:     /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/3.0.0/gems/railties-5.2.4.2/lib/rails/initializable.rb:50:in `tsort_each_child'
App 36650 output:     /usr/share/ruby/tsort.rb:415:in `call'
App 36650 output:     /usr/share/ruby/tsort.rb:415:in `each_strongly_connected_component_from'
App 36650 output:     /usr/share/ruby/tsort.rb:349:in `block in each_strongly_connected_component'
App 36650 output:     /usr/share/ruby/tsort.rb:347:in `each'
App 36650 output:     /usr/share/ruby/tsort.rb:347:in `call'
App 36650 output:     /usr/share/ruby/tsort.rb:347:in `each_strongly_connected_component'
App 36650 output:     /usr/share/ruby/tsort.rb:226:in `tsort_each'
App 36650 output:     /usr/share/ruby/tsort.rb:205:in `tsort_each'
App 36650 output:     /var/www/vhosts/redmine.tomoyan.net/redmine/v
App 36650 output: endor/bundle/ruby/3.0.0/gems/railties-5.2.4.2/lib/rails/initializable.rb:60:in `run_initializers'
App 36650 output:     /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/3.0.0/gems/railties-5.2.4.2/lib/rails/application.rb:361:in `initialize!'
App 36650 output:     /var/www/vhosts/redmine.tomoyan.net/redmine/config/environment.rb:16:in `<top (required)>'
App 36650 output:     config.ru:3:in `require'
App 36650 output:     config.ru:3:in `block in <main>'
App 36650 output:     /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/3.0.0/gems/rack-2.2.3/lib/rack/builder.rb:125:in `instance_eval'
App 36650 output:     /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/3.0.0/gems/rack-2.2.3/lib/rack/builder.rb:125:in `initialize'
App 36650 output:     config.ru:1:in `new'
App 36650 output:     config.ru:1:in `<main>'
App 36650 output:     /home/redmine/.gem/ruby/gems/passenger-6.0.10/src/helper-scripts/rack-preloader.rb:101:in `eval'
App 36650 output:     /home/redmine/.gem/ruby/gems/passenger-6.0.10/src/helper-scripts/rack-preloader.rb:101:in `preload_app'
App 36650 output:     /home/redmine/.gem/ruby/gems/passenger-6.0.10/src/helper-scripts/rack-preloader.rb:189:in `block in <module:App>'
App 36650 output:     /home/redmine/.gem/ruby/gems/passenger-6.0.10/src/ruby_supportlib/phusion_passenger/loader_shared_helpers.rb:390:in `run_block_and_record_step_progress'
App 36650 output:     /home/redmine/.gem/ruby/gems/passenger-6.0.10/src/helper-scripts/rack-preloader.rb:188:in `<module:App>'
App 36650 output:     /home/redmine/.gem/ruby/gems/passenger-6.0.10/src/helper-scripts/rack-preloader.rb:30:in `<module:PhusionPassenger>'
App 36650 output:     /home/redmine/.gem/ruby/gems/passenger-6.0.10/src/helper-scripts/rack-preloader.rb:29:in `<main>'
[ E 2021-07-21 14:39:37.8289 36367/Tp age/Cor/App/Implementation.cpp:221 ]: Could not spawn process for application /var/www/vhosts/redmine.tomoyan.net/redmine: The application encountered the following error: wrong number of arguments (given 3, expected 2) (ArgumentError)
  Error ID: c31ba95b
  Error details saved to: /tmp/passenger-error-58e9Wj.html

[ E 2021-07-21 14:39:37.8350 36367/T9 age/Cor/Con/CheckoutSession.cpp:274 ]: [Client 1-2] Cannot checkout session because a spawning error occurred. The identifier of the error is c31ba95b. Please see earlier logs for details about the error.

ruby で Redmine のバージョン確認を実行してみる。

$ ruby bin/about
/var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/3.0.0/gems/activerecord-5.2.4.2/lib/active_record/type/adapter_specific_registry.rb:9:in `add_modifier': wrong number of arguments (given 3, expected 2) (ArgumentError)
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/3.0.0/gems/activerecord-5.2.4.2/lib/active_record/type.rb:27:in `add_modifier'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/3.0.0/gems/activerecord-5.2.4.2/lib/active_record/connection_adapters/postgresql_adapter.rb:842:in `<class:PostgreSQLAdapter>'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/3.0.0/gems/activerecord-5.2.4.2/lib/active_record/connection_adapters/postgresql_adapter.rb:80:in `<module:ConnectionAdapters>'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/3.0.0/gems/activerecord-5.2.4.2/lib/active_record/connection_adapters/postgresql_adapter.rb:52:in `<module:ActiveRecord>'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/3.0.0/gems/activerecord-5.2.4.2/lib/active_record/connection_adapters/postgresql_adapter.rb:30:in `<top (required)>'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/3.0.0/gems/activesupport-5.2.4.2/lib/active_support/dependencies.rb:291:in `require'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/3.0.0/gems/activesupport-5.2.4.2/lib/active_support/dependencies.rb:291:in `block in require'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/3.0.0/gems/activesupport-5.2.4.2/lib/active_support/dependencies.rb:257:in `load_dependency'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/3.0.0/gems/activesupport-5.2.4.2/lib/active_support/dependencies.rb:291:in `require'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/3.0.0/gems/activerecord-5.2.4.2/lib/active_record/connection_adapters/connection_specification.rb:191:in `spec'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/3.0.0/gems/activerecord-5.2.4.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:975:in `establish_connection'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/3.0.0/gems/activerecord-5.2.4.2/lib/active_record/connection_handling.rb:60:in `establish_connection'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/3.0.0/gems/activerecord-5.2.4.2/lib/active_record/railtie.rb:136:in `block (2 levels) in <class:Railtie>'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/3.0.0/gems/activesupport-5.2.4.2/lib/active_support/lazy_load_hooks.rb:71:in `instance_eval'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/3.0.0/gems/activesupport-5.2.4.2/lib/active_support/lazy_load_hooks.rb:71:in `block in execute_hook'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/3.0.0/gems/activesupport-5.2.4.2/lib/active_support/lazy_load_hooks.rb:62:in `with_execution_control'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/3.0.0/gems/activesupport-5.2.4.2/lib/active_support/lazy_load_hooks.rb:67:in `execute_hook'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/3.0.0/gems/activesupport-5.2.4.2/lib/active_support/lazy_load_hooks.rb:52:in `block in run_load_hooks'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/3.0.0/gems/activesupport-5.2.4.2/lib/active_support/lazy_load_hooks.rb:51:in `each'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/3.0.0/gems/activesupport-5.2.4.2/lib/active_support/lazy_load_hooks.rb:51:in `run_load_hooks'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/3.0.0/gems/activerecord-5.2.4.2/lib/active_record/base.rb:328:in `<module:ActiveRecord>'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/3.0.0/gems/activerecord-5.2.4.2/lib/active_record/base.rb:27:in `<top (required)>'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/3.0.0/gems/activesupport-5.2.4.2/lib/active_support/dependencies.rb:291:in `require'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/3.0.0/gems/activesupport-5.2.4.2/lib/active_support/dependencies.rb:291:in `block in require'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/3.0.0/gems/activesupport-5.2.4.2/lib/active_support/dependencies.rb:257:in `load_dependency'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/3.0.0/gems/activesupport-5.2.4.2/lib/active_support/dependencies.rb:291:in `require'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/lib/plugins/acts_as_activity_provider/init.rb:4:in `block in <top (required)>'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/config/initializers/00-core_plugins.rb:14:in `eval'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/config/initializers/00-core_plugins.rb:14:in `block in <top (required)>'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/config/initializers/00-core_plugins.rb:4:in `each'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/config/initializers/00-core_plugins.rb:4:in `<top (required)>'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/3.0.0/gems/activesupport-5.2.4.2/lib/active_support/dependencies.rb:285:in `load'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/3.0.0/gems/activesupport-5.2.4.2/lib/active_support/dependencies.rb:285:in `block in load'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/3.0.0/gems/activesupport-5.2.4.2/lib/active_support/dependencies.rb:257:in `load_dependency'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/3.0.0/gems/activesupport-5.2.4.2/lib/active_support/dependencies.rb:285:in `load'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/3.0.0/gems/railties-5.2.4.2/lib/rails/engine.rb:663:in `block in load_config_initializer'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/3.0.0/gems/activesupport-5.2.4.2/lib/active_support/notifications.rb:170:in `instrument'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/3.0.0/gems/railties-5.2.4.2/lib/rails/engine.rb:662:in `load_config_initializer'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/3.0.0/gems/railties-5.2.4.2/lib/rails/engine.rb:620:in `block (2 levels) in <class:Engine>'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/3.0.0/gems/railties-5.2.4.2/lib/rails/engine.rb:619:in `each'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/3.0.0/gems/railties-5.2.4.2/lib/rails/engine.rb:619:in `block in <class:Engine>'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/3.0.0/gems/railties-5.2.4.2/lib/rails/initializable.rb:32:in `instance_exec'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/3.0.0/gems/railties-5.2.4.2/lib/rails/initializable.rb:32:in `run'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/3.0.0/gems/railties-5.2.4.2/lib/rails/initializable.rb:61:in `block in run_initializers'
        from /usr/share/ruby/tsort.rb:228:in `block in tsort_each'
        from /usr/share/ruby/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
        from /usr/share/ruby/tsort.rb:422:in `block (2 levels) in each_strongly_connected_component_from'
        from /usr/share/ruby/tsort.rb:431:in `each_strongly_connected_component_from'
        from /usr/share/ruby/tsort.rb:421:in `block in each_strongly_connected_component_from'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/3.0.0/gems/railties-5.2.4.2/lib/rails/initializable.rb:50:in `each'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/3.0.0/gems/railties-5.2.4.2/lib/rails/initializable.rb:50:in `tsort_each_child'
        from /usr/share/ruby/tsort.rb:415:in `call'
        from /usr/share/ruby/tsort.rb:415:in `each_strongly_connected_component_from'
        from /usr/share/ruby/tsort.rb:349:in `block in each_strongly_connected_component'
        from /usr/share/ruby/tsort.rb:347:in `each'
        from /usr/share/ruby/tsort.rb:347:in `call'
        from /usr/share/ruby/tsort.rb:347:in `each_strongly_connected_component'
        from /usr/share/ruby/tsort.rb:226:in `tsort_each'
        from /usr/share/ruby/tsort.rb:205:in `tsort_each'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/3.0.0/gems/railties-5.2.4.2/lib/rails/initializable.rb:60:in `run_initializers'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/3.0.0/gems/railties-5.2.4.2/lib/rails/application.rb:361:in `initialize!'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/config/environment.rb:16:in `<top (required)>'
        from <internal:/usr/share/rubygems/rubygems/core_ext/kernel_require.rb>:85:in `require'
        from <internal:/usr/share/rubygems/rubygems/core_ext/kernel_require.rb>:85:in `require'
        from bin/about:4:in `<main>'

Apache のエラーログを調べる。

$ sudo tail -f /var/log/httpd/error_log
App 2452317 output: Ignoring passenger-6.0.2 because its extensions are not built. Try: gem pristine passenger --version 6.0.2
App 2452317 output: Ignoring passenger-6.0.1 because its extensions are not built. Try: gem pristine passenger --version 6.0.1
App 2452317 output: Error: The application encountered the following error: Your Ruby version is 2.7.1, but your Gemfile specified >= 2.3.0, < 2.7.0 (Bundler::RubyVersionMismatch)
App 2452317 output:     /home/redmine/.gem/ruby/gems/bundler-2.1.4/lib/bundler/definition.rb:495:in `validate_ruby!'
App 2452317 output:     /home/redmine/.gem/ruby/gems/bundler-2.1.4/lib/bundler/definition.rb:470:in `validate_runtime!'
App 2452317 output:     /home/redmine/.gem/ruby/gems/bundler-2.1.4/lib/bundler.rb:143:in `setup'
App 2452317 output:     /home/redmine/.gem/ruby/gems/bundler-2.1.4/lib/bundler/setup.rb:20:in `block in <top (required)>'
App 2452317 output:     /home/redmine/.gem/ruby/gems/bundler-2.1.4/lib/bundler/ui/shell.rb:136:in `with_level'
App 2452317 output:     /home/redmine/.gem/ruby/gems/bundler-2.1.4/lib/bundler/ui/shell.rb:88:in `silence'
App 2452317 output:     /home/redmine/.gem/ruby/gems/bundler-2.1.4/lib/bundler/setup.rb:20:in `<top (required)>'
App 2452317 output:     /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:83:in `require'
App 2452317 output:     /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:83:in `require'
App 2452317 output:     /home/redmine/.gem/ruby/gems/passenger-6.0.2/src/ruby_supportlib/phusion_passenger/loader_shared_helpers.rb:363:in `activate_gem'
App 2452317 output:     /home/redmine/.gem/ruby/gems/passenger-6.0.2/src/ruby_supportlib/phusion_passenger/loader_shared_helpers.rb:221:in `block in run_load_path_setup_code'
App 2452317 output:     /home/redmine/.gem/ruby/gems/passenger-6.0.2/src/ruby_supportlib/phusion_passenger/loader_shared_helpers.rb:527:in `running_bundler'
App 2452317 output:     /home/redmine/.gem/ruby/gems/passenger-6.0.2/src/ruby_supportlib/phusion_passenger/loader_shared_helpers.rb:220:in `run_load_path_setup_code'
App 2452317 output:     /home/redmine/.gem/ruby/gems/passenger-6.0.2/src/helper-scripts/rack-preloader.rb:91:in `preload_app'
App 2452317 output:     /home/redmine/.gem/ruby/gems/passenger-6.0.2/src/helper-scripts/rack-preloader.rb:189:in `block in <module:App>'
App 2452317 output:     /home/redmine/.gem/ruby/gems/passenger-6.0.2/src/ruby_supportlib/phusion_passenger/loader_shared_helpers.rb:380:in `run_block_and_record_step_progress'
App 2452317 output:     /home/redmine/.gem/ruby/gems/passenger-6.0.2/src/helper-scripts/rack-preloader.rb:188:in `<module:App>'
App 2452317 output:     /home/redmine/.gem/ruby/gems/passenger-6.0.2/src/helper-scripts/rack-preloader.rb:30:in `<module:PhusionPassenger>'
App 2452317 output:     /home/redmine/.gem/ruby/gems/passenger-6.0.2/src/helper-scripts/rack-preloader.rb:29:in `<main>'
[ E 2020-12-15 22:00:28.9621 786/T2rq age/Cor/App/Implementation.cpp:221 ]: Could not spawn process for application /var/www/vhosts/redmine.tomoyan.net/redmine: The application encountered the following error: Your Ruby version is 2.7.1, but your Gemfile specified >= 2.3.0, < 2.7.0 (Bundler::RubyVersionMismatch)
  Error ID: f6890c82
  Error details saved to: /tmp/passenger-error-06Uq4E.html

[ E 2020-12-15 22:00:28.9701 786/T9 age/Cor/Con/CheckoutSession.cpp:274 ]: [Client 2-359] Cannot checkout session because a spawning error occurred. The identifier of the error is f6890c82. Please see earlier logs for details about the error.

Fedora の更新で ruby バージョンが 2.7.1 になり…

$ ruby -v
ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-linux]
$ sudo -s
# su - redmine
$ cd /var/www/vhosts/redmine.tomoyan.net/redmine/
$ bundle update
Ignoring passenger-6.0.2 because its extensions are not built. Try: gem pristine passenger --version 6.0.2
Ignoring passenger-6.0.1 because its extensions are not built. Try: gem pristine passenger --version 6.0.1
Your Ruby version is 2.7.1, but your Gemfile specified >= 2.3.0, < 2.7.0
Ruby のバージョンは 2.7.1 ですが、Gemfile で指定されている >= 2.3.0, < 2.7.0

Feature #31500: Ruby 2.7 support - Redmine

redmine 配下の Gemfile を書き換えて、redmine を ruby 2.7 対応に書き換える。

$ vi Gemfile
Gemfile
ruby '>= 2.3.0', '< 2.7.0' if Bundler::VERSION >= '1.12.0'

 ↓

Gemfile
ruby '>= 2.3.0', '< 2.8.0' if Bundler::VERSION >= '1.12.0'
$ bundle update
Ignoring passenger-6.0.2 because its extensions are not built. Try: gem pristine passenger --version 6.0.2
Ignoring passenger-6.0.1 because its extensions are not built. Try: gem pristine passenger --version 6.0.1
The dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x64-mingw32, x86-mswin32. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x64-mingw32 x86-mswin32`.
The dependency ffi (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x64-mingw32, x86-mswin32. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x64-mingw32 x86-mswin32`.
Fetching gem metadata from https://rubygems.org/..........
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies....
Fetching rake 13.0.1
Installing rake 13.0.1
Fetching concurrent-ruby 1.1.7 (was 1.1.6)
Installing concurrent-ruby 1.1.7 (was 1.1.6)
Fetching i18n 1.6.0
Installing i18n 1.6.0
Fetching minitest 5.14.2 (was 5.14.1)
Installing minitest 5.14.2 (was 5.14.1)
Fetching thread_safe 0.3.6
Installing thread_safe 0.3.6
Fetching tzinfo 1.2.8 (was 1.2.7)
Installing tzinfo 1.2.8 (was 1.2.7)
Fetching activesupport 5.2.4.2
Installing activesupport 5.2.4.2
Fetching builder 3.2.4
Installing builder 3.2.4
Fetching erubi 1.10.0 (was 1.9.0)
Installing erubi 1.10.0 (was 1.9.0)
Fetching mini_portile2 2.4.0
Installing mini_portile2 2.4.0
Fetching nokogiri 1.10.10 (was 1.10.9)
Installing nokogiri 1.10.10 (was 1.10.9) with native extensions
Fetching rails-dom-testing 2.0.3
Installing rails-dom-testing 2.0.3
Fetching crass 1.0.6
Installing crass 1.0.6
Fetching loofah 2.8.0 (was 2.6.0)
Installing loofah 2.8.0 (was 2.6.0)
Fetching rails-html-sanitizer 1.3.0
Installing rails-html-sanitizer 1.3.0
Fetching actionview 5.2.4.2
Installing actionview 5.2.4.2
Fetching rack 2.2.3
Installing rack 2.2.3
Fetching rack-test 1.1.0
Installing rack-test 1.1.0
Fetching actionpack 5.2.4.2
Installing actionpack 5.2.4.2
Fetching nio4r 2.5.4 (was 2.5.2)
Installing nio4r 2.5.4 (was 2.5.2) with native extensions
Fetching websocket-extensions 0.1.5
Installing websocket-extensions 0.1.5
Fetching websocket-driver 0.7.3 (was 0.7.2)
Installing websocket-driver 0.7.3 (was 0.7.2) with native extensions
Fetching actioncable 5.2.4.2
Installing actioncable 5.2.4.2
Fetching globalid 0.4.2
Installing globalid 0.4.2
Fetching activejob 5.2.4.2
Installing activejob 5.2.4.2
Fetching mini_mime 1.0.2
Installing mini_mime 1.0.2
Fetching mail 2.7.1
Installing mail 2.7.1
Fetching actionmailer 5.2.4.2
Installing actionmailer 5.2.4.2
Fetching method_source 1.0.0
Installing method_source 1.0.0
Fetching thor 1.0.1
Installing thor 1.0.1
Fetching railties 5.2.4.2
Installing railties 5.2.4.2
Fetching actionpack-xml_parser 2.0.1
Installing actionpack-xml_parser 2.0.1
Fetching activemodel 5.2.4.2
Installing activemodel 5.2.4.2
Fetching arel 9.0.0
Installing arel 9.0.0
Fetching activerecord 5.2.4.2
Installing activerecord 5.2.4.2
Fetching mimemagic 0.3.5
Installing mimemagic 0.3.5
Fetching marcel 0.3.3
Installing marcel 0.3.3
Fetching activestorage 5.2.4.2
Installing activestorage 5.2.4.2
Fetching public_suffix 4.0.6 (was 4.0.5)
Installing public_suffix 4.0.6 (was 4.0.5)
Fetching addressable 2.7.0
Installing addressable 2.7.0
Using bundler 2.1.4
Fetching css_parser 1.7.1
Installing css_parser 1.7.1
Fetching csv 3.1.9 (was 3.1.5)
Installing csv 3.1.9 (was 3.1.5)
Fetching htmlentities 4.3.4
Installing htmlentities 4.3.4
Fetching mini_magick 4.9.5
Installing mini_magick 4.9.5
Fetching net-ldap 0.16.3 (was 0.16.2)
Installing net-ldap 0.16.3 (was 0.16.2)
Fetching pg 1.1.4
Installing pg 1.1.4 with native extensions
Fetching ruby-openid 2.9.2
Installing ruby-openid 2.9.2
Fetching rack-openid 1.4.2
Installing rack-openid 1.4.2
Fetching sprockets 4.0.2
Installing sprockets 4.0.2
Fetching sprockets-rails 3.2.2 (was 3.2.1)
Installing sprockets-rails 3.2.2 (was 3.2.1)
Fetching rails 5.2.4.2
Installing rails 5.2.4.2
Fetching rbpdf-font 1.19.1
Installing rbpdf-font 1.19.1
Fetching rbpdf 1.20.1
Installing rbpdf 1.20.1
Fetching redcarpet 3.5.0
Installing redcarpet 3.5.0 with native extensions
Fetching request_store 1.4.1
Installing request_store 1.4.1
Fetching roadie 4.0.0
Installing roadie 4.0.0
Fetching roadie-rails 2.1.1
Installing roadie-rails 2.1.1
Fetching rouge 3.12.0
Installing rouge 3.12.0
Bundle updated!
Gems in the groups development and test were not updated.
Post-install message from i18n:

HEADS UP! i18n 1.1 changed fallbacks to exclude default locale.
But that may break your application.

Please check your Rails app for 'config.i18n.fallbacks = true'.
If you're using I18n (>= 1.1.0) and Rails (< 5.2.2), this should be
'config.i18n.fallbacks = [I18n.default_locale]'.
If not, fallbacks will be broken in your app by I18n 1.1.x.

For more info see:
https://github.com/svenfuchs/i18n/releases/tag/v1.1.0

Passenger を最新化する。

$ gem update passenger
Ignoring passenger-6.0.2 because its extensions are not built. Try: gem pristine passenger --version 6.0.2
Ignoring passenger-6.0.1 because its extensions are not built. Try: gem pristine passenger --version 6.0.1
Updating installed gems
Updating passenger
Fetching passenger-6.0.7.gem
Building native extensions. This could take a while...
Successfully installed passenger-6.0.7
Parsing documentation for passenger-6.0.7
Installing ri documentation for passenger-6.0.7
Installing darkfish documentation for passenger-6.0.7
Done installing documentation for passenger after 673 seconds
Parsing documentation for passenger-6.0.7
Done installing documentation for passenger after 11 seconds
Gems updated: passenger

PassengerのApache用モジュールをインストールする。

$ passenger-install-apache2-module --auto --languages ruby
Ignoring passenger-6.0.2 because its extensions are not built. Try: gem pristine passenger --version 6.0.2
Ignoring passenger-6.0.1 because its extensions are not built. Try: gem pristine passenger --version 6.0.1
Welcome to the Phusion Passenger Apache 2 module installer, v6.0.7.

This installer will guide you through the entire installation process. It
shouldn't take more than 3 minutes in total.

Here's what you can expect from the installation process:

 1. The Apache 2 module will be installed for you.
 2. You'll learn how to configure Apache.
 3. You'll learn how to deploy a Ruby on Rails application.

Don't worry if anything goes wrong. This installer will advise you on how to
solve any problems.

Press Enter to continue, or Ctrl-C to abort.

--------------------------------------------

Which languages are you interested in?

Override selection with --lanusr/bin/curl-config
      Header location: somewhere, not sure where
      Version: libcurl 7.69.1
      Usable: yes
      Supports SSL: yes
 * Checking for Zlib development headers...
      Found: yes
      Location: true
 * Checking for Apache 2...
      Found: yes
      Location of httpd: /usr/sbin/httpd
      Apache version: 2.4.43
 * Checking for Rake (associated with /usr/bin/ruby)...
      Found: yes
      Location: /usr/bin/ruby /home/redmine/bin/rake
 * Checking for OpenSSL support for Ruby.

...

In file included from src/agent/Shared/ApiServerUtils.h:68,
                 from src/agent/Core/CoreMain.cpp:78:
src/cxx_supportlib/DataStructures/LString.h: 大域スコープ:
src/cxx_supportlib/DataStructures/LString.h:83:2: 警告: ‘always_inline’ function might not be inlinable [-Wattributes]
   83 |  psg_lstr_last_byte(const LString *str) {
      |  ^~~~~~~~~~~~~~~~~~
src/cxx_supportlib/DataStructures/LString.h:78:2: 警告: ‘always_inline’ function might not be inlinable [-Wattributes]
   78 |  psg_lstr_first_byte(const LString *str) {
      |  ^~~~~~~~~~~~~~~~~~~
c++: 致命的エラー: 強制終了 signal terminated program cc1plus
コンパイルを停止しました。
rake aborted!
Command failed with status (1): [c++ -o buildout/support-binaries/CoreMain.o  -Isrc/agent -Isrc/cxx_supportlib -Isrc/cxx_supportlib/vendor-copy -Isrc/cxx_supportlib/vendor-modified -Isrc/cxx_supportlib/vendor-modified/libev -Isrc/cxx_supportlib/vendor-copy/libuv/include -Isrc/cxx_supportlib/vendor-copy/websocketpp -D_REENTRANT -I/usr/local/include -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-long-long -Wno-missing-field-initializers -feliminate-unused-debug-symbols -feliminate-unused-debug-types -fvisibility=hidden -DVISIBILITY_ATTRIBUTE_SUPPORTED -DHAS_ALLOCA_H -DHAVE_ACCEPT4 -DHAS_SFENCE -DHAS_LFENCE -DPASSENGER_DEBUG -DBOOST_DISABLE_ASSERTS -g -std=gnu++11 -Wno-unused-local-typedefs -Wno-format-nonliteral -DHAS_UNORDERED_MAP -c src/agent/Core/CoreMain.cpp]
/home/redmine/.gem/ruby/gems/passenger-6.0.7/build/support/cplusplus.rb:53:in `run_compiler'
/home/redmine/.gem/ruby/gems/passenger-6.0.7/build/support/cplusplus.rb:104:in `compile_cxx'
/home/redmine/.gem/ruby/gems/passenger-6.0.7/build/support/cplusplus.rb:162:in `block in define_cxx_object_compilation_task'
/home/redmine/.gem/ruby/gems/rake-12.3.2/exe/rake:27:in `<top (required)>'
Tasks: TOP => apache2 => buildout/support-binaries/PassengerAgent => buildout/support-binaries/CoreMain.o
(See full trace by running task with --trace)

--------------------------------------------

It looks like something went wrong

Please read our documentation for troubleshooting tips:

   https://www.phusionpassenger.com/library/install/apache/
   https://www.phusionpassenger.com/library/admin/apache/troubleshooting/

If that doesn't help, please use our support facilities. We'll do our best to help you.

   https://www.phusionpassenger.com/support

サーバーがメモリー不足だと passenger のビルドに失敗する。

c++: 致命的エラー: 強制終了 signal terminated program cc1plus
コンパイルを停止しました。
rake aborted!

サーバーを再起動後にビルドし直す。

$ sudo reboot
$ sudo -s
# su - redmine
$ passenger-install-apache2-module --auto --languages ruby
$ sudo tail -f /var/log/httpd/error_log
App 1261 output:     /home/redmine/.gem/ruby/gems/passenger-6.0.7/src/ruby_supportlib/phusion_passenger/loader_shared_helpers.rb:382:in `run_block_and_record_step_progress'
App 1261 output:     /home/redmine/.gem/ruby/gems/passenger-6.0.7/src/helper-scripts/rack-preloader.rb:188:in `<module:App>'
App 1261 output:     /home/redmine/.gem/ruby/gems/passenger-6.0.7/src/helper-scripts/rack-preloader.rb:30:in `<module:PhusionPassenger>'
App 1261 output:     /home/redmine/.gem/ruby/gems/passenger-6.0.7/src/helper-scripts/rack-preloader.rb:29:in `<main>'
[ E 2020-12-16 05:10:37.9032 861/Tf age/Cor/App/Implementation.cpp:221 ]: Could not spawn process for application /var/www/vhosts/redmine.tomoyan.net/redmine: The application encountered the following error: FATAL:  ユーザ"redmine"のIdent認証に失敗しました
 (PG::ConnectionBad)
  Error ID: 51dc67ab
  Error details saved to: /tmp/passenger-error-RINawh.html

[ E 2020-12-16 05:10:37.9101 861/T6 age/Cor/Con/CheckoutSession.cpp:274 ]: [Client 1-1] Cannot checkout session because a spawning error occurred. The identifier of the error is 51dc67ab. Please see earlier logs for details about the error.

システム更新で PostgreSQL の設定まで戻っていた。

$ sudo vi /var/lib/pgsql/data/pg_hba.conf
# "local" is for Unix domain socket connections only
#local   all             all                                     peer
local   all             all                                     trust
# IPv4 local connections:
#host    all             all             127.0.0.1/32            ident
host    all             all             127.0.0.1/32            trust
# IPv6 local connections:
#host    all             all             ::1/128                 ident
host    all             all             ::1/128                 trust
$ sudo systemctl restart postgresql

システム更新後にトラブルが起きやすい Redmine ですが、エラーログを眺めて対処すればきちんと動作します。
ともやん Redmine

Apache のエラーログを調べる。

$ sudo tail -f /var/log/httpd/error_log
[ E 2020-06-26 06:04:45.5702 683656/T8 age/Cor/Con/CheckoutSession.cpp:274 ]: [Client 1-103] Cannot checkout session because a spawning error occurred. The identifier of the error is 75cb1025. Please see earlier logs for details about the error.
App 1291063 output: Error: The application encountered the following error: There was an error while trying to load the gem 'rbpdf'.
App 1291063 output: Gem Load Error is: This installation of RMagick was configured with ImageMagick 6.9.10 but ImageMagick 6.9.11-18 is in use.
この RMagick のインストールは ImageMagick 6.9.10 で構成されましたが、ImageMagick 6.9.11-18 が使用されています。

Redmine 4.1.0 で RMagick は MiniMagick に置き換えられた。
これによりメモリー消費量が抑えられて、更に導入もしやすくなった。
MAEDA Go (@g_maeda) さんからの情報 - Twitter
Feature #30492: Replace RMagick with MiniMagick - Redmine

Redmine を最新にアップデートする。(Redmine 4.0.3 → 4.1.1)
詳細は Redmine のアップグレード を参照のこと。

$ sudo -s
# su - redmine
$ cat /var/www/vhosts/redmine.tomoyan.net/redmine/lib/redmine/version.rb
require 'rexml/document'

module Redmine
  # @private
  module VERSION
    MAJOR = 4
    MINOR = 0
    TINY  = 3
...

$ cd ~
$ tar Jcvf /var/www/vhosts/redmine.tomoyan.net/20200626_redmine-4.0.3.tar.xz /var/www/vhosts/redmine.tomoyan.net/redmine/
$ pg_dump redmine_db -U redmine -v -b > ~/20200626_redmine_db.dmp
$ tar Jcvf ~/20200626_redmine_db.dmp.tar.xz ~/20200626_redmine_db.dmp
$ rm ~/20200626_redmine_db.dmp
$ curl -LO http://www.redmine.org/releases/redmine-4.1.1.tar.gz
$ tar zxvf redmine-4.1.1.tar.gz
$ cd redmine-4.1.1
$ cp /var/www/vhosts/redmine.tomoyan.net/redmine/config/database.yml config/database.yml
$ gem install bundler
$ bundle install --path vendor/bundle --without development test
$ bundle exec rake generate_secret_token
$ cp -rf /var/www/vhosts/redmine.tomoyan.net/redmine/files .
$ cp -rf /var/www/vhosts/redmine.tomoyan.net/redmine/plugins .
$ bundle exec rake db:migrate RAILS_ENV=production
$ bundle exec rake redmine:plugins:migrate RAILS_ENV=production
$ cp /var/www/vhosts/redmine.tomoyan.net/redmine/config/configuration.yml config/configuration.yml
$ rm -rf /var/www/vhosts/redmine.tomoyan.net/redmine
$ mv /home/redmine/redmine-4.1.1 /var/www/vhosts/redmine.tomoyan.net/redmine
$ exit
# chown redmine.redmine /var/www/vhosts/redmine.tomoyan.net/redmine -R
Ignoring passenger-6.0.7 because its extensions are not built. Try: gem pristine passenger --version 6.0.7
Ignoring passenger-6.0.2 because its extensions are not built. Try: gem pristine passenger --version 6.0.2
Ignoring passenger-6.0.1 because its extensions are not built. Try: gem pristine passenger --version 6.0.1

gem pristine xxx を実行すると表示されなくなる。

$ gem pristine passenger
Restoring gems to pristine condition...
Building native extensions. This could take a while...
Restored passenger-6.0.1
Building native extensions. This could take a while...
Restored passenger-6.0.2
Building native extensions. This could take a while...
Restored passenger-6.0.7
Building native extensions. This could take a while...
Restored passenger-6.0.10
$ ruby bin/about
/var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/2.6.0/gems/pg-1.1.4/lib/pg.rb:56:in `initialize': FATAL:  ユーザ"redmine"のIdent認証に失敗しました (PG::ConnectionBad)
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/2.6.0/gems/pg-1.1.4/lib/pg.rb:56:in `new'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/2.6.0/gems/pg-1.1.4/lib/pg.rb:56:in `connect'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.4.2/lib/active_record/connection_adapters/postgresql_adapter.rb:692:in `connect'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.4.2/lib/active_record/connection_adapters/postgresql_adapter.rb:223:in `initialize'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.4.2/lib/active_record/connection_adapters/postgresql_adapter.rb:48:in `new'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.4.2/lib/active_record/connection_adapters/postgresql_adapter.rb:48:in `postgresql_connection'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.4.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:830:in `new_connection'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.4.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:874:in `checkout_new_connection'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.4.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:853:in `try_to_checkout_new_connection'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.4.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:814:in `acquire_connection'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.4.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:538:in `checkout'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.4.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:382:in `connection'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.4.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:1033:in `retrieve_connection'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.4.2/lib/active_record/connection_handling.rb:118:in `retrieve_connection'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.4.2/lib/active_record/connection_handling.rb:90:in `connection'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.4.2/lib/active_record/model_schema.rb:466:in `load_schema!'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.4.2/lib/active_record/attributes.rb:234:in `load_schema!'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.4.2/lib/active_record/attribute_decorators.rb:51:in `load_schema!'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.4.2/lib/active_record/model_schema.rb:459:in `block in load_schema'
        from /home/redmine/.anyenv/envs/rbenv/versions/2.6.8/lib/ruby/2.6.0/monitor.rb:235:in `mon_synchronize'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.4.2/lib/active_record/model_schema.rb:456:in `load_schema'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.4.2/lib/active_record/model_schema.rb:336:in `columns_hash'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.4.2/lib/active_record/inheritance.rb:78:in `descends_from_active_record?'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.4.2/lib/active_record/inheritance.rb:84:in `finder_needs_type_condition?'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.4.2/lib/active_record/core.rb:287:in `relation'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.4.2/lib/active_record/scoping/default.rb:34:in `unscoped'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/app/models/user.rb:822:in `anonymous'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/app/models/user.rb:816:in `current'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/app/models/query.rb:91:in `groupable'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/app/models/query.rb:31:in `initialize'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/app/models/issue_query.rb:36:in `new'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/app/models/issue_query.rb:36:in `<class:IssueQuery>'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/app/models/issue_query.rb:20:in `<top (required)>'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.2/lib/active_support/dependencies.rb:291:in `require'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.2/lib/active_support/dependencies.rb:291:in `block in require'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.2/lib/active_support/dependencies.rb:257:in `load_dependency'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.2/lib/active_support/dependencies.rb:291:in `require'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.2/lib/active_support/dependencies.rb:378:in `block in require_or_load'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.2/lib/active_support/dependencies.rb:37:in `block in load_interlock'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.2/lib/active_support/dependencies/interlock.rb:14:in `block in loading'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.2/lib/active_support/concurrency/share_lock.rb:151:in `exclusive'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.2/lib/active_support/dependencies/interlock.rb:13:in `loading'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.2/lib/active_support/dependencies.rb:37:in `load_interlock'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.2/lib/active_support/dependencies.rb:356:in `require_or_load'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.2/lib/active_support/dependencies.rb:334:in `depend_on'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.2/lib/active_support/dependencies.rb:246:in `require_dependency'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.2/lib/rails/engine.rb:478:in `block (2 levels) in eager_load!'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.2/lib/rails/engine.rb:477:in `each'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.2/lib/rails/engine.rb:477:in `block in eager_load!'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.2/lib/rails/engine.rb:475:in `each'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.2/lib/rails/engine.rb:475:in `eager_load!'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.2/lib/rails/engine.rb:356:in `eager_load!'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.2/lib/rails/application/finisher.rb:69:in `each'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.2/lib/rails/application/finisher.rb:69:in `block in <module:Finisher>'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.2/lib/rails/initializable.rb:32:in `instance_exec'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.2/lib/rails/initializable.rb:32:in `run'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.2/lib/rails/initializable.rb:61:in `block in run_initializers'
        from /home/redmine/.anyenv/envs/rbenv/versions/2.6.8/lib/ruby/2.6.0/tsort.rb:228:in `block in tsort_each'
        from /home/redmine/.anyenv/envs/rbenv/versions/2.6.8/lib/ruby/2.6.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
        from /home/redmine/.anyenv/envs/rbenv/versions/2.6.8/lib/ruby/2.6.0/tsort.rb:431:in `each_strongly_connected_component_from'
        from /home/redmine/.anyenv/envs/rbenv/versions/2.6.8/lib/ruby/2.6.0/tsort.rb:349:in `block in each_strongly_connected_component'
        from /home/redmine/.anyenv/envs/rbenv/versions/2.6.8/lib/ruby/2.6.0/tsort.rb:347:in `each'
        from /home/redmine/.anyenv/envs/rbenv/versions/2.6.8/lib/ruby/2.6.0/tsort.rb:347:in `call'
        from /home/redmine/.anyenv/envs/rbenv/versions/2.6.8/lib/ruby/2.6.0/tsort.rb:347:in `each_strongly_connected_component'
        from /home/redmine/.anyenv/envs/rbenv/versions/2.6.8/lib/ruby/2.6.0/tsort.rb:226:in `tsort_each'
        from /home/redmine/.anyenv/envs/rbenv/versions/2.6.8/lib/ruby/2.6.0/tsort.rb:205:in `tsort_each'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.2/lib/rails/initializable.rb:60:in `run_initializers'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.2/lib/rails/application.rb:361:in `initialize!'
        from /var/www/vhosts/redmine.tomoyan.net/redmine/config/environment.rb:16:in `<top (required)>'
        from /home/redmine/.anyenv/envs/rbenv/versions/2.6.8/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
        from /home/redmine/.anyenv/envs/rbenv/versions/2.6.8/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
        from bin/about:4:in `<main>'
$ psql -U postgres
psql: エラー: FATAL:  ユーザ"postgres"で対向(peer)認証に失敗しました

おそらくパッケージ更新で PostgreSQL - 認証方法の設定 が初期化されているので、再度設定し直す。

$ sudo nano /var/lib/pgsql/data/pg_hba.conf
/var/lib/pgsql/data/pg_hba.conf
# "local" is for Unix domain socket connections only
local   all             all                                     md5 # peer
# IPv4 local connections:
host    all             all             127.0.0.1/32            md5 # ident
# IPv6 local connections:
host    all             all             ::1/128                 md5 # ident
$ sudo systemctl restart postgresql
$ psql -U postgres
ユーザ postgres のパスワード:
psql (13.3)
"help"でヘルプを表示します。

postgres=# exit
  • ruby/redmine.txt
  • 最終更新: 2024/02/04 14:17
  • by 非ログインユーザー