Skip to content

Instantly share code, notes, and snippets.

@mkoryak
Created April 2, 2013 15:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mkoryak/5293127 to your computer and use it in GitHub Desktop.
Save mkoryak/5293127 to your computer and use it in GitHub Desktop.
git post-receive hook for a simple deployment of a nodejs app
#!/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."
@mkoryak
Copy link
Author

mkoryak commented Apr 2, 2013

requires: npm install forever -g

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment