Blockchain explorer for Ethereum based network and a tool for inspecting and analyzing EVM based blockchains.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
blockscout/bin/deploy

53 lines
2.1 KiB

#!/bin/bash
set -ex
[[ -z ${HEROKU_APPLICATION} ]] && HEROKU_APPLICATION=$1
[[ ! -s "$(git rev-parse --git-dir)/shallow" ]] || git fetch --unshallow origin
if ! git remote | grep heroku
then
git remote add heroku git@heroku.com:${HEROKU_APPLICATION}.git
git fetch heroku
fi
WORKER_COUNT=$(heroku ps | grep 'worker\.' | wc -l)
SCHEDULER_COUNT=$(heroku ps | grep 'scheduler\.' | wc -l)
RECEIPTS_COUNT=$(heroku ps | grep 'receipts\.' | wc -l)
BLOCKS_COUNT=$(heroku ps | grep 'blocks\.' | wc -l)
if ! git diff HEAD heroku/master --exit-code -- priv/repo
then
if heroku features --app $HEROKU_APPLICATION | grep '\[+\] preboot'
then
heroku features:disable preboot --app $HEROKU_APPLICATION
heroku maintenance:on --app $HEROKU_APPLICATION
heroku scale worker=0 scheduler=0 receipts=0 blocks=0 --app $HEROKU_APPLICATION
heroku pg:killall --app $HEROKU_APPLICATION
git push heroku $CIRCLE_SHA1:refs/heads/master
heroku pg:backups capture --app $HEROKU_APPLICATION
heroku run "POOL_SIZE=2 mix ecto.migrate" --app $HEROKU_APPLICATION
heroku scale worker=${WORKER_COUNT} scheduler=${SCHEDULER_COUNT} receipts=${RECEIPTS_COUNT} blocks=${BLOCKS_COUNT} --app $HEROKU_APPLICATION
heroku restart --app $HEROKU_APPLICATION
heroku maintenance:off --app $HEROKU_APPLICATION
heroku features:enable preboot --app $HEROKU_APPLICATION
else
heroku maintenance:on --app $HEROKU_APPLICATION
heroku scale worker=0 scheduler=0 receipts=0 blocks=0 --app $HEROKU_APPLICATION
heroku pg:killall --app $HEROKU_APPLICATION
git push heroku $CIRCLE_SHA1:refs/heads/master
heroku pg:backups capture --app $HEROKU_APPLICATION
heroku run "POOL_SIZE=2 mix ecto.migrate" --app $HEROKU_APPLICATION
heroku scale worker=${WORKER_COUNT} scheduler=${SCHEDULER_COUNT} receipts=${RECEIPTS_COUNT} blocks=${BLOCKS_COUNT} --app $HEROKU_APPLICATION
heroku restart --app $HEROKU_APPLICATION
heroku maintenance:off --app $HEROKU_APPLICATION
fi
else
git push heroku $CIRCLE_SHA1:refs/heads/master
heroku pg:backups capture --app $HEROKU_APPLICATION
fi
set +x
heroku config:set ADMIN_PASSWORD=$(mix phx.gen.secret) --app $HEROKU_APPLICATION