Upgrading the glitch-soc fork of Mastodon

I’ve run Mastodon for a few years now, and upgrading has always been fine: it uses a release-based approach, and one just upgrades to the latest release.

In November, I switched to the glitch-soc fork (for Markdown support), and while the initial installation was easy, I’ve not attempted an update… until now.

glitch-soc doesn’t work on a release-based approach. There are basic instructions but nothing like update notes, to indicate what other changes might be needed as part of the update so, frankly, I’ve been a bit nervous about updating.

Breaking changes

I spotted a Github issue for “breaking changes”.

A note for me to keep an eye on this, before attempting updates in the future.

The bits relevant to me were:

    minimum NodeJS version changed from NodeJS 16 to NodeJS 18
    switched from yarn 1 to yarn 4, the switch should be transparent if you use corepack, otherwise you'll have to either install yarn 4 or enable corepack

Checking the NodeJS version

node -v

I had 16.20.1.

This is controlled by apt, so I backed up my old repository listing (/etc/apt/sources.list.d/nodesource.list), and then did:

curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list
apt update && apt full-upgrade -y

This gave me v20.10.0.

But, for some reason, the version of nodejs for my mastodon user was still 16.20.1.

So I did:

su - mastodon
nvm install 20.10.0

And that worked.

Update:

I “pinned” it, so that this latest version was the default version:

nvm alias default node

(Which I think does the same as nvm alias default 20.10.0, given that 20.10.0 is the latest version I have installed.)

Check this with nvm ls:

       v16.20.1
->     v20.10.0
         system
default -> node (-> v20.10.0)
iojs -> N/A (default)
unstable -> N/A (default)
node -> stable (-> v20.10.0) (default)
stable -> 20.10 (-> v20.10.0) (default)
lts/* -> lts/iron (-> v20.10.0)
lts/argon -> v4.9.1 (-> N/A)
lts/boron -> v6.17.1 (-> N/A)
lts/carbon -> v8.17.0 (-> N/A)
lts/dubnium -> v10.24.1 (-> N/A)
lts/erbium -> v12.22.12 (-> N/A)
lts/fermium -> v14.21.3 (-> N/A)
lts/gallium -> v16.20.2 (-> N/A)
lts/hydrogen -> v18.19.0 (-> N/A)
lts/iron -> v20.10.0

I then decided to uninstall the old, no longer needed, version:

nvm uninstall 16.20.1

Checking the yarn version

yarn --version

That returned 1.22.19, which looks problematic.

I had no idea if I use corepack or not, but checking the normal Mastodon instructions, I noted that that includes:

corepack enable
yarn set version classic

so I did have corepack installed and enabled.

I then ran:

yarn set version stable
yarn install

which showed Yarn 4.0.2.

Updating glitch-soc

I followed the glitch-soc instructions for updating:

su - mastodon
cd /home/mastodon/live
git fetch glitch-soc
git checkout glitch-soc/main
git pull
bundle install && yarn install

This seemed to complete successfully.

I then ran:

RAILS_ENV=production SKIP_POST_DEPLOYMENT_MIGRATIONS=true bundle exec rails db:migrate
RAILS_ENV=production bundle exec rails assets:precompile

I switched back to a privileged user and reloaded everything:

exit
systemctl reload mastodon-web && systemctl restart mastodon-{sidekiq,streaming}

No errors or warnings.

So back to the mastodon user to finish the update:

su - mastodon
cd /home/mastodon/live/
RAILS_ENV=production bin/tootctl cache clear
RAILS_ENV=production bundle exec rails db:migrate

And that all seemed to work fine.

Perhaps I was worrying about nothing.

Yarn telemetry?

During the installation, I saw:

➤ YN0065: Yarn will periodically gather anonymous telemetry: https://yarnpkg.com/advanced/telemetry
➤ YN0065: Run yarn config set --home enableTelemetry 0 to disable

So I did:

yarn config set --home enableTelemetry 0 

and I got:

YN0000: Successfully set enableTelemetry to false

Upgrading ruby using rbenv

I have rbenv installed.

To upgrade to a newer version of ruby, in line with .ruby-version, I did:

Show all ruby versions (to check I can install the right one):

rbenv install --list-all

And then install/build it with jemalloc support:

RUBY_CONFIGURE_OPTS=--with-jemalloc rbenv install 3.2.3