Skip to content

Instantly share code, notes, and snippets.

@Schwad
Created December 5, 2017 16:19
Show Gist options
  • Save Schwad/3ad751be1e37dbe12e8c1428e82e1d5e to your computer and use it in GitHub Desktop.
Save Schwad/3ad751be1e37dbe12e8c1428e82e1d5e to your computer and use it in GitHub Desktop.
bin/deploy deployment of a Ruby on Rails application to Heroku
# Sets up APPLICATION_NAME_HERE and deploys to Heroku. This should be run while on master
# NOTE: if you get a permission denied error, try running `chmod u+x bin/deploy` in the terminal
# Fails script if any commands fail
set -e
echo '== Installing dependencies =='
bundle install
# Sets up the database
echo '== Preparing database =='
RAILS_ENV=production bundle exec rake db:migrate
echo '== Preparing assets =='
rake assets:precompile
git add -A
git commit -m 'vendor compiled assets'
echo '== Deploying =='
# Pushes to Heroku and updates with changes
git push heroku master
heroku run rake db:migrate
heroku restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment