Created
April 2, 2013 15:31
-
-
Save mkoryak/5293127 to your computer and use it in GitHub Desktop.
git post-receive hook for a simple deployment of a nodejs app
This file contains 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 | |
echo "Deploying..." | |
unset GIT_DIR | |
cd /home/deploy/srv/destructly/ | |
GIT_WORK_TREE=/home/deploy/srv/destructly/ | |
git checkout -f master | |
pwd | |
echo "Stopping service" | |
sudo forever stop `forever list | grep destructly.js | awk '{ print $2 }' | sed 's/\[\(.*\)\]/\1/'` | |
echo "Installing dependencies" | |
cd /home/deploy/srv/destructly/ | |
sudo npm install | |
ls -la /home/deploy/srv/destructly/ | |
sudo chown -R deploy:deploy /home/deploy/srv/destructly/ | |
echo "Starting service" | |
forever start /home/deploy/srv/destructly/destructly.js | |
echo "Deployment finished." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
requires: npm install forever -g