Created
March 9, 2016 02:15
-
-
Save shavit/32b7625c46aa064efc8a to your computer and use it in GitHub Desktop.
Ruby on Rails post receive file for Git deployments.
This file contains hidden or 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=$APP_ROOT | |
exit_with_error(){ | |
echo "---> An Error Has Occurred!" | |
} | |
echo "---> Receiving push as $USER" | |
git --work-tree=$APP_PATH --git-dir=$GIT_DIR checkout -f | |
echo "---> Changing directory to the application path" | |
cd ${APP_PATH} | |
export GEM_PATH=/home/$USER/.rvm/gems/ruby-2.3.0:/home/$USER/.rvm/gems/ruby-2.3.0@global | |
export PATH=/home/$USER/.rvm/gems/ruby-2.3.0/bin:/home/$USER/.rvm/gems/ruby-2.3.0@global/bin:/home/$USER/.rvm/rubies/ruby-2.3.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/$USER/.rvm/bin:/home/$USER/.rvm/bin:/home/$USER/.rvm/bin | |
echo "---> Installing with bundler" | |
RAILS_ENV=production bundle install | |
echo "---> Migrating the database" | |
RAILS_ENV=production rake db:migrate | |
echo "---> Precompiling assets" | |
RAILS_ENV=production rake assets:precompile | |
echo "---> Setting permissions to /home/$USER/.rvm " | |
chown $USER /home/$USER/.rvm -R | |
# echo "---> Restarting the application" | |
# restart app | |
echo "---> Done" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment