Hi devs, I was able to create the nodejs cartridge using the puppet labs module [1 <https://forge.puppetlabs.com/puppetlabs/nodejs>] and write an extension to manage the nodejs applications. It has following features
- Supports installing Node and NPM (Package Manager) in many Debian and RedHat distributions. Currently Stratos mainly supports Debian/Ubuntu and if we are to move into other OS's, this will be a useful feature in the future. - Downloads and installs all the required dependencies specified in the package.json file in any nodejs application via npm. - Downloads and installs Forever [2 <https://github.com/nodejitsu/forever>] which will manage keeping the application alive and make sure applications run continuously with updates take in place. There are several other process managers available like pm2 [ 3 <https://github.com/Unitech/pm2>] with more features which can be used as well. - Reads the main js file from the package.json and starts the application using forever. This way, there's no need of modifying the nodejs application, if it has followed the standard nodejs application structure. Yet I have following concerns when it comes to Nodejs specific applications. 1. The nodejs application itself defines the ports in use. This may create problems in specifying the cartridge definition prior to the deployment. The port to be listened has to be specified correctly in the cartridge definition in order for a particular instance to be activated properly. 2. Since we only can specify a single cartridge definition per service type, all the ports which will be used by the nodejs application has to be pre-defined/pre-known and at the time of defining the cartridge definition. Also instance might hang up waiting, listing to the ports which are currently not used. 3. Monitoring the health would also be difficult. 4. Deploying multiple applications using the same git repository could be done. But will have to use a separate configuration file to specify which/how to start those applications specifically. Also the necessary ports have to be specified in the definition prior to the deployment. Please let me know any specifics/suggestions which I can use to overcome the above issues. [1] https://forge.puppetlabs.com/puppetlabs/nodejs [2] https://github.com/nodejitsu/forever [3] https://github.com/Unitech/pm2 Thanks, On Sun, Jul 27, 2014 at 5:54 PM, Lakmal Warusawithana <[email protected]> wrote: > > > > On Sun, Jul 27, 2014 at 5:49 PM, Lasindu Charith <[email protected]> wrote: > >> Hi, >> >> I'm trying to re-create(modify) Nodejs cartridge for Stratos. When going >> through the PuppetLabs's forge, I found there are several nodejs puppet >> modules in forge, even a module from puppet enterprise itself with Apache >> 2.0 licence as well. There are many puppetlabs/puppet enterprise supported >> modules [1 >> <https://forge.puppetlabs.com/modules?utf-8=%E2%9C%93&sort=&supported=yes>] >> which are compatible with several OS's and are quite popular among puppet >> community. >> >> So I was wondering what if we can include at-least most common puppet >> enterprise supported modules inside stratos without re-inventing the wheel >> out of the box. >> > > +1 Lasindu. If you have time, please see what we can bring other generic > software as cartridges. > > >> >> Is there a convention to be used ? or anyone tried using them? >> >> I tried replacing the existing nodejs module inside Stratos and it worked >> fine as expected. >> >> [1] >> https://forge.puppetlabs.com/modules?utf-8=%E2%9C%93&sort=&supported=yes >> >> Thanks, >> -- >> *Lasindu Charith* >> Software Engineer, WSO2 Inc. >> Mobile: +94714427192 >> Web: blog.lasindu.com >> > > > > -- > Lakmal Warusawithana > Vice President, Apache Stratos > Director - Cloud Architecture; WSO2 Inc. > Mobile : +94714289692 > Blog : http://lakmalsview.blogspot.com/ > > -- *Lasindu Charith* Software Engineer, WSO2 Inc. Mobile: +94714427192 Web: blog.lasindu.com
