ユーザ用ツール

サイト用ツール


サイドバー

Top

検索タグ

変更履歴

メニュー


ruby:redmine

Redmine

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

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

Redmine のインストール

Ruby のインストール

anyenv で ruby バージョンを Redmine の動作環境に合わせる。

$ cd ~
$ git clone --depth 1 https://github.com/anyenv/anyenv ~/.anyenv
Cloning into '/home/redmine/.anyenv'...
remote: Enumerating objects: 31, done.
remote: Counting objects: 100% (31/31), done.
remote: Compressing objects: 100% (25/25), done.
remote: Total 31 (delta 0), reused 19 (delta 0), pack-reused 0
Receiving objects: 100% (31/31), 13.34 KiB | 13.34 MiB/s, done.
$ echo 'export PATH="$HOME/.anyenv/bin:$PATH"' >> ~/.bashrc
$ . ~/.bashrc
$ anyenv
anyenv 1.1.4
Usage: anyenv  []

Some useful anyenv commands are:
   commands            List all available anyenv commands
   local               Show the local application-specific Any version
   global              Show the global Any version
   install             Install a **env
   uninstall           Uninstall a specific **env
   version             Show the current Any version and its origin
   versions            List all Any versions available to **env

See `anyenv help ' for information on a specific command.
For full documentation, see: https://github.com/anyenv/anyenv#readme
$ anyenv init
# Load anyenv automatically by adding
# the following to ~/.bash_profile:

eval "$(anyenv init -)"

$ echo 'eval "$(anyenv init -)"' >> ~/.bash_profile
$ exec $SHELL -l
ANYENV_DEFINITION_ROOT(/home/redmine/.config/anyenv/anyenv-install) doesn't exist. You can initialize it by:
> anyenv install --init
$ anyenv install --init
Manifest directory doesn't exist: /home/redmine/.config/anyenv/anyenv-install
Do you want to checkout https://github.com/anyenv/anyenv-install.git? [y/N]: y
Cloning https://github.com/anyenv/anyenv-install.git master to /home/redmine/.config/anyenv/anyenv-install...
Cloning into '/home/redmine/.config/anyenv/anyenv-install'...
remote: Enumerating objects: 62, done.
remote: Counting objects: 100% (5/5), done.
remote: Compressing objects: 100% (5/5), done.
remote: Total 62 (delta 1), reused 1 (delta 0), pack-reused 57
Receiving objects: 100% (62/62), 10.52 KiB | 2.63 MiB/s, done.
Resolving deltas: 100% (8/8), done.

Completed!
$ anyenv install -l
  Renv
  crenv
  denv
  erlenv
  exenv
  goenv
  hsenv
  jenv
  jlenv
  luaenv
  nodenv
  phpenv
  plenv
  pyenv
  rbenv
  sbtenv
  scalaenv
  swiftenv
  tfenv
$ anyenv install rbenv
/tmp/rbenv.20210721153123.39066 ~
Cloning https://github.com/rbenv/rbenv.git master to rbenv...
Cloning into 'rbenv'...
remote: Enumerating objects: 2946, done.
remote: Counting objects: 100% (50/50), done.
remote: Compressing objects: 100% (39/39), done.
remote: Total 2946 (delta 22), reused 22 (delta 11), pack-reused 2896
Receiving objects: 100% (2946/2946), 589.89 KiB | 5.27 MiB/s, done.
Resolving deltas: 100% (1831/1831), done.
~
~/.anyenv/envs/rbenv/plugins ~
Cloning https://github.com/rbenv/ruby-build.git master to ruby-build...
Cloning into 'ruby-build'...
remote: Enumerating objects: 11677, done.
remote: Counting objects: 100% (370/370), done.
remote: Compressing objects: 100% (108/108), done.
remote: Total 11677 (delta 247), reused 342 (delta 237), pack-reused 11307
Receiving objects: 100% (11677/11677), 2.46 MiB | 1.08 MiB/s, done.
Resolving deltas: 100% (7714/7714), done.
~

Install rbenv succeeded!
Please reload your profile (exec $SHELL -l) or open a new session.
$ exec $SHELL -l
$ rbenv
rbenv 1.1.2-61-g585ed84
Usage: rbenv  []

Some useful rbenv commands are:
   commands    List all available rbenv commands
   local       Set or show the local application-specific Ruby version
   global      Set or show the global Ruby version
   shell       Set or show the shell-specific Ruby version
   install     Install a Ruby version using ruby-build
   uninstall   Uninstall a specific Ruby version
   rehash      Rehash rbenv shims (run this after installing executables)
   version     Show the current Ruby version and its origin
   versions    List installed Ruby versions
   which       Display the full path to an executable
   whence      List all Ruby versions that contain the given executable

See `rbenv help ' for information on a specific command.
For full documentation, see: https://github.com/rbenv/rbenv#readme
$ 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.6.8
Downloading ruby-2.6.8.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.6/ruby-2.6.8.tar.bz2
Installing ruby-2.6.8...
Installed ruby-2.6.8 to /home/redmine/.anyenv/envs/rbenv/versions/2.6.8

$ rbenv rehash
$ rbenv global 2.6.8
$ ruby -v
ruby 2.6.8p205 (2021-07-07 revision 67951) [x86_64-linux]

Ruby のインストール

Web サーバーのインストール

データベース サーバーのインストール

依存パッケージのインストール

開発ツール(Cコンパイラ等)のインストール

$ sudo dnf groupinstall "Development Tools"
$ sudo dnf install gcc-c++

Passengerのビルドに必要なヘッダファイルなどのインストール

$ sudo dnf install ruby-devel openssl-devel readline-devel zlib-devel curl-devel libyaml-devel libffi-devel

PostgreSQL とヘッダファイルのインストール

$ sudo dnf install postgresql-server postgresql-devel

ImageMagickとヘッダファイル・日本語フォントのインストール

$ sudo dnf install ImageMagick ImageMagick-devel ipa-pgothic-fonts

空のデータベースとユーザーの作成

空のデータベースの作成

データベース ユーザーを作成する。

$ psql -U postgres
psql (10.6)
"help" でヘルプを表示します。

postgres=# CREATE ROLE redmine LOGIN ENCRYPTED PASSWORD 'password' NOINHERIT VALID UNTIL 'infinity';
CREATE ROLE

データベースを作成する。

postgres=# CREATE DATABASE redmine_db WITH ENCODING='UTF8' OWNER=redmine;
CREATE DATABASE

データベースの日付形式をISO(PostgreSQLのデフォルト)に設定する。

postgres=# ALTER DATABASE "redmine_db" SET datestyle="ISO,MDY";
ALTER DATABASE
postgres=# \q

ユーザーの作成

$ sudo useradd redmine
$ sudo passwd redmine

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

ダウンロード — Redmine.JP より Download - Redmine へ行き最新の Redmine(redmine-4.2.1.tar.gz) をダウンロードする。

$ su - redmine
$ curl -O https://www.redmine.org/releases/redmine-4.2.1.tar.gz
$ tar zxvf redmine-4.2.1.tar.gz

データベース接続設定

$ cd redmine-4.2.1
$ cp config/database.yml.example config/database.yml
$ nano config/database.yml

データベース接続設定の例(PostgreSQL)

config/database.yml
production:
  adapter: postgresql
  database: redmine_db
  host: localhost
  username: redmine
  password: "password"
  # Use "utf8" instead of "utfmb4" for MySQL prior to 5.7.7
  encoding: utf8
 
development:
#  adapter: mysql2
 
test:
#  adapter: mysql2

データベース接続設定全体

config/database.yml
# Default setup is given for MySQL 5.7.7 or later.
# Examples for PostgreSQL, SQLite3 and SQL Server can be found at the end.
# Line indentation must be 2 spaces (no tabs).
 
production:
  adapter: postgresql
  database: redmine_db
  host: localhost
  username: redmine
  password: "password"
  # Use "utf8" instead of "utfmb4" for MySQL prior to 5.7.7
  encoding: utf8
 
development:
#  adapter: mysql2
  database: redmine_development
  host: localhost
  username: root
  password: ""
  # Use "utf8" instead of "utfmb4" for MySQL prior to 5.7.7
  encoding: utf8mb4
 
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
#  adapter: mysql2
  database: redmine_test
  host: localhost
  username: root
  password: ""
  # Use "utf8" instead of "utfmb4" for MySQL prior to 5.7.7
  encoding: utf8mb4
 
# PostgreSQL configuration example
#production:
#  adapter: postgresql
#  database: redmine
#  host: localhost
#  username: postgres
#  password: "postgres"
 
# SQLite3 configuration example
#production:
#  adapter: sqlite3
#  database: db/redmine.sqlite3
 
# SQL Server configuration example
#production:
#  adapter: sqlserver
#  database: redmine
#  host: localhost
#  username: jenkins
#  password: jenkins

mysql2 を使う予定が無い場合、$ bundle config set without 'development test' を実行しても Gemfile の中で全ての adapter の設定状況を判断して mysql2 をビルドしようとしてエラーになるので、development test ともに adapter: mysql2 をコメントアウトする。

Gemfile
# Include database gems for the adapters found in the database
# configuration file
require 'erb'
require 'yaml'
database_file = File.join(File.dirname(__FILE__), "config/database.yml")
if File.exist?(database_file)
  database_config = YAML::load(ERB.new(IO.read(database_file)).result)
  adapters = database_config.values.map {|c| c['adapter']}.compact.uniq
  if adapters.any?
    adapters.each do |adapter|
      case adapter
      when 'mysql2'
        gem "mysql2", "~> 0.5.0", :platforms => [:mri, :mingw, :x64_mingw]
      when /postgresql/
        gem "pg", "~> 1.2.2", :platforms => [:mri, :mingw, :x64_mingw]

mysql2 の場合は encoding: utfmb4 で寿司ビール🍣🍺問題に対応する。
MySQLのencodingをutf8からutf8mb4に変更して寿司ビール問題に対応する|TechRacho(テックラッチョ)〜エンジニアの「?」を「!」に〜|BPS株式会社
寿司ビール問題① 初心者→中級者へのSTEP20/25 - Qiita

メールとその他各種設定

Redmine からメールサーバへ接続するための設定や日本語フォントファイルのパスを記述した設定ファイルを作成する。

$ cd redmine-4.2.1
$ cp config/configuration.yml.example config/configuration.yml
$ nano config/configuration.yml

設定ファイルの設定例(localhost sendmail)

config/configuration.yml
# specific configuration options for production environment
# that overrides the default ones
production:
  email_delivery:
    delivery_method: :smtp
    smtp_settings:
      address: "localhost"
      port: 25
      domain: "tomoyan.net"
 
  rmagick_font_path: /usr/share/fonts/ipa-pgothic/ipagp.ttf

設定ファイルの設定例(gmail)

config/configuration.yml
# specific configuration options for production environment
# that overrides the default ones
production:
  email_delivery:
    delivery_method: :smtp
    smtp_settings:
      enable_starttls_auto: true
      address: "smtp.gmail.com"
      port: 587
      domain: "smtp.gmail.com"
      authentication: :plain
      user_name: "redmine@redmine.tomoyan.net"
      password: "password"
 
  rmagick_font_path: /usr/share/fonts/ipa-pgothic/ipagp.ttf

設定ファイル全体

config/configuration.yml
# = Redmine configuration file
#
# Each environment has its own configuration options.  If you are only
# running in production, only the production block needs to be configured.
# Environment specific configuration options override the default ones.
#
# Note that this file needs to be a valid YAML file.
# DO NOT USE TABS! Use 2 spaces instead of tabs for indentation.
 
# default configuration options for all environments
default:
  # Outgoing emails configuration
  # See the examples below and the Rails guide for more configuration options:
  # http://guides.rubyonrails.org/action_mailer_basics.html#action-mailer-configuration
  email_delivery:
 
  # ==== Simple SMTP server at localhost
  #
  #  email_delivery:
  #    delivery_method: :smtp
  #    smtp_settings:
  #      address: "localhost"
  #      port: 25
  #
  # ==== SMTP server at example.com using LOGIN authentication and checking HELO for foo.com
  #
  #  email_delivery:
  #    delivery_method: :smtp
  #    smtp_settings:
  #      address: "example.com"
  #      port: 25
  #      authentication: :login
  #      domain: 'foo.com'
  #      user_name: 'myaccount'
  #      password: 'password'
  #
  # ==== SMTP server at example.com using PLAIN authentication
  #
  #  email_delivery:
  #    delivery_method: :smtp
  #    smtp_settings:
  #      address: "example.com"
  #      port: 25
  #      authentication: :plain
  #      domain: 'example.com'
  #      user_name: 'myaccount'
  #      password: 'password'
  #
  # ==== SMTP server at using TLS (GMail)
  # This might require some additional configuration. See the guides at:
  # http://www.redmine.org/projects/redmine/wiki/EmailConfiguration
  #
  #  email_delivery:
  #    delivery_method: :smtp
  #    smtp_settings:
  #      enable_starttls_auto: true
  #      address: "smtp.gmail.com"
  #      port: 587
  #      domain: "smtp.gmail.com" # 'your.domain.com' for GoogleApps
  #      authentication: :plain
  #      user_name: "your_email@gmail.com"
  #      password: "your_password"
  #
  # ==== Sendmail command
  #
  #  email_delivery:
  #    delivery_method: :sendmail
 
  # Absolute path to the directory where attachments are stored.
  # The default is the 'files' directory in your Redmine instance.
  # Your Redmine instance needs to have write permission on this
  # directory.
  # Examples:
  # attachments_storage_path: /var/redmine/files
  # attachments_storage_path: D:/redmine/files
  attachments_storage_path:
 
  # Configuration of the autologin cookie.
  # autologin_cookie_name: the name of the cookie (default: autologin)
  # autologin_cookie_path: the cookie path (default: /)
  # autologin_cookie_secure: true sets the cookie secure flag (default: false)
  autologin_cookie_name:
  autologin_cookie_path:
  autologin_cookie_secure:
 
  # Configuration of SCM executable command.
  #
  # Absolute path (e.g. /usr/local/bin/hg) or command name (e.g. hg.exe, bzr.exe)
  # On Windows + CRuby, *.cmd, *.bat (e.g. hg.cmd, bzr.bat) does not work.
  #
  # On Windows + JRuby 1.6.2, path which contains spaces does not work.
  # For example, "C:\Program Files\TortoiseHg\hg.exe".
  # If you want to this feature, you need to install to the path which does not contains spaces.
  # For example, "C:\TortoiseHg\hg.exe".
  #
  # Examples:
  # scm_subversion_command: svn                                       # (default: svn)
  # scm_mercurial_command:  C:\Program Files\TortoiseHg\hg.exe        # (default: hg)
  # scm_git_command:        /usr/local/bin/git                        # (default: git)
  # scm_cvs_command:        cvs                                       # (default: cvs)
  # scm_bazaar_command:     bzr.exe                                   # (default: bzr)
  #
  scm_subversion_command:
  scm_mercurial_command:
  scm_git_command:
  scm_cvs_command:
  scm_bazaar_command:
 
  # SCM paths validation.
  #
  # You can configure a regular expression for each SCM that will be used to
  # validate the path of new repositories (eg. path entered by users with the
  # "Manage repositories" permission and path returned by reposman.rb).
  # The regexp will be wrapped with \A \z, so it must match the whole path.
  # And the regexp is case sensitive.
  #
  # You can match the project identifier by using %project% in the regexp.
  #
  # You can also set a custom hint message for each SCM that will be displayed
  # on the repository form instead of the default one.
  #
  # Examples:
  # scm_subversion_path_regexp: file:///svnpath/[a-z0-9_]+
  # scm_subversion_path_info: SVN URL (eg. file:///svnpath/foo)
  #
  # scm_git_path_regexp: /gitpath/%project%(\.[a-z0-9_])?/
  #
  scm_subversion_path_regexp:
  scm_mercurial_path_regexp:
  scm_git_path_regexp:
  scm_cvs_path_regexp:
  scm_bazaar_path_regexp:
  scm_filesystem_path_regexp:
 
  # Absolute path to the SCM commands errors (stderr) log file.
  # The default is to log in the 'log' directory of your Redmine instance.
  # Example:
  # scm_stderr_log_file: /var/log/redmine_scm_stderr.log
  scm_stderr_log_file:
 
  # Key used to encrypt sensitive data in the database (SCM passwords,
  # LDAP passwords, and TOTP (two-factor authentication) secret keys).
  # If you don't want to enable data encryption, just leave it blank.
  # WARNING: losing/changing this key will make encrypted data unreadable.
  #
  # If you want to encrypt existing data in your database:
  # * set the cipher key here in your configuration file
  # * encrypt data using 'rake db:encrypt RAILS_ENV=production'
  #
  # If you have encrypted data and want to change this key, you have to:
  # * decrypt data using 'rake db:decrypt RAILS_ENV=production' first
  # * change the cipher key here in your configuration file
  # * encrypt data using 'rake db:encrypt RAILS_ENV=production'
  database_cipher_key:
 
  # Set this to false to disable plugins' assets mirroring on startup.
  # You can use `rake redmine:plugins:assets` to manually mirror assets
  # to public/plugin_assets when you install/upgrade a Redmine plugin.
  #
  #mirror_plugins_assets_on_startup: false
 
  # Your secret key for verifying cookie session data integrity. If you
  # change this key, all old sessions will become invalid! Make sure the
  # secret is at least 30 characters and all random, no regular words or
  # you'll be exposed to dictionary attacks.
  #
  # If you have a load-balancing Redmine cluster, you have to use the
  # same secret token on each machine.
  #secret_token: 'change it to a long random string'
 
  # Requires users to re-enter their password for sensitive actions (editing
  # of account data, project memberships, application settings, user, group,
  # role, auth source management and project deletion). Disabled by default.
  # Timeout is set in minutes.
  #
  #sudo_mode: true
  #sudo_mode_timeout: 15
 
  # Absolute path (e.g. /usr/bin/convert, c:/im/convert.exe) to
  # the ImageMagick's `convert` binary. Used to generate attachment thumbnails.
  #imagemagick_convert_command:
 
  # Absolute path (e.g. /usr/bin/gs, c:/ghostscript/gs.exe) to
  # the `gs` binary. Used to generate attachment thumbnails of PDF files.
  #gs_command:
 
  # Configuration of MiniMagick font.
  #
  # Redmine uses MiniMagick in order to export a gantt chart to a PNG image.
  # This setting is necessary to properly display CJK (Chinese, Japanese,
  # and Korean) characters in the PNG image. Please make sure that the
  # specified font is installed in the Redmine server.
  #
  # This setting is necessary only when CJK characters are used in gantt.
  #
  # Note that rmagick_font_path in prior to Redmine 4.1.0 has been renamed
  # to minimagick_font_path.
  #
  # Examples for Japanese:
  #   Windows:
  #     minimagick_font_path: C:\windows\fonts\msgothic.ttc
  #   Linux:
  #     minimagick_font_path: /usr/share/fonts/ipa-mincho/ipam.ttf
  #
  minimagick_font_path:
 
  # Maximum number of simultaneous AJAX uploads
  #max_concurrent_ajax_uploads: 2
 
  # Configure OpenIdAuthentication.store
  #
  # allowed values: :memory, :file, :memcache
  #openid_authentication_store: :memory
 
  # URL of the avatar server
  #
  # By default, Redmine uses Gravatar as the avatar server for displaying
  # user icons. You can switch to another Gravatar-compatible server such
  # as Libravatar and opensource servers listed on
  # https://wiki.libravatar.org/running_your_own/
  #
  # URL of each avatar is: #{avatar_server_url}/avatar/#{hash}
  #
  #avatar_server_url: https://www.gravatar.com        # default
  #avatar_server_url: https://seccdn.libravatar.org
 
# specific configuration options for production environment
# that overrides the default ones
production:
  email_delivery:
    delivery_method: :smtp
    smtp_settings:
      enable_starttls_auto: true
      address: "smtp.gmail.com"
      port: 587
      domain: "smtp.gmail.com"
      authentication: :plain
      user_name: "redmine@redmine.tomoyan.net"
      password: "password"
 
  rmagick_font_path: /usr/share/fonts/ipa-pgothic/ipagp.ttf
 
# specific configuration options for development environment
# that overrides the default ones
development:

依存するソフトウェアのインストール

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]

$ 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.

Redmine の配置

$ 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 ファイルのオーナーでアプリを実行する。

Passenger のインストール

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

$ 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 の設定

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

Redmine インストール後の初期設定

管理者パスワード変更

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. 「リポジトリ」タブを開き、以下のように設定を行う。
    使用するバージョン管理システム
      [ ] Subversion
      [v] Mercurial
      [ ] Cvs
      [ ] Bazaar
      [ ] 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

作業分類の追加

この手順では 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.

Redmine(Rails アプリ) の再起動方法

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

$ touch redmine/tmp/restart.txt

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

$ su - redmine
$ passenger-config restart-app

Redmine のアップグレード

バックアップ

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

$ su - redmine
$ tar Jcvf /var/www/vhosts/redmine.tomoyan.net/20210723_redmine-4.1.1.tar.xz /var/www/vhosts/redmine.tomoyan.net/redmine/

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

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

アップグレードの実行

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

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

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

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

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

Bundlerをインストールする。

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

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 invocations, which bundler will no longer do in future versions. Instead please use `bundle config set without 'development test'`, and stop using this flag
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.6
Installing concurrent-ruby 1.1.6
Fetching i18n 1.6.0
Installing i18n 1.6.0
Fetching minitest 5.14.1
Installing minitest 5.14.1
Fetching thread_safe 0.3.6
Installing thread_safe 0.3.6
Fetching tzinfo 1.2.7
Installing tzinfo 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.9.0
Installing erubi 1.9.0
Fetching mini_portile2 2.4.0
Installing mini_portile2 2.4.0
Fetching nokogiri 1.10.9
Installing nokogiri 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.6.0
Installing loofah 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.2
Installing nio4r 2.5.2 with native extensions
Fetching websocket-extensions 0.1.5
Installing websocket-extensions 0.1.5
Fetching websocket-driver 0.7.2
Installing websocket-driver 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.5
Installing public_suffix 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.5
Installing csv 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.2
Installing net-ldap 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.1
Installing sprockets-rails 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 complete! 31 Gemfile dependencies, 59 gems now installed.
Gems in the groups development and test were not installed.
Bundled gems are installed into `./vendor/bundle`
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
セッションストア秘密鍵の生成

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
Redmine の配置

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

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

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

$ cd ~
$ mv /home/redmine/redmine-4.2.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

トラブルシューティング

admin のパスワードが不明な場合

$ 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

Passenger のインストール時のビルドで固まる場合

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

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

mercurial を py2 から py3 にすると redmine の mercurial リポジトリは 404 になる

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

We're sorry, but something went wrong. エラーで動作しなくなった場合 (2021/07/21)

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>'

We're sorry, but something went wrong. エラーで動作しなくなった場合 (2020/12/15)

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

We're sorry, but something went wrong. エラーで動作しなくなった場合 (2020/06/26)

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

Try: gem pristine xxx が表示される場合

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

FATAL: ユーザ"redmine"のIdent認証に失敗しました (PG::ConnectionBad) が発生する場合

$ 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 · 最終更新: 2021/07/23 16:23 by ともやん