Nothing Special   »   [go: up one dir, main page]

Home Updating a Mastodon Instance
Post
Cancel

Updating a Mastodon Instance

My notes from updating a non-docker Mastodon instance from 4.2.9 to 4.2.10 Syndication

My objective here is to document the process of updating my Mastodon instance from 4.2.9 to 4.2.10, an urgent security release. I’ll then reference this when future upgrades are necessary.

This is for users that installed Mastodon directly on a server, not using Docker. I’m using the Digital Ocean Mastodon Droplet, which is a one-click (lolz) install of Mastodon.

Read the Release Notes

Always start with the release notes. What’s new? Are there any incompatible changes? How long will the update take? I’m a single user instance, so I can just take it down for a bit. But if you’re running a larger instance, you may need to plan ahead, let your users know, and schedule a time for the update.

This is an urgent security release and while the update steps are listed, this isn’t where you need to start. You need to start with the upgrade guide and follow the steps there.

Backup

Before you do anything, backup your instance. I utilize Digital Ocean’s system level backup, which gives you a daily backup, and then a snapshot of the current state right before the update is processed. It’s handy and easy to setup.

Switching to the Mastodon User

Log into your mastodon server and enjoy the adorable Mastodon ascii art for a moment. Then switch over to the mastodon user.

Mastodon ASCII Art

1
su - mastodon

Finally, navigate to the Mastodon root directory, which is usually at:

1
cd /home/mastodon/live

Pull the Latest Code

Now we need to pull the latest code changes down. Let’s get the latest tags first.

1
get fetch --tags

Then checkout the tag for the relase you’re wanting to upgrade to. In this case, it’s 4.2.10.

1
git checkout v4.2.10

Now it’s time to jump back to the upgrade instructions for this specific release.

Update Steps in Release Notes

In this 4.2.10 release, you have to install dependencies and then restart all mastodon processes.

1
2
bundle install
yarn install --frozen-lockfile

I did not know what “–frozen-lockfile” did exactly, so I looked it up before running.

At this point, you can exit out of the mastodon user and go back to your regular user.

1
exit

Restart Everything

Now, jump back to the Mastodon upgrade guide and follow the steps to restart all the Mastodon processes.

1
2
3
systemctl restart mastodon-sidekiq
systemctl reload mastodon-web
systemctl restart mastodon-streaming

Check the Version Number

Did the update work? Let’s check the version number, which appears at the bottom of the Mastodon home page.

Mastodon Version Number

Conclusion

Upgrading a Mastodon instance can be more complicated with major milestone releases, like the upcoming 4.3.0 release, but for now, I’m up to date and secure. The key I think is to read the release notes thoroughly and always follow the upgrade guide.

I hope this helps you with your Mastodon updates.

References

This post is licensed under CC BY 4.0 by the author.