Created
October 20, 2014 20:30
-
-
Save shavit/ca4ab56b77c8a9801711 to your computer and use it in GitHub Desktop.
Git deployment for Ruby on Rails applications in production
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
#!/bin/sh | |
APP_PATH=/var/www/app | |
# Production environment | |
export RAILS_ENV="production" | |
exit_with_error(){ | |
echo "---> An Error Has Occurred!" | |
} | |
echo "---> Receiving push" | |
git --work-tree=/var/www/app --git-dir=/var/repositories/app.git checkout -f | |
echo "---> Changing directory to the application path" | |
cd ${APP_PATH} | |
echo "---> Compiling assets" | |
bundle exec rake assets:precompile | |
echo "---> Installing gems via bundler" | |
bundle install --deployment --without development test --path APP_PATH || exit_with_error | |
echo "---> Migrating database" | |
bundle exec rake db:migrate || exit_with_error | |
echo "---> Restart App" | |
restart app | |
echo "---> Done" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment