Mastodon Upgrade Script

See this answer over at the Akamai community questions or your own .local/bin/upgrade-mastodon which is based on that answer.

Maybe actually also include that stupid script.

#!/usr/bin/env bash
sudo -u postgres pg_dump mastodon_production > ~/mastodon_production.sql
sudo su
cd /opt/mastodon
git fetch --tags
git tag -l && git tag -l|tail -n1
git checkout $(git tag -l|tail -n1)
bundle install && yarn install
RAILS_ENV=production bundle exec rails db:migrate
RAILS_ENV=production bundle exec rails assets:precompile
systemctl restart mastodon-{web,sidekiq,streaming}

This is just a guideline and not meant to be run on its own.