Update Mastodon

Updating Mastodon and Ruby, and renaming the publish buttons

Update Ruby

  1. Switch to the mastodon user:
1
su - mastodon
  1. Navigate to the home directory:
1
cd /home/mastodon
  1. Update the ruby-build plugin:
1
git -C .rbenv/plugins/ruby-build pull
  1. Install the desired Ruby version (e.g., 3.0.6) with jemalloc optimization:
1
RUBY_CONFIGURE_OPTS=--with-jemalloc rbenv install 3.0.6

Update Files

  1. Switch to the mastodon user and open a shell:
1
2
su - mastodon
bash
  1. Navigate to the live directory and update the Mastodon codebase:
1
2
cd /home/mastodon/live
git fetch && git checkout v4.1.2 --force

Perform the Update

Refer to the release notes for additional commands: https://github.com/mastodon/mastodon/releases

  1. Install dependencies:
1
2
bundle install
yarn install
  1. Apply database migrations:
1
RAILS_ENV=production bundle exec rails db:migrate

Customize the “Toot” Button

  1. Replace the text for the “Publish” button:
1
2
sed -in s/Veröffentlichen/Tröt/g app/javascript/mastodon/locales/*json
sed -in s/Publish/Toot/g app/javascript/mastodon/locales/*json
  1. Recompile the assets:
1
RAILS_ENV=production bundle exec rails assets:precompile

Restart Services

As the root user, restart the Mastodon services:

1
systemctl restart mastodon-*.service