/pre-upgrade-mastodon.sh
#!/bin/sh

. lib.sh
. common.opts

load_opts "$1"

JAILNAME=$MASTODON_JAILNAME

set -e
set -x

jexec -U mastodon $JAILNAME /bin/sh <<SCRIPT
set -e
set -x

export RAILS_ENV=production
export SKIP_POST_DEPLOYMENT_MIGRATIONS=true

cd ~/live
bundle exec rails db:migrate
SCRIPT