简体   繁体   中英

Node.js deployment stack

What is the best node.js deployment stack? I'm going to use Nginx comunicating with node.js on fugue through unix domain socket + mongodb + NPM packages installed in user home. Is there something better?

By the way, shouldn't node have something like rack, which would handle server configuration and start listening on port or socket which would be forced by server software? Now I do crazy hi-jacking server.listen function to get server and launch it by fugue. Have You some experience on doing drop-in node deployment?

There are are a few projects under development aimed at solving this problem:

forever and cluster ( video intro for cluster ) are both pretty good solutions. I've noticed small discrepancies in both when I tried them -- meaning that they may not have the problems anymore.

There are 2 main things you need to consider when choosing a deployment:

  1. daemonizing the node app
  2. restarting the node app if it crashes

you may also want to consider logging, command line features, and security. You could also pretty much just write your own implementation script that uses nohup.

One last thing that I don't know how to deal with yet: security. Last I checked you can't really use SSL in a stable way unless you use something like nginx, and I don't know about security holes in node either.

Disclaimer: Not a node expert

I believe Connect is considered a Rack analogue.

Note that SSL support in Node is, according to its creator, largely broken and a work-in-progress, so if your app needs SSL support--and what professional app doesn't?--you'll need to run Node in cooperation with another component, typically nginx AFAIK.

I recommend watching the mailing list for developments in this area and information about common configurations.

for a more boilerplate install you can try the mean stack. i've had good experiences with express ( http://expressjs.com ) and mongo ( http://mongodb.com ). here is a page with a quick install guide for mean stack: http://mean.io

of course you can simply use forever or upstart as mentioned above: http://jacobmumm.com/2011/08/29/node-as-a-service-in-ubuntu-11-04-with-upstart-monit-and-forever-js/

Most Node.js deployments I've seen serves directly from the javascript code itself using http.createServer . In other words, most node.js scripts I've seen are web servers rather than just web apps. Several frameworks written for Node.js sort of assumes this.

That's part of the whole point of Node.js - serve your content using a non-blocking, single-threaded, event-driven server.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM