Skip to content

Instantly share code, notes, and snippets.

@danieljohnmorris
Created April 11, 2014 14:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danieljohnmorris/10473930 to your computer and use it in GitHub Desktop.
Save danieljohnmorris/10473930 to your computer and use it in GitHub Desktop.
Rails deploy scripts
# This goes in user root dir, ie ~
# So you can just call
alias deploy=./deploy.sh
alias deploy_ci=./deploy_ci.sh
alias deploy_live=./deploy_live.sh
#!/bin/bash
# clear the screen (can still scroll up)
clear
# call deploy scripts in order
./deploy_ci.sh
./deploy_live.sh
#!/bin/bash
# clear the screen (can still scroll up)
clear
# test ci tests locally first
cucumber --tags @ci
# merge development branch into master
git checkout master
git merge develop
git checkout develop
# push to heroku staging git remote
#git push sofar-staging master
# check no database migrations need to run
# heroku run rake db:migrate -a sofar-staging
# Instead of pushing to staging directly, push to CI environment, which then pushes code to staging and imports db backup from live
git push github master
#!/bin/bash
# clear the screen (can still scroll up)
clear
# show "check back in a few minutes" message
heroku maintenance:on -a HEROKU_APP_NAME
# push to heroku staging git remote
git push HEROKU_APP_NAME master
# run any db migrations on live
heroku run rake db:migrate -a HEROKU_APP_NAME
# allow visitors again
heroku maintenance:off -a HEROKU_APP_NAME
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment