title: How to achieve zero downtime redeployment in Node.js
body: <p>What is the easiest way to achieve zero downtime for my Node.js application?</p>
  
  <p>I have an app that requires the following steps for redeployment:</p>
  
  <ul>
  <li><code>npm install</code></li>
  <li><code>node_modules/.bin/bower install</code></li>
  <li><code>node_modules/.bin/gulp</code></li>
  </ul>
  
  <p>The result of these operations is the ready-to-run application in the generated by the <code>gulpfile.js</code> directory named <code>build</code>. In this directory I have a currently-running instance of the same application (currently launched via <a href="https://github.com/foreverjs/forever" rel="nofollow">forever</a> like this -- <code>forever start server.js</code>).</p>
  
  <p>As far as I know, it is not possible to achieve zero downtime via <code>forever</code> module, so I decided to choose another way to do it.</p>
  
  <p>I saw <a href="https://github.com/Unitech/pm2" rel="nofollow">pm2</a> but I found it very complex tbh (prove me wrong if you don't feel the same).</p>
  
  <p>I also saw <a href="https://github.com/andrewrk/naught" rel="nofollow">naught</a> but I can't even start my application via <code>naught start server.js</code> -- it doesn't even print anything in stdout / stderr.</p>
  
  <p>I also saw <a href="https://www.npmjs.com/package/up-time" rel="nofollow">up-time</a> but I didn't get the idea -- how will it handle situation when I run <code>gulp</code> that should replace files in the directory where currently-running instance work at the moment?</p>