Let's talk about what this module actually does. First of all we create a nodejs user which we will use for all deployment related activities of all the node app's, as a convention we have created a folder /home/nodejs/nodeapps this folder will contain all the code of our node applications.
This modules adds 2 scripts as well the first one is deployNodeApp.sh, deployNodeApp.sh is a generic script that assumes that node app code will be present in tar form at /home/nodejs it will clean existing code of nodeapp at /home/nodejs/nodeapps untar the code at corresponding directory of node app & restart the node app. As another convention we are using upstart for managing the node app i.e starting & stopping the node app I'll talk about the upstart configuration in my next blog where I'll talk about generic puppet module for a node app. Another script startNodeApp.sh will take care of starting the node app after doing some per-processing such as loading some environment specific properties of node app which we don't want to commit in the codebase i.e want to separate it out from deployment process choosing a specific version of node.
This module also takes cares of installing nvm for nodejs user so that nodejs version can be managed locally for this user or app.
Though we already have a puppet module for nodejs, but I had some specific requirements which I wanted to handle that's why I've created this module.
Let me know if you have some points of improvement in this module, one thing that I wanted to add in this module is to add npm installation but it had some other dependencies also I had some doubts whether I should have npm as part of nodejs module or not.