# Joruri CMS 2020 Release 3 アップグレードマニュアル ## 1.想定環境 Joruri CMS 2020 Release 2.1最新版をインストール済みとします。 ## 2.事前確認 rootユーザーに変更します。 $ su - Joruri CMS 2020 Release 2.1の最新版がインストール済みであることを確認します。 # cd /var/www/joruri # git log -1 ## 3.Rubyのインストール rbenvを更新します。 # cd /usr/local/rbenv; git pull # cd /usr/local/rbenv/plugins/ruby-build; git pull rubyをインストールします。 # rbenv install 3.1.4 # rbenv versions # rbenv shell 3.1.4 MeCab-Rubyをインストールします。 # cd /usr/local/src/mecab-ruby-0.996 # ruby extconf.rb && make && make install # ldconfig # ldconfig -p | grep "/usr/local/lib" ## 4.jemallocのインストール jemallocをインストールします。 # dnf -y install jemalloc-devel 以下のエラーが出た場合はpgdg関連リポジトリを更新します。 ``` エラー: repo 'pgdg-common' のメタデータのダウンロードに失敗しました : repomd.xml GPG signature verification error: Bad GPG signature ``` pgdg関連リポジトリを一時的に無効化します。 # rpm -qa | grep pgdg # cd /etc/yum.repos.d/ # cp pgdg-redhat-all.repo pgdg-redhat-all.repo.bak # sed -i "s/enabled=1/enabled=0/g" pgdg-redhat-all.repo INSTALL.mdに記載しているrpmを指定して再インストールします。 # dnf -y install https://download.postgresql.org/pub/repos/yum/reporpms/EL-9-x86_64/pgdg-redhat-repo-latest.noarch.rpm 「pgdg-redhat-all.repo.rpmnew」ファイルがあることを確認します。 # ll /etc/yum.repos.d/ 古いrepoファイルをリネームして置き換えます。 # mv pgdg-redhat-all.repo pgdg-redhat-all.repo.bak`date +%Y%m%d` # cp pgdg-redhat-all.repo.rpmnew pgdg-redhat-all.repo # rpm -qa | grep pgdg pgdb関連リポジトリをアップデートします。 # dnf update -y pgdg jemallocをインストールします。 # dnf install -y jemalloc-devel ## 5.サーバーの停止 delayed_jobがジョブを実行中でないことを確認します。 実行中であれば完了するまで待機します。 # ps aux | grep delayed_job delayed_jobを停止します。 # systemctl stop joruri_delayed_job # systemctl status joruri_delayed_job unicornを停止します。 # systemctl stop joruri_unicorn # systemctl status joruri_unicorn ## 6.Joruriのアップグレード joruriユーザーに変更します。 # su - joruri $ cd /var/www/joruri cronを削除します。 $ bundle exec whenever --clear-crontab $ crontab -l Joruriを更新します。 $ git pull $ git log -1 configディレクトリの設定ファイルをコピーします。 $ cp config/original/application.yml config/application.yml ライブラリを更新します。 $ bundle install $ bundle list データベースを更新します。 $ bundle exec rake db:migrate RAILS_ENV=production _commonディレクトリをsites/xxxx/public/_commonにコピーします。 $ bundle exec rake joruri:maintenance:common_dir:copy RAILS_ENV=production サイトのnginx設定ファイルを再書き出しします。 $ bundle exec rake joruri:cms:sites:update_server_configs RAILS_ENV=production リンク情報の抽出処理を実行します。 $ bundle exec rake joruri:cms:links:correct RAILS_ENV=production 再構築ジョブを登録します。 $ bundle exec rake joruri:cms:tool:rebuild RAILS_ENV=production cronを登録します。 $ bundle exec whenever --update-crontab ## 7.サーバーの設定 rootユーザーに変更します。 $ su - ユニットファイルを上書きします。 # cp /var/www/joruri/config/samples/unicorn.service /usr/lib/systemd/system/joruri_unicorn.service # cp /var/www/joruri/config/samples/delayed_job.service /usr/lib/systemd/system/joruri_delayed_job.service ※サンプルファイルはpostgresql-15を指定しています。バージョンを適切に変更してください。 ユニットファイルをリロードします。 # systemctl daemon-reload nginx設定ファイルを上書きします。 # cp /var/www/joruri/config/nginx/samples/nginx.conf /var/www/joruri/config/nginx/nginx.conf # cp /var/www/joruri/config/nginx/samples/servers_common.conf /var/www/joruri/config/nginx/servers_common.conf ## 8.サーバーの起動 nginxを再起動します。 # systemctl restart nginx # systemctl status nginx unicornを起動します。 # systemctl start joruri_unicorn # systemctl status joruri_unicorn delayed_jobを起動します。 # systemctl start joruri_delayed_job # systemctl status joruri_delayed_job