Node.js upstart vs forever

user1802143 picture user1802143 · Dec 16, 2013 · Viewed 9.9k times · Source

I am looking to daemonize my Node.js application. What's the difference between upstart and forever? Also, are there other packages I might want to considering looking at?

Answer

verybadalloc picture verybadalloc · Dec 16, 2013

As pointed out in the comments, upstart will be used to start the forever script, since upstart has hooks for system events (like shutdown and startup of your server).

The other differences are:

  • Upstart was developed for Linux, while forever is platform-independent.
  • Forever is specific to nodejs, and has some pretty cool features with regards to restarting your server after it crashes, and logging.
  • Forever is sufficient for development environment, while upstart is necessary if you need to have some control over how your server is stopped. For example, on shutdown, the forever process would simply get killed, but, with an upstart script, you can collect logs and notify the admin.
  • Upstart allows you to add other monitoring tools, like Monit.

Among the available other solutions, you can try daemon, which is equivalent to forever.

I would disagree with @leorex with regards to upstart setup. Check out this blog post for an excellent example.