{"id":437,"date":"2013-10-17T10:02:00","date_gmt":"2013-10-17T10:02:00","guid":{"rendered":"https:\/\/opstree.com\/blog\/\/2013\/10\/17\/puppet-module-to-setup-nodejs-deployment-2\/"},"modified":"2025-11-27T15:10:24","modified_gmt":"2025-11-27T09:40:24","slug":"puppet-module-to-setup-nodejs-deployment-2","status":"publish","type":"post","link":"https:\/\/opstree.com\/blog\/2013\/10\/17\/puppet-module-to-setup-nodejs-deployment-2\/","title":{"rendered":"Puppet module to setup nodejs deployment 2"},"content":{"rendered":"<div dir=\"ltr\" style=\"text-align: left;\">\n<p>As I said in the previous blog Puppet module to setup nodejs deployment, the nodejs module was for providing the basic infrastructure for automated node app&#8217;s deployment &amp; as promised I&#8217;ve released the next module &#8220;nodeapp&#8221; that can be used to setup a node app on the target server.<\/p>\n<p>First of all I&#8217;ll talk about what this module will do to facilitate the automated deployment of a nodejs app, as already discussed we are following a convention that all the node app&#8217;s code will be present at <i><b>\/home\/nodejs\/<\/b><\/i> which is referred by <i><b>startNodeApp.sh<\/b><\/i> script so we create the directory of nodejs app. The <i><b>deployNodeApp.sh<\/b><\/i> script was using the upstart to manage the nodejs app instance i.e starting\/stoppping the nodejs app, the nodeapp module takes care of creating the require <b>upstart<\/b> configuration at \/<i><b>etc\/init\/.conf<\/b><\/i>. Also we use monit to monitor the nodejs app&#8217;s so that we can start\/stop the nodejs app&#8217;s using the web ui of <i><b>monit<\/b><\/i> &amp; also see various stats such as cpu, memory, load.. consumption of nodejs app.<\/p>\n<p>This nodeapp module is a <b>userdefined<\/b> type which takes the name of nodeapp as an argument, as a result of which you can setup any number of nodejs app&#8217;s on a system.<br \/>\ni.e nodeapp{&#8216;search-demo&#8217;: app_name =&gt; &#8220;search-demo&#8221;}<br \/>\nThis entry will create below files<\/p>\n<p><i><b>\/etc\/init\/search-demo.con<\/b><\/i>f : An upstart configuration file, using which search demo nodejs app can be managed as a service.<\/p>\n<div style=\"text-align: left;\"><i><i>#!upstart<br \/>\ndescription &#8220;node.js search-demo server&#8221;<br \/>\nauthor\u00a0\u00a0\u00a0\u00a0\u00a0 &#8220;sandy&#8221;<\/i><\/i>start on startup<br \/>\nstop on shutdownscript<br \/>\nexport HOME=&#8221;\/home\/nodejs&#8221;<\/p>\n<p>echo $$ &gt; \/var\/run\/search-demo.pid<br \/>\nexec sudo -u nodejs \/home\/nodejs\/startNodeApp.sh search-demo<br \/>\nend script<\/p>\n<p>pre-start script<br \/>\n# Date format same as (new Date()).toISOString() for consistency<br \/>\necho &#8220;[`date -u +%Y-%m-%dT%T.%3NZ`] (sys) Starting&#8221; &gt;&gt; \/var\/log\/search-demo.sys.log<br \/>\nend script<\/p>\n<p>&nbsp;<\/p>\n<p><i><\/i><i><\/i><i>pre-stop script<br \/>\nrm \/var\/run\/search-demo.pid<br \/>\necho &#8220;[`date -u +%Y-%m-%dT%T.%3NZ`] (sys) Stopping&#8221; &gt;&gt; \/var\/log\/search-demo.sys.log<br \/>\nend script<\/i><i><b>\/etc\/monit\/conf.d\/search-demo.monit<\/b><\/i> : A monit configuration file, using which search-demo nodejs app can be monitored &amp; even automatedly restarted<\/p>\n<p>check process search-demo with pidfile \/var\/run\/search-demo.pid<br \/>\nstop program = &#8220;\/sbin\/stop search-demo&#8221;<br \/>\nstart program = &#8220;\/sbin\/start search-demo&#8221;<\/p>\n<p>So using these 2 modules nodejs &amp; nodeapp you can make any system up &amp; running for nodejs app&#8217;s automated deployment<\/p>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>As I said in the previous blog Puppet module to setup nodejs deployment, the nodejs module was for providing the basic infrastructure for automated node app&#8217;s deployment &amp; as promised I&#8217;ve released the next module &#8220;nodeapp&#8221; that can be used to setup a node app on the target server. First of all I&#8217;ll talk about &hellip; <a href=\"https:\/\/opstree.com\/blog\/2013\/10\/17\/puppet-module-to-setup-nodejs-deployment-2\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Puppet module to setup nodejs deployment 2&#8221;<\/span><\/a><\/p>\n","protected":false},"author":171775670,"featured_media":29900,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_coblocks_attr":"","_coblocks_dimensions":"","_coblocks_responsive_height":"","_coblocks_accordion_ie_support":"","jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false},"version":2}},"categories":[28070474,3548],"tags":[44070,30871489,31896918,768739288],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/opstree.com\/blog\/wp-content\/uploads\/2025\/11\/DevSecOps-1.jpg","jetpack_likes_enabled":true,"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/pfDBOm-73","jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/opstree.com\/blog\/wp-json\/wp\/v2\/posts\/437"}],"collection":[{"href":"https:\/\/opstree.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/opstree.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/opstree.com\/blog\/wp-json\/wp\/v2\/users\/171775670"}],"replies":[{"embeddable":true,"href":"https:\/\/opstree.com\/blog\/wp-json\/wp\/v2\/comments?post=437"}],"version-history":[{"count":5,"href":"https:\/\/opstree.com\/blog\/wp-json\/wp\/v2\/posts\/437\/revisions"}],"predecessor-version":[{"id":30073,"href":"https:\/\/opstree.com\/blog\/wp-json\/wp\/v2\/posts\/437\/revisions\/30073"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/opstree.com\/blog\/wp-json\/wp\/v2\/media\/29900"}],"wp:attachment":[{"href":"https:\/\/opstree.com\/blog\/wp-json\/wp\/v2\/media?parent=437"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/opstree.com\/blog\/wp-json\/wp\/v2\/categories?post=437"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/opstree.com\/blog\/wp-json\/wp\/v2\/tags?post=437"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}