I really publishing my sites with git. To do that, I like to have consistent folder structures and a consistent post-receive
hook to handle starting and stopping the application.
All stopping / starting is handled with pm2. I've also used forever.js, but found this to be more reliable.
/var/www/{projectName}
/var/repo/{projectName}
First, create your setup directory and install the module.
mkdir /var/setup && cd /var/setup
npm install do-git-setup-helper
Then you'll need to create your index.js
file to run this:
/* /var/setup/index.js */
require('do-git-setup-helper')(__dirname);
To run the helper, you'll execute this command:
node /var/setup/index.js
I hope that helps. Good Luck!