run bundle and migration in Automatic deploy with Git
sudo nano hooks/post-receive
#!/bin/bash
while read oldrev newrev ref
do
if [[ $ref =~ .*/master$ ]];
then
echo "Master ref received. Deploying master branch to production..."
git --work-tree=/home/ec2-user/ywrstaging/ywroom-staging --git-dir=/home/ec2-user/proj checkout -f
# sudo /etc/init.d/nginx restart
cd /home/ec2-user/ywrstaging/ywroom-staging && source ~/.rvm/scripts/rvm && bundle install && rake db:migrate
sudo /etc/init.d/nginx restart
else
echo "Ref $ref successfully received. Doing nothing: only the master branch may be deployed on this server."
fi
done
#!/bin/bash
while read oldrev newrev ref
do
if [[ $ref =~ .*/master$ ]];
then
echo "Master ref received. Deploying master branch to production..."
git --work-tree=/home/ec2-user/ywrstaging/ywroom-staging --git-dir=/home/ec2-user/proj checkout -f
# sudo /etc/init.d/nginx restart
cd /home/ec2-user/ywrstaging/ywroom-staging && source ~/.rvm/scripts/rvm && bundle install && rake db:migrate
sudo /etc/init.d/nginx restart
else
echo "Ref $ref successfully received. Doing nothing: only the master branch may be deployed on this server."
fi
done
Comments
Post a Comment