HOW-TO: Upgrading Mastodon as a Digital Ocean Droplet

From Tayledras
Jump to: navigation, search
Mastodon - An Open Source and Federated Alternative to Twitter
Leaving Twitter for Mastodon

References

HOW-TO: Upgrading Mastodon

SSH into your droplet

 ssh yourdomain.com

Some of these steps could take a while to complete, you may want to consider persisting your session with screen or tmux, so you can come back to long-running processes if your ssh connection breaks.

 screen

Switch to the mastodon user

 sudo su - mastodon

Move to the mastodon directory

 cd live

Make sure you have the latest tag and check into it

 git fetch && git checkout v4.1.3

The major version bump introduced an update to the Ruby version, you’ll have to install it. This will take quite a long time, go grab a a meal.

 rbenv install $(cat .ruby-version) --verbose

Install the gems for the new version

 bundle install

Run the new rails migrations in production mode

 RAILS_ENV=production bin/rails db:migrate

Install a fresh set of node packages

 rm -rf node_modules && yarn install

Build the JS bundle

 yarn build:production

Exit the mastodon user

 logout

Restart all the services

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

And done, you’re on the latest version of Mastodon.