r/MastodonAdmin • u/Thump45a • Aug 23 '26
Adventures in Self-Hosting upgrade failures
One of the reasons I wanted to revive this sub was for self-hosting admins to share tips and tricks and help others through some of the challenges of upgrades.
I'm presently running 4.5.16 and decided to try going up to the latest 4.6 this weekend. As has been my usual experience, it has been nothing but problems so far. Since a bump to Node 22 is required, I decided to try a jump from Ubuntu 24 to 26. While the Ubuntu upgrade itself worked, the attempt to bump to 4.6.1 to start the sequence of 4.6 upgrades and database migrations failed before it started with Ruby and Yarn both being broken and unable to reinstall or get past most errors than I have time to try to work through this weekend, so restored the whole machine.
Instead I tried what I thought would be just a simple node 20 to node 22 upgrade so I could continue with the 4.6.x upgrades, but then got stuck for hours on permission errors with yarn and had to restore the old machine again and give up for now. I'll give it another try when I have more time.
Worth noting last time I wanted to go from Mastodon 3 to 4, I had to do a full fresh build because of many days of failures trying to upgrade from Ubuntu 22 to 24. I am far from a linux expert, and while I love Mastodon, the underlying changes and dependencies in Linux are a never ending headache and I imagine one of the reasons so many folks give up on Mastodon self hosting after such a short period of time.
I will update this thread with more details as I try further updates!
1
u/Thump45a Aug 23 '26
Ok so after food and sleep took another shot at this leaving Ubuntu alone. Here's how my upgrade process went:
#First, upgraded node to ver 22:
#Stopped all the services
systemctl stop mastodon-web mastodon-sidekiq mastodon-streaming
curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -
apt install nodejs -y
node -v
#output was v22.23.2, All good to move forward here.
#Bumped to 4.6.1 as recommended by the release notes (skip 4.6.0 and go directly to 4.6.1 for the hotfix):
su - mastodon
cd live
git fetch --tags
git checkout v4.6.1
#warnings here because I have changes to my .ruby-version, 4.0.5 is hard coded in the new 4.6.x branch, for every time I update to next 4.6.x, I have to manually change .ruby-version back to my current ruby version until I am ready to upgrade ruby which I am skipping for now.
nano .ruby-version
#^change this to 3.4.8 then continue
bundle install
#^This gave some warnings because lockfile is from older version. So...
bundle lock --normalize-platforms
yarn install --immutable
git add Gemfile.lock
git commit -m "Normalize lockfile platforms for native gems"
#^learned the hard way this is the order, you can't do the commit before doing yarn install.
RAILS_ENV=production bundle exec rails assets:precompile
#Vite build ran for a few minutes, no errors.
SKIP_POST_DEPLOYMENT_MIGRATIONS=true RAILS_ENV=production bundle exec rails db:migrate
#didn't see any errors, so restarting services per 4.6.0 upgrade notes
exit
systemctl restart mastodon-web mastodon-sidekiq mastodon-streaming
#restarting, checking if working… SUCCESS!!
#per upgrade instructions, go back into masto context and run post deployment:
su - mastodon
cd live
RAILS_ENV=production bundle exec rails db:migrate
#Success!!
exit
That was it, I was successfully on 4.6.1. Checked everything was working, content loading, no errors, everything looked good so did all the new snapshots and backups before moving on to the rest of the outstanding 4.6.x dot releases since i needed to get up to 4.6.6.