본문으로 건너뛰기

업데이트 기록

이 문서의 본문은 아직 한국어로 번역되지 않았습니다. 아래에 영어 원문을 제공합니다.

Mastodon 4.7.1 Upgrade

Upgrade date: 2026-09-11​

Previous version: 4.6.6​

Target version: 4.7.1​

Build commit​

f3cdfcaacf

Backup performed: Auto-Backup​

Existing scheduled/production backup was retained before deployment.

Images​

  • mustardkim/mastodon-mustard:v4.7.1
  • mustardkim/mastodon-mustard:v4.7.1-streaming

Overview​

This upgrade moved the production instance directly from Mastodon 4.6.6 to 4.7.1.

Unlike recent patch-level upgrades, this release required a larger upstream merge, Ruby runtime changes, dependency updates, Vite-related changes, database migrations, and additional validation of the maintained fork.

The upgrade was prepared on a dedicated upgrade-4.7.1 branch before being merged into main and used to build the production Docker images.

Source upgrade procedure​

  1. Fetched Mastodon 4.7.1 from upstream.
  2. Created and worked on the upgrade-4.7.1 branch.
  3. Merged upstream tag v4.7.1.
  4. Resolved merge conflicts.
  5. Reviewed files that differed because of existing fork customizations.
  6. Restored upstream files where the fork contained obsolete drift.
  7. Preserved intentional local development-tool customizations.
  8. Ran dependency installation and validation.
  9. Ran tests and lint checks.
  10. Pushed the upgrade branch and confirmed GitHub checks passed.
  11. Merged the validated upgrade into main.
  12. Built the production Docker images from commit f3cdfcaacf.

Runtime and dependency changes​

Mastodon 4.7.1 requires Ruby 4.0.6.

The installed ruby-build definitions did not initially include Ruby 4.0.6, so ruby-build was updated before installing the new Ruby version.

cd ~/.rbenv/plugins/ruby-build
git pull

RUBY_CONFIGURE_OPTS=--with-jemalloc rbenv install 4.0.6
rbenv rehash

bundle install completed successfully.

Bundler automatically updated itself from 4.0.16 to the lockfile version, 4.0.18.

yarn install --immutable also completed successfully using Yarn 4.18.0.

Merge conflict handling​

Dependency, build-system, configuration, application, and locale files were generally aligned with upstream 4.7.1 unless there was a known reason to retain a local change.

Notable upstream changes included:

  • Ruby 4.0.6
  • Vite configuration changes
  • removal of config/vite.json
  • addition of config/vite.yml
  • substantial JavaScript/UI changes
  • ActivityPub signing/integrity changes
  • account URI changes
  • keypair migrations
  • recommendation/account summary changes
  • new pre/post deployment migrations

Preserved local customizations​

The following intentional customizations were retained.

lint-staged Ruby environment​

lint-staged.config.js continues to use rbenv exec for Ruby-based linters:

'Gemfile|*.{rb,ruby,ru,rake}':
'rbenv exec bundle exec rubocop --force-exclusion -a',

'*.haml':
'rbenv exec bundle exec haml-lint -a',

The upstream TypeScript invocation was adopted:

'**/*.ts?(x)': () => 'yarn tsc -p tsconfig.json --noEmit',

Sequential pre-commit linting​

.husky/pre-commit continues to use:

yarn lint-staged --concurrent false

This is retained to avoid resource contention and Rubocop processes being killed during concurrent lint execution.

Fork drift cleanup​

During JavaScript linting, the following file was found to differ unnecessarily from upstream:

app/javascript/mastodon/store/middlewares/loading_bar.ts

The fork still contained type assertions such as:

dispatch(showLoading() as UnknownAction);
dispatch(hideLoading() as UnknownAction);

Mastodon 4.7.1 no longer requires these assertions.

The file was restored to the upstream 4.7.1 version.

After the change:

yarn lint:js --max-warnings 0

completed successfully.

Test environment preparation​

RSpec initially failed before meaningful application tests could run because the local test environment was incomplete.

PostgreSQL​

A dedicated PostgreSQL test role/database configuration was used:

DB_USER=mastodon_test
DB_NAME=mastodon_test

Database connectivity and migration state were verified successfully.

Redis​

A single RSpec example initially failed with:

Redis::CannotConnectError
Failed to connect to localhost:6379

After Redis became available, the same example passed:

1 example, 0 failures

ffmpeg​

The full Ruby test suite later completed with:

7648 examples, 11 failures, 2 pending

All 11 failures were related to missing ffmpeg / ffprobe in media-processing tests.

The two pending tests were explicitly marked by upstream as waiting for Ubuntu 26.04 runners.

After installing ffmpeg, the affected media test files were rerun:

56 examples, 0 failures

No application-code failure remained among the previously failing media tests.

Validation​

The following checks were completed before production deployment:

  • dependency installation completed
  • test database migrations completed
  • Redis connectivity confirmed
  • targeted RSpec failures resolved
  • affected media tests: 56 examples, 0 failures
  • JavaScript lint passed
  • git diff --check passed
  • merge conflicts fully resolved
  • intended lint-staged customization confirmed
  • intended Husky pre-commit customization confirmed
  • GitHub checks passed

Image build​

Production images were built from:

f3cdfcaacf

Images:

mustardkim/mastodon-mustard:v4.7.1
mustardkim/mastodon-mustard:v4.7.1-streaming

Production database migration​

The production migration was run with:

docker compose run --rm web bundle exec rails db:migrate

The migration completed successfully.

One migration was significantly longer than the others:

UpdateAccountSummariesToVersion3

It took approximately:

1175 seconds

or about 19 minutes 35 seconds.

Most of the time was spent creating the temporary account_summaries materialized view.

Subsequent migrations, including conversion of the recommendation/account summary materialized views to tables, completed successfully.

Final migration status showed all Mastodon 4.7.1 migrations as up.

Post-migration HTTP 500​

After the database migrations completed, the web interface returned:

We're sorry, but something went wrong on our end.

The web container log showed:

NameError:
undefined local variable or method 'requested_deletion_at'
for an instance of Account

The relevant code path was:

app/models/account.rb
Account#deleted?

The requested_deletion_at database migration had already completed successfully.

The running web and Sidekiq processes had been started before the schema change and still had stale ActiveRecord schema information.

Restarting the Rails processes resolved the issue:

docker compose restart web sidekiq

After the restart, the web interface returned to normal operation.

Post-upgrade verification​

Verified after deployment:

  • Docker services running
  • web container healthy
  • Sidekiq container healthy
  • streaming container healthy
  • PostgreSQL healthy
  • Redis healthy
  • production migrations all up
  • web interface loads normally after Rails process restart

Further normal production use will continue to be monitored for federation, media processing, background jobs, and streaming behavior.

Result​

Upgrade completed successfully.

Important observations:

  • The 4.7.1 merge required substantially more validation than recent patch releases.
  • Existing fork drift caused at least one JavaScript lint failure and was removed.
  • Test failures initially reflected missing test-environment dependencies rather than application regressions.
  • UpdateAccountSummariesToVersion3 was the longest production migration at approximately 19 minutes 35 seconds.
  • Rails application processes must be restarted after migrations that add columns referenced by the new application code.
  • Running db:migrate directly also executed post-deployment migrations in this deployment.

Lessons learned​

Separate pre- and post-deployment migrations​

For upgrades with post-deployment migrations, the upgrade runbook should explicitly separate them.

Pre-deployment migrations:

docker compose run --rm \
-e SKIP_POST_DEPLOYMENT_MIGRATIONS=true \
web bundle exec rails db:migrate

Deploy/restart the new application services:

docker compose up -d

Then run post-deployment migrations:

docker compose run --rm web bundle exec rails db:migrate

Verify that application processes were actually restarted​

A successful database migration does not refresh schema information already cached by running Rails processes.

After schema-changing migrations, explicitly verify that web and sidekiq are running newly started processes.

Validate the test environment before interpreting test failures​

The 4.7.1 validation process exposed missing local test dependencies:

  • PostgreSQL test role/database
  • Redis
  • ffmpeg / ffprobe

Infrastructure failures should be separated from application-code failures before investigating the merge itself.

Follow-up​

  • Update runbooks/upgrade.md to document pre-deployment and post-deployment migrations separately.
  • Add explicit Rails process restart verification after schema-changing migrations.
  • Continue monitoring federation, Sidekiq, streaming, media processing, and backup jobs.
  • Remove the upgrade-4.7.1 branch after the production deployment has remained stable.