Tired of having to restart your NodeJS application after each JS change? No more! 8)
I am doing some testing on my server with a socket.io application and, in order to coolaborate easily, I configured a WebHook on my GitHub repository in order to auto-update the code. This was solving the initial problem: how to update the code without sharing access to the server but there was still one other issue: how to restart the NodeJS app after a code update. First I was thinking on saving the PID of the runnin app into a file and let the pull script to do the magic, but then I thought “hey, I am not the first want willing to do it!” so a little search on Google brought the magic to my eyes: node-supervisor.
Really simple to install and to use, in my case it is just:
supervisor -w .,controllers,models app.js >> /var/log/some-log-file.log
Obviously you can do the same trick on your testing or local environment, so, what are you waiting to forget about the Ctrl+C ?

Pingback: 10 posts de #Nodejs que no te puedes perder « Silvercorp
Personally, I love using node-supervisor locally, but found more usefulness on using forever on production. Are you using node-supervisor on both ends?
I am using supervisor only for testing purposes, we were using forever at the beginning but then moved it into a proper script on the server to register the node application as a server init script, so now we can do something like /etc/init.d/something start or /etc/init.d/something stop and also have the OS handle the restart in case it goes down
We use upstart on Centos 6 and Amazon AMI and it does the trick nicely, if the server goes down it brings it right back up, defiantly my favorite way to deploy node. We have a legacy server using Monit but that kinda sucks and is much slower than upstart. FWIW.
I think we also use upstart on the production servers but I am not that involved there. It is definitely a nice way to have it running. About the AMI… We do not use Amazon cause the application is only available on the intranet; I do like using Amazon and it is currently hosting many of my personal stuff
.
Thanks for the comment!