Skip to content

Instantly share code, notes, and snippets.

@abinoam
Created March 20, 2015 15:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save abinoam/69546d65db87e509b6c8 to your computer and use it in GitHub Desktop.
Save abinoam/69546d65db87e509b6c8 to your computer and use it in GitHub Desktop.
Codeship custom script for Heroku deploying with maintenance mode
#!/bin/sh
# This codeship custom script depends on:
# - API_KEY env var from Heroku
# - STAGING_APP_NAME
# - STAGING_APP_URL
set -e
export HEROKU_API_KEY="${API_KEY}"
# Turn on Heroku maintenance mode
heroku maintenance:on --app ${STAGING_APP_NAME}
# Push
git remote add heroku "git@heroku.com:${STAGING_APP_NAME}.git"
git push heroku -f "${COMMIT_ID}:refs/heads/master"
# if migrations are enabled
heroku_run rake db:migrate "${STAGING_APP_NAME}"
# heroku_run restart "${STAGING_APP_NAME}"
# Turn off Heroku maintenance mode
heroku maintenance:off --app ${STAGING_APP_NAME}
# check if the app is up and running
check_url "${STAGING_APP_URL}"
@abinoam
Copy link
Author

abinoam commented Mar 20, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment