Continuous deployment script
# Disable NewRelic pinging | |
curl https://heroku.newrelic.com/accounts/xxxxx/applications/yyyyyyyy/ping_targets/disable -X POST -H "X-Api-Key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" | |
heroku maintenance:on --app yourapp-staging | |
heroku pg:reset DATABASE --confirm yourapp-staging --app yourapp-staging | |
heroku pgbackups:restore DATABASE `heroku pgbackups:url --app yourapp-production` --app yourapp-staging --confirm yourapp-staging | |
git remote add heroku_yourapp-staging git@heroku.com:yourapp-staging.git | |
git push heroku_yourapp-staging $COMMIT_ID:master -f | |
heroku_run 'rake db:migrate' yourapp-staging | |
heroku restart --app yourapp-staging | |
heroku maintenance:off --app yourapp-staging | |
curl -sfS --retry 3 staging.yourapp.com | |
# Enable NewRelic pinging | |
curl https://heroku.newrelic.com/accounts/xxxxxx/applications/yyyyyyyy/ping_targets/enable -X POST -H "X-Api-Key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" |
# Disable NewRelic pinging | |
curl https://heroku.newrelic.com/accounts/xxxxxx/applications/yyyyyyyy/ping_targets/disable -X POST -H "X-Api-Key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" | |
heroku maintenance:on --app yourapp-production | |
heroku ps:scale worker=0 --app yourapp-production | |
heroku pgbackups:capture --expire --app yourapp-production | |
git remote add heroku_yourapp-production git@heroku.com:yourapp-production.git | |
git push heroku_yourapp-production $COMMIT_ID:master | |
git config --global user.email "codeship@example.com" | |
git config --global user.name "Continuous Integration" | |
git tag -a `heroku releases --app yourapp-production | grep Deploy | head -n 1 | cut -f 1 -d ' '` -m "Last backup `heroku pgbackups --app yourapp-production | tail -n 1 | cut -f 1 -d ' '`" | |
git push origin --tags | |
heroku_run 'rake db:migrate' yourapp-production | |
heroku restart --app yourapp-production | |
heroku ps:scale worker=1 --app yourapp-production | |
heroku maintenance:off --app yourapp-production | |
curl -sfS --retry 3 yourapp.com | |
# Enable NewRelic pinging | |
curl https://heroku.newrelic.com/accounts/xxxxxx/applications/yyyyyyyy/ping_targets/enable -X POST -H "X-Api-Key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment