Last Updated: December 26, 2018
·
3.387K
· avnerner

Node JS Seamless Deploy

Those coming in from the Ruby world are probably well familiar with Unicorn.
You start a few workers, you update your code, send a USR2 signal to the master process and boom a new set of workers are running with the new code.

Node JS makes this a little more painful, but there is a very nice solution to it - Naught.
https://github.com/superjoe30/naught

We have been using Naught in production for a while now, it gives us a very clean deploy with Zero down and happy users.

I've created a simple Template repository -
https://github.com/AvnerCohen/node_template

It includes a stack of best-of-breed node.js modules of what we've found to be stable and performant on top of express for a production service node service.

3 Responses
Add your response

I started using naught as well. Can you explain how you make redeployments/hot-swaps smoothly? I mean, right now I have a folder with my node.js app. I ran "naught start app.js" to start the server, so now I have a "naught.ipc" file inside that folder. Now I want to deploy the updated code: Do I just "git pull origin master" in the same folder and "naught deploy", or pull the code to a different folder? Couldn't figure that out from the docs.

over 1 year ago ·

It really depends on your use case on source control being used.
We us git, and so we so we base the logic on git pull.
In the project I posted, you can also see a sample deploy.sh script that we use to apply the changes, using git:
https://github.com/AvnerCohen/node_template/blob/master/deploy.sh

Another view on deploy process is described in this issue (that was fixed since):
https://github.com/andrewrk/naught/issues/25

over 1 year ago ·

Hi Avner
Very nice template.
I'm looking to get a better understanding of testing each node before I send the 'online' message. Think you can help me you here -
http://stackoverflow.com/questions/23753024/using-supertest-to-test-separate-nodes-run-by-naught

Thanks !

over 1 year ago ·