Question

Im searching how to upgrade my Mastodon instance hosted on Digital Ocean

I have created my Mastodon instance hosted on Digital Ocean through the One-Click app they offer. Due to so many security issues, I believe it’s time to upgrade for obvious security reasons. At this time the lasted version out is Mastodon version 4.0.2 and I am still on version 3.1.3 Is it possible to upgrade to my current (droplet) version without wiping out my existing instance? Any help, direction, or tutorials would be greatly appreciated. Thank you.

Show comments

Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hi friend,

I just did this very thing. I don’t know if it’s the best way, but it worked for me.

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 -b v4.0.2

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.

Frustrating! I have followed instructions and even set a swap file and I am still stuck on version 3.1.3. Does anyone have insight as to why this will not upgrade? I am not a coder so I have little experience with that.

I found this and was able to successfully migrate thanks to this advice…

https://youtu.be/dJa6eAo7HcA

I had to do a git reset to accomplish this - which was the snag as I kept getting an Ambiguous result when I did the git checkout of v4.0.2.

THis subsequent article helped me overcome that hurdle.

https://www.freecodecamp.org/news/git-reset-origin-how-to-reset-a-local-branch-to-remote-tracking-branch/

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

card icon
Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Sign up
card icon
Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We’d like to help.

Learn more
card icon
Become a contributor

You get paid; we donate to tech nonprofits.

Learn more
Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow – whether you’re running one virtual machine or ten thousand.

Learn more ->
DigitalOcean Cloud Control Panel
Get started for free

Enter your email to get $200 in credit for your first 60 days with DigitalOcean.

New accounts only. By submitting your email you agree to our Privacy Policy.

© 2023 DigitalOcean, LLC.