お知らせ

現在サイトのリニューアル作業中のため、表示が崩れているページが存在することがあります。

Mastodonのアップグレードメモ

2025/09/15 22:20 ソフトウェア::Mastodon

ハマったので残しておく。

前提条件

  1. GitHubにMastodon本家をForkしたリポジトリがあり、そこをベースに運用している。
  2. 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)
    

やり方

  1. マージブランチを作る
    git checkout -b merge-latest
    
  2. 本家を取ってくる
    git fech mastodon
    
  3. マージブランチにマージする
    git merge mastodon/main
    
  4. セットアップする
    # swich user
    sudo su - mastodon
    # 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
    
  5. 動作確認OKならgit pushしてGitHub上で自分のところのmainにマージする。デフォルトでは本家に向くので注意
  6. もう一度、前述4番のセットアップコマンド一式を流し、問題なければ終わり

トラブルシュート

正常に動いていない場合

ジャーナルを見てエラー原因を特定する。新規要素がらみのパラメーターが出てたらDBが怪しいのでRAILS_ENV=production bundle exec rails db:migrateで直る可能性がある。

sudo journalctl -u mastodon-web -f