Upgrading to Mastodon 4.2

The mastodon documentation contains great information on how to upgrade your mastodon instance between one update and another, but if you want the quick and dirty for a basic setup, here is the process.

  1. Shortly you should be able to access your instance

Finally start all the mastodon services. You will need to exit from the mastodon service account

sudo systemctl restart mastodon-sidekiq.service
sudo systemctl restart mastodon-web.service
sudo systemctl restart mastodon-streaming.service

Upgrade the environment

bundle install
RAILS_ENV=production bundle exec rails db:migrate
rm -rf node_modules && yarn install
yarn build:production
RAILS_ENV=production bundle exec rails assets:precompile

Checkout the new version and make sure that we are using the correct local ruby version is installed

git fetch
git checkout v4.2.0
rbenv install $(cat .ruby-version) --verbose

switch to the mastodon user account

su - mastodon -s /bin/bash
cd ~/live

Connect to your server via ssh

systemctl stop mastodon-*