If you have missed – here is the Part 1 of the article, the one where I am researching for the tools we do need to be able to build the Node.js clustered app with autodiscovery.
Let’s continue, then. First of all – you can find the application on github here: https://github.com/PavelPolyakov/nodejs-clustered-app-with-autodiscovery . There you can also find the setup guide and try to launch the cluster yourself, you don’t need much, just four Vagrant machines.
In the application below is a demo example of the Node.js clustered app with autodiscovery. I’m sure it’s possible to build another setups and, probably, there are some already, but I came up with the next one.
In today’s article I would share my experience in building the Node.js application, which can make a cluster with another copies of the app even if it doesn’t know where the other apps are located at the moment of the application start.
Sounds too complicated, so first let’s talk about clusters.
Node.js remote debug is the perfect option for the cases, when you project is run inside the Vagrant box.
Luckly, both node.js and WebStorm have all the needed options, to make the debug still possible and convenient.
Below it’s described how to configure the Node.js Remote Debug in WebStorm.
Node.js 0.11 is quite stable to use it on production. On your local machine you, probably, are using the nvm to install node.js versions.
But on the remote server it is not the best idea, because we want to have one node.js and npm installation for all the system users.
How to install it properly?