Last active
February 9, 2017 05:19
-
-
Save cupnoodle/0faef2c737ebb7eb988e2a56b4fe1bad to your computer and use it in GitHub Desktop.
Revisions
-
cupnoodle revised this gist
Aug 12, 2016 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -18,7 +18,7 @@ do echo "work tree is located at" echo $WORK_TREE bundle install --deployment rake db:create RAILS_ENV=production rake db:migrate RAILS_ENV=production rake assets:precompile RAILS_ENV=production -
cupnoodle created this gist
Aug 7, 2016 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,34 @@ #!/bin/bash -l #The -l parameter executes the command in a login shell GIT_DIR=/home/rails/repo/fox_sample.git WORK_TREE=/home/rails/fox_sample while read oldrev newrev ref do if [[ $ref =~ .*/master$ ]]; then echo "Master ref received. Deploying master branch to production" git --work-tree=$WORK_TREE --git-dir=$GIT_DIR checkout -f # start deploy tasks cd $WORK_TREE echo "work tree is located at" echo $WORK_TREE bundle install rake db:create RAILS_ENV=production rake db:migrate RAILS_ENV=production rake assets:precompile RAILS_ENV=production sudo service unicorn restart sudo service nginx restart # end deploy tasks echo "Git post-receive deploy complete" else echo "Ref $ref received successfully. No action performed: only the master branch can be deployed on this server." fi done