

Naught.js: zero downtime deployment for node.js - AndyKelley
https://github.com/indabamusic/naught

======
mattyb
I've never been interested in hot code-swapping; I find it's sufficient to
just take that resource out of the pool, give it the new goodies and then boot
it up again. I know the Erlang runtime can do this, but I've yet to find a
good use case.

As far as std{err,out} redirection, does Node.js have no Unicorn equivalent?

Daemonization (and respawning) should be handled by a process supervisor, like
supervisord/Upstart/Monit or whatever. They can do more than just 'this
process died, restart it.'

Also, most of this logging code didn't need to be written:

<https://github.com/indabamusic/naught/blob/master/src/log.co>

Just use logrotate.

~~~
AndyKelley
I apologize - "hot code swapping" may be a misnomer. Naught does the process
that you describe about taking the resource out of the pool, giving it the new
goodies, and booting it up again.

The native cluster API _is_ the Unicorn equivalent in the node.js world.
Naught is essentially unicorn for node. And naught _is_ the equivalent of a
process supervisor.

Fair point about logrotate. Here's a counter one: The server that you describe
requires 4 moving parts: 1. the app code, 2. the unicorn equivalent, 3. a
process supervisor, 4. logrotate in a cron job. An app deployed with naught
requires 2: 1. the app code, 2. naught.

~~~
mattyb
By 'taking the resource out of the pool', I had HAProxy in mind, not the
service itself.

 _And naught is the equivalent of a process supervisor._

No, it's not. Can Naught do this?

[http://mmonit.com/monit/documentation/monit.html#service_tes...](http://mmonit.com/monit/documentation/monit.html#service_tests)

That's legit process supervision. Your process may still be running, but be
wedged somehow. Monit can perform remediation based on signals other than
process status. Naught can't (and shouldn't) do this.

 _The server that you describe requires 4 moving parts:_

True, but our servers are running all of this anyway; you should use the best
tool for the job. Instead of rewriting a fraction of logrotate, you should
read `man 8 logrotate` and move on to writing code that will help your
business. When you deploy an app written using another runtime, are you going
to rewrite 10% of logrotate in that language too?

~~~
AndyKelley
Fair points, all. Thanks for the information.

