Advertisement
Guest User

Untitled

a guest
Jun 8th, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.00 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. GIT_DIR=/home/deploy/teamtester_production
  4. WORK_TREE=/home/deploy/teamtester
  5. export TEAMTESTER_DATABASE_USER='teamtester'
  6. export TEAMTESTER_DATABASE_PASSWORD='***'
  7.  
  8. export RAILS_ENV=production
  9. . ~/.bash_profile
  10.  
  11. while read oldrev newrev ref
  12. do
  13.     if [[ $ref =~ .*/master$ ]];
  14.     then
  15.         echo "Master ref received.  Deploying master branch to production..."
  16.         mkdir -p $WORK_TREE
  17.         git --work-tree=$WORK_TREE --git-dir=$GIT_DIR checkout -f
  18.         mkdir -p $WORK_TREE/shared/pids $WORK_TREE/shared/sockets $WORK_TREE/shared/log
  19.  
  20.         # start deploy tasks
  21.         cd $WORK_TREE
  22.         bundle install
  23.         rake db:create
  24.         rake db:migrate
  25.         rake assets:precompile
  26.         sudo restart puma-manager
  27.         sudo service nginx restart
  28.         # end deploy tasks
  29.         echo "Git hooks deploy complete"
  30.     else
  31.         echo "Ref $ref successfully received.  Doing nothing: only the master branch may be deployed on this server."
  32.     fi
  33. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement