Skip to content

Instantly share code, notes, and snippets.

@shavit shavit/post-receive
Created Oct 20, 2014

Embed
What would you like to do?
Git deployment for Ruby on Rails applications in production
#!/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
You can’t perform that action at this time.