Skip to content

Instantly share code, notes, and snippets.

@gc373
Last active June 18, 2017 01:59
Show Gist options
  • Select an option

  • Save gc373/f2c14a6fab242805a82605da97c440a1 to your computer and use it in GitHub Desktop.

Select an option

Save gc373/f2c14a6fab242805a82605da97c440a1 to your computer and use it in GitHub Desktop.
Now , update my Mastodon instance 1.4.1 to 1.4.3
#!/bin/bash
#####################################################
# This script is intended for unattended upgrades
# of a standard Mastodon installation.
# Uncommited changes i.e. in config files
# will be stashed and restored.
# This script is not intended for forks with commits
# as the latest release will be checked out.
# Database migrations and asset-precompilation will
# run automatically.
# Contributed my @Halest
#####################################################
echo "-----Server down to 503-----"
touch /var/tmp/maintenance
cd /home/mastodon
echo "-----Stashing changes, fetching and pulling latest tag-----"
git stash
git fetch --tags
git checkout v1.4.3
git stash pop
echo "-----Recreating images and containers-----"
service docker restart
docker-compose stop
docker-compose rm -f
docker-compose build
echo "-----Running migrations and precompilations-----"
docker-compose run --rm web rails assets:precompile
docker-compose run --rm web rails mastodon:maintenance:prepare_for_foreign_keys
docker-compose run --rm web rails db:migrate
docker-compose up -d
docker system prune -f
echo "-----Unattended upgrade finished-----"
rm /var/tmp/maintenance
echo "----- Done !!!!! -----"
@gc373
Copy link
Author

gc373 commented Jun 15, 2017

@gc373
Copy link
Author

gc373 commented Jun 16, 2017

these 2 lines L14 L33 is for nginx settings.
like this.

if (-e /var/tmp/maintenance)  {
      return 503;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment