Updating Mastodon Instance (Docker Version)

This approach makes updating to the latest version a real breeze.

TLDR version

git fetch
git stash
git checkout TAG_NAME
git stash pop
docker-compose build
docker-compose run --rm web rake db:migrate
docker-compose run --rm web rake assets:precompile
docker-compose up -d

Full version

  1. git fetch to download updates from the repository.
  2. Now you need to tell git to use those updates. You have probably changed your docker-compose.yml file. Check with git status.
  3. If the docker-compose.yml file is modified, run git stash to stash your changes.
  4. git checkout TAG_NAME to use the tag code. (If you have committed changes, use git merge TAG_NAME instead, though this isn't likely.)
  5. Only if you ran git stash, now run git stash pop to redo your changes to docker-compose.yml. Double check the contents of this file.
  6. Build the updated Mastodon image.
    • If you are using a prebuilt image: First, edit the image: tootsuite/mastodon lines in docker-compose.yml to include the tag for the new version. E.g. image: tootsuite/mastodon:v2.3.0
    • To pull the prebuilt image, or build your own from the updated code: docker-compose build
  7. (optional) docker-compose run --rm web rake db:migrate to perform database migrations. Does nothing if your database is up to date.
  8. (optional) docker-compose run --rm web rake assets:precompile to compile new JS and CSS assets.
  9. Follow any other special instructions in the release notes. docker-compose up -d to re-create (restart) containers and pick up the changes.

Source: https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Docker-Guide.md#updating