Last active
April 15, 2019 16:41
-
-
Save rhiroyuki/443a0f77280b0813d9aa7e556c61a090 to your computer and use it in GitHub Desktop.
Heroku commands
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
HEROKU_ENVIRONMENT=staging | |
heroku maintenance:on --remote "$HEROKU_ENVIRONMENT" | |
heroku ps:scale --remote "$HEROKU_ENVIRONMENT" > dynoscales | |
heroku ps:scale $(heroku ps:scale --remote "$HEROKU_ENVIRONMENT" | sed -E 's/=([0-9]+):/=0:/g') --remote "$HEROKU_ENVIRONMENT" | |
git push "$HEROKU_ENVIRONMENT" HEAD:master | |
# You should check first if you need to run any other scrips before atempting to deploy to production | |
heroku run bundle exec rake db:migrate --remote "$HEROKU_ENVIRONMENT" | |
heroku ps:scale `cat dynoscales` --remote "$HEROKU_ENVIRONMENT" | |
heroku maintenance:off --remote "$HEROKU_ENVIRONMENT" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Check postgres version | |
heroku pg:info | |
# Set maintenance on | |
heroku maintenance:{on|off} | |
# Save dyno formation state | |
heroku ps:scale > mydynoformation | |
# Scale dynos to 0 | |
heroku ps:scale $(heroku ps:scale | sed -E 's/=([0-9]+):/=0:/g') | |
# Scale dynos back to their original state | |
heroku ps:scale `cat mydynoformation` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment