Skip to content

Instantly share code, notes, and snippets.

@keo
Created May 4, 2011 14:21
Show Gist options
  • Save keo/955303 to your computer and use it in GitHub Desktop.
Save keo/955303 to your computer and use it in GitHub Desktop.
git deploy hook
#!/bin/sh
# super-duper post-receive hook
# (c) 2011 Barnabas Debreczeni <keo@goa.hu>
DEPLOY_TO=/webapps/cms
umask 002
echo "++++++++++++++++++++++++++++++++++++++++++++ deploying to $DEPLOY_TO"
(
echo "===> copy files" && \
export GIT_DIR=`pwd` && \
git reset --hard && \
echo "===> bundle install" && \
cd $DEPLOY_TO && \
bundle install --deployment && \
echo "===> migrating database" && \
rake db:migrate RAILS_ENV=production && \
echo "===> restarting app" && \
touch tmp/restart.txt && \
echo "++++++++++++++++++++++++++++++++++++++++++ deploy SUCCESSFUL"
) ||
echo "++++++++++++++++++++++++++++++++++++++++++ deploy FAILED!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment