This project makes git hooks for deployment to a remote server. It generates a target folder with git configuration and upon newly pushed data it will run the commands npm install
, bower install
and grunt build
as well as restarting the node server run by forever.
You can specify the NODE_ENV
and other desired environmental variables such as PORT
and different API keys.
You only need to clone this repository on your remote machine.
git clone https://github.com/Ali92hm/node-githook-deploy.git
Run the following command on your server
python deploy-hook.py [app-name]
For example you can run
python deploy-hook.py /var/www/my-app
Then you will be asked a series of question such as NODE_ENV
, other optional environmental variables and the relative path to your applications main script.
To add a remote to a git repository navigate to the repository and run the following command
git remote add [remote-name] [username]@[remote-address]:[path-to-remote-folder]
For example you can run
git remote add deploy-ec2 ubuntu@ec2_address:/var/www/my-app
Run the following command to push to this repository from your machine
git push [remote-name] master
This command will push your changes to the remote server, download the newly added npm and bower modules, build the distribution version using grunt and restart the node application run by forever.
node-githook-deploy
├── LICENSE-MIT
├── README.md
└── lib
└── deploy-hook.py - Generator script
- This script might not work under the Windows operating system.
- Test on windows.
- Make an npm module and put on npm