Scale all worker types during a migration

pull/3/head
Doc Ritezel 7 years ago
parent 8063839747
commit d8a96615ee
  1. 11
      bin/deploy

@ -13,6 +13,9 @@ then
fi fi
WORKER_COUNT=$(heroku ps | grep 'worker\.' | wc -l) 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 if ! git diff HEAD heroku/master --exit-code -- priv/repo
then then
@ -20,23 +23,23 @@ then
then then
heroku features:disable preboot --app $HEROKU_APPLICATION heroku features:disable preboot --app $HEROKU_APPLICATION
heroku maintenance:on --app $HEROKU_APPLICATION heroku maintenance:on --app $HEROKU_APPLICATION
heroku scale worker=0 --app $HEROKU_APPLICATION heroku scale worker=0 scheduler=0 receipts=0 blocks=0 --app $HEROKU_APPLICATION
heroku pg:killall --app $HEROKU_APPLICATION heroku pg:killall --app $HEROKU_APPLICATION
git push heroku $CIRCLE_SHA1:refs/heads/master git push heroku $CIRCLE_SHA1:refs/heads/master
heroku pg:backups capture --app $HEROKU_APPLICATION heroku pg:backups capture --app $HEROKU_APPLICATION
heroku run "POOL_SIZE=2 mix ecto.migrate" --app $HEROKU_APPLICATION heroku run "POOL_SIZE=2 mix ecto.migrate" --app $HEROKU_APPLICATION
heroku scale worker=$WORKER_COUNT --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 restart --app $HEROKU_APPLICATION
heroku maintenance:off --app $HEROKU_APPLICATION heroku maintenance:off --app $HEROKU_APPLICATION
heroku features:enable preboot --app $HEROKU_APPLICATION heroku features:enable preboot --app $HEROKU_APPLICATION
else else
heroku maintenance:on --app $HEROKU_APPLICATION heroku maintenance:on --app $HEROKU_APPLICATION
heroku scale worker=0 --app $HEROKU_APPLICATION heroku scale worker=0 scheduler=0 receipts=0 blocks=0 --app $HEROKU_APPLICATION
heroku pg:killall --app $HEROKU_APPLICATION heroku pg:killall --app $HEROKU_APPLICATION
git push heroku $CIRCLE_SHA1:refs/heads/master git push heroku $CIRCLE_SHA1:refs/heads/master
heroku pg:backups capture --app $HEROKU_APPLICATION heroku pg:backups capture --app $HEROKU_APPLICATION
heroku run "POOL_SIZE=2 mix ecto.migrate" --app $HEROKU_APPLICATION heroku run "POOL_SIZE=2 mix ecto.migrate" --app $HEROKU_APPLICATION
heroku scale worker=$WORKER_COUNT --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 restart --app $HEROKU_APPLICATION
heroku maintenance:off --app $HEROKU_APPLICATION heroku maintenance:off --app $HEROKU_APPLICATION
fi fi

Loading…
Cancel
Save