Upgrading Mastodon through multiple updates
Some very specific instructions I had to write down in order to upgrade my Mastodon instances from v4.2.17 to v4.4.5
4.2.17 -> 4.2.26
- run
./backup.sh - run
docker compose down - edit compose.yaml, updating the tag on:
- web
- streaming
- sidekiq
- run
docker compose pull - run db migration:
docker compose run --rm web rails db:migrate - run
docker compose up -d - restart nginx
4.2.26 -> 4.3.13
- run
./backup.sh - run
docker compose down - edit compose.yaml, updating the tag on:
- web
- streaming
- sidekiq
- edit compose.yaml, change streaming to use image
ghcr.io/mastodon/mastodon-streaming - run
docker compose pull - run db migration:
docker compose run --rm -e SKIP_POST_DEPLOYMENT_MIGRATIONS=true web rails db:migrate - set encryption keys:
docker compose run --rm web rails db:encryption:init - copy the encryption keys to
.env.production - run db migration again:
docker compose run --rm web rails db:migrate - edit main nginx config:
##
# Connection header for WebSocket reverse proxy
##
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
-
edit site nginx config, under
location ^~ /api/v1/streaming:proxy_set_header Proxy ""; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; add_header Strict-Transport-Security "max-age=63072000; includeSubDomains"; - run
docker compose up -d - restart nginx
4.3.13 -> 4.4.5
- run
./backup.sh - run
docker compose down - edit compose.yaml, updating the tag on:
- web
- streaming
- sidekiq
- run
docker compose pull - run db migration:
docker compose run --rm -e SKIP_POST_DEPLOYMENT_MIGRATIONS=true web rails db:migrate - If needed, remove the REDIS_NAMESPACE variable (more info here)
- download rename.rb into redis folder
- run redis migration:
docker compose run --rm redis rails runner /data/rename.rb - remove
REDIS_NAMESPACEfrom .env.production
- run db migration again:
docker compose run --rm web rails db:migrate - rebuild feeds:
docker compose run --rm web bundle exe tootctl feeds build - run
docker compose up -d - restart nginx
