I've written a Node.js app, I'm looking to get it running on one of our production machines. This seems like a pretty common request yet I can't find an adequate solution. Is there not established solutions for deploying production Node.js apps?
The app is simple (<100 LOC), but needs to be very efficient, reliable and could run continuously for years without restarting. It's going to be run on a large site, with dozens of connections/second. (the app is not used as a webserver, it only has a JSON API)
Here are the approaches I've considered but I'm still not sure about:
Using a framework (eg. Express)
Because the app needs to be high performance and is so simple, adding bloat in the form of a framework is something I want to avoid.
Starting the server with nohup
The main problem here is with exception handling, we (obviously) don't want the entire server to crash because of an exception. From what I understand, wrapping the entire app in a try {} catch {}
loop won't help because the Javascript interpreter is left in an unpredictable state after an exception. Is that correct?
Using something like Forever
I've installed Forever in a FreeBSD machine of ours and it was very buggy. It ended up spawning endless processes that couldn't be killed from Forever. I had to run kill -9
to get my machine back and I don't feel too confident about running a production app on Forever. It also seems that Upstart (similar tool, but more generic) won't run on FreeBSD.
Hosted solutions (eg. Heroku, Rackspace, Amazon EC2, etc.)
This is probably the simplest solution, but we already have a the serious hardware for the rest of our webservers. For financial considerations, it doesn't make sense.
Surely there must be some established solution to this? Am I missing something?