Created
November 15, 2022 23:31
-
-
Save ksonney/2ff09a5cc3f953c524ee3f97aa20677b to your computer and use it in GitHub Desktop.
Mastodon Update/Upgrade script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This script works on the theory that you use a tagged image in your docker-compose.yaml | |
# i.e. "image: tootsuite/mastodon:v4.0.2" | |
# Make a database backup | |
docker exec mastodon_db_1 pg_dump -Fc -U postgres postgres > pre-4-0-2.dump | |
# replace the old tag with the new tag | |
sed -s 's/v4.0.1/v4.0.2/g' -iv4.0.1 docker-compose.yml | |
# Pull the new images | |
docker-compose pull | |
# run the upgrade/migrations | |
docker-compose run --rm -e SKIP_POST_DEPLOYMENT_MIGRATIONS=true web rails db:migrate | |
docker-compose down | |
docker-compose run --rm web bin/tootctl cache clear | |
docker-compose run --rm web rails db:migrate | |
docker-compose up -d | |
# clean up old, unused images | |
docker system prune -a |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment