Report this

What is the reason for this report?

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

Posted on November 19, 2022

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.



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!

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.

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/

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.

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Start building today

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.