# Joruri CMS 2020 Release 3 アップグレードマニュアル ## 1.想定環境 Joruri CMS 2020 Release 3最新版をインストール済みとします。 ## 2.事前確認 rootユーザーに変更します。 $ su - Joruri CMS 2020 Release 3の最新版がインストール済みであることを確認します。 # 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.3.4 # rbenv versions # rbenv shell 3.3.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.nginxのインストール ※nginx 1.26をインストールする場合は、以下の手順を実施してください。nginxを一度アンインストールする必要があるため、バージョンアップ作業中は公開・管理画面が閲覧できない状態となります。 nginxを停止し、アンインストールします。 # systemctl stop nginx # dnf -y remove nginx dnfリポジトリに追加します。 # vi /etc/yum.repos.d/nginx.repo ``` [nginx-stable] name=nginx stable repo baseurl=http://nginx.org/packages/centos/$releasever/$basearch/ gpgcheck=1 enabled=1 gpgkey=https://nginx.org/keys/nginx_signing.key module_hotfixes=true ``` インストールします。 # dnf -y install nginx # nginx -v デフォルトのnginx設定ファイルをリネームします。 # mv /etc/nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf.org nginxを起動します。 # systemctl start nginx # systemctl status nginx ※nginx 1.24にバージョンアップする場合は、以下の手順を実施してください。アンインストールすることなくnginxのバージョンアップを行うため、バージョンアップ作業中でも公開画面の閲覧は可能です。 # dnf -y module install nginx:1.24 # nginx -v ## 5.Node.jsのインストール nodenvを更新します。 # cd /usr/local/nodenv; git pull # cd /usr/local/nodenv/plugins/node-build; git pull nodejsをインストールします。 # nodenv install 20.15.0 # nodenv versions # nodenv shell 20.15.0 yarnをインストールします。 # npm uninstall -g yarn # npm install -g yarn # nodenv rehash # yarn -v ## 6.Joruriのアップグレード joruriユーザーに変更します。 # su - joruri $ cd /var/www/joruri Joruriを更新します。 $ git pull $ git log -1 ライブラリを更新します。 $ bundle install $ bundle list データベースを更新します。 $ bundle exec rake db:migrate RAILS_ENV=production CSS, jsファイル等をコピー(public/_common -> site/000*/public/_common) $ bundle exec rake joruri:maintenance:common_dir:copy RAILS_ENV=production assetsコンパイルを実行 $ bundle exec rake assets:precompile 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 ## 7.サーバーの起動 rootユーザーに変更します。 $ su - nginxを再起動します。 # systemctl restart nginx # systemctl status nginx joruriユーザーに変更します。 # su - joruri $ cd /var/www/joruri delayed_jobを再起動します。 $ bundle exec rake delayed_job:stop RAILS_ENV=production $ bundle exec rake delayed_job:start RAILS_ENV=production unicornを再起動します。 $ bundle exec rake unicorn:stop RAILS_ENV=production $ bundle exec rake unicorn:start RAILS_ENV=production 再構築ジョブを登録します。 $ bundle exec rake joruri:cms:tool:rebuild RAILS_ENV=production