Mastodonのアップグレードメモ
更新日:
投稿日:
投稿日:
ハマったので残しておく。
前提条件
- GitHubにMastodon本家をForkしたリポジトリがあり、そこをベースに運用している。
git remote -vの状態が以下の通りで、origin/mainが本番運用ブランチ。mastodon https://github.com/mastodon/mastodon.git (fetch) mastodon https://github.com/mastodon/mastodon.git (push) origin https://github.com/Lycolia/lycodon.git (fetch) origin https://github.com/Lycolia/lycodon.git (push)
やり方
- マージブランチを作る
git checkout -b merge-latest - 本家を取ってくる
git fetch mastodon - マージブランチにマージする
git merge mastodon/main - セットアップする
sudo su - mastodon # Rubyのアップデート用 cd ~/.rbenv/plugins/ruby-build git pull cd ~/live RUBY_CONFIGURE_OPTS=--with-jemalloc rbenv install # install bundle install yarn install # DBがアカンことがあるので叩いておく RAILS_ENV=production bundle exec rails db:migrate # いつものリビルド RAILS_ENV=production bundle exec rails assets:clobber RAILS_ENV=production bundle exec rails assets:precompile exit # 再起動 sudo systemctl restart mastodon-web mastodon-sidekiq mastodon-streaming - 動作確認OKなら
git pushしてGitHub上で自分のところのmainにマージする。デフォルトでは本家に向くので注意 - もう一度、前述4番のセットアップコマンド一式を流し、問題なければ終わり
トラブルシュート
正常に動いていない場合
ジャーナルを見てエラー原因を特定する。新規要素がらみのパラメーターが出てたらDBが怪しいのでRAILS_ENV=production bundle exec rails db:migrateで直る可能性がある。
sudo journalctl -u mastodon-web -f
If the version you need is missing, try upgrading ruby-build.といわれる場合
以下のコマンドを叩いてruby-buildを更新するといける
cd "$(rbenv root)"/plugins/ruby-build
git pull