title: How to deploy Node.js in cloud for high availability using multi-core, reverse-proxy, and SSL
body: <p>I have posted this to ServerFault, but the Node.js community seems tiny there, so I'm hoping this bring more exposure.</p>
  
  <p>I have a Node.js (0.4.9) application and am researching how to best deploy and maintain it. I want to run it in the cloud (EC2 or RackSpace) with high availability. The app should run on HTTPS. I'll worry about East/West/EU full-failover later.</p>
  
  <p>I have done a lot of reading about keep-alive (Upstart, Forever), multi-core utilities (Fugue, multi-node, Cluster), and proxy/load balancers (node-http-proxy, nginx, Varnish, and Pound). However, I am unsure how to combine the various utilities available to me.</p>
  
  <p>I have this setup in mind and need to iron out some questions and get feedback.</p>
  
  <ol>
  <li><strong>Cluster</strong> is the most actively developed and seemingly popular multi-core utility for Node.js, so use that to run 1 node "cluster" per app server on non-privileged port (say 3000). <strong>Q1:</strong> Should <strong>Forever</strong> be used to keep the cluster alive or is that just redundant?</li>
  <li>Use 1 <strong>nginx</strong> per app server running on port 80, simply reverse proxying to node on port 3000. <strong>Q2:</strong> Would <strong>node-http-proxy</strong> be more suitable for this task even though it doesn't gzip or server static files quickly?</li>
  <li>Have minimum 2x servers as described above, with an independent server acting as a load balancer across these boxes. Use <strong>Pound</strong> listening 443 to terminate HTTPS and pass HTTP to <strong>Varnish</strong> which would round robin load balance across the IPs of servers above. <strong>Q3:</strong> Should <strong>nginx</strong> be used to do both instead? <strong>Q4:</strong> Should AWS or RackSpace load balancer be considered instead (the latter doesn't terminate HTTPS)</li>
  </ol>
  
  <p><strong>General Questions:</strong></p>
  
  <ol>
  <li>Do you see a need for (2) above at all?</li>
  <li>Where is the best place to terminate HTTPS?</li>
  <li>If <strong>WebSockets</strong> are needed in the future, what nginx substitutions would you make?</li>
  </ol>
  
  <p>I'd really like to hear how people are setting up current production environments and which combination of tools they prefer. Much appreciated.</p>