How to Update Mastodon - docker Compose
make sure you are inside the mastodon folder
make sure enough space is available to migrate the db?!
docker-compose run --rm web bundle exec bin/tootctl media remove
docker-compose run --rm web bundle exec bin/tootctl preview_cards remove
make database backup
# Dump the backup into the root of the Docker container's filesystem
docker exec -t ID_OF_DB_CONTAINER/OR_NAME pg_dump -Fc -U postgres -f '/export.dump'
# Now copy it into the host machines filesystem
docker cp ID_OF_DB_CONTAINER/OR_NAME:/export.dump /home/export.dump
docker-compose down
change version numbers in docker-compose inside mastodon folder
look up current tag here (offical mastodon dockerfile)
<aside> 💡 Pick a specific verison number like v4.2.1 avoide using latest or you will get a shitshow - guranteed when the app updates but the db stays the same (unmigrated)
</aside>
the following 3 need to be changed
web, streaming and sidekiq
migrate db - double check the output - that there were no errors
docker-compose run --rm web rails db:migrate
start mastodon back up
docker-compose up -d
check version in web view / app
That’s it
sources:
https://ashfurrow.com/blog/restoring-a-postgres-mastodon-database/
# Dump the backup into the root of the Docker container's filesystem
docker exec -t mastodon_db_1 pg_dump -Fc -U postgres -f '/export.dump'
# Now copy it into the host machines filesystem
docker cp mastodon_db_1:/export.dump /home/ash/export.dump
this is a 2 step process → as docker file directories get deleted once container is down / deleted !!
so we need to copy it out of there into our local machine
https://www.bentasker.co.uk/posts/blog/general/upgrading-a-docker-mastodon-instance-to-gain-security-fixes.html
nice for what to change / walkthrough