lots: shellcheck, streaming stuff, fixes
[distro-setup] / disabled / mastodon-upgrade
diff --git a/disabled/mastodon-upgrade b/disabled/mastodon-upgrade
new file mode 100755 (executable)
index 0000000..a606049
--- /dev/null
@@ -0,0 +1,22 @@
+#!/bin/bash
+
+set -eE -o pipefail
+trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR
+
+# based on
+# https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Docker-Guide.md
+
+if [[ $EUID == 0 ]]; then echo "$0: error, do not run as root"; exit 1; fi
+
+cd /home/iank/mastodon
+git fetch
+git stash
+git checkout $(git tag | grep -v rc | tail -n1)
+git stash pop
+docker-compose build
+# these 2 may not be needed in all upgrades, but
+# simpler to just do them always.
+docker-compose run --rm web rake db:migrate
+docker-compose run --rm web rake assets:precompile
+# restart the app
+docker-compose up -d