Reputation: 2933
If I'm hosting my own node.js server, how would I go about making it so that I can push updates to the code like I would on Heroku?
I want to be able to host my source code on the same server as my node app and then whenever I push updates, it will restart the node app with the updated code. How do I do this?
Thanks!
Upvotes: 0
Views: 78
Reputation: 9621
You should use a git post-receive
hook.
From the documentation:
The
post-receive
hook runs after the entire process is completed and can be used to update other services or notify users.
Your script could be something like
Be aware that your script should not take a long time to run as
This script can’t stop the push process, but the client doesn’t disconnect until it has completed; so, be careful when you try to do anything that may take a long time.
Upvotes: 1