LearnBoost / cluster

Node.JS multi-core server manager with plugins support.
http://learnboost.github.com/cluster
MIT License
2.29k stars 159 forks source link

Come up with better boot solution #44

Closed tj closed 13 years ago

tj commented 13 years ago

master does not need to require everything that the user's server does, does not need to connect to databases etc, so this can cause master to hang when restarting etc. We have a few options... including supplying a path to cluster() to load the app but ONLY in the workers.

regardless we need docs for this

bkw commented 13 years ago

A possibility to pass configuration data for this delayed server creation would be nice.

tj commented 13 years ago

added filename support already, forgot to close this

bkw commented 13 years ago

yeah I know. But that leaves us with only two options: Preconfigure the server will all dependencies and waste a db connection, or pass a filename, that will initialize the server statically.

What if I want to have a shell script that parses command line options, loads a config file based on these options and then calls cluster, passing values from the config file to the server creation process. Right now we only could only use globals or some sort of singleton. Wouldn't a clousure to call on server creation be a better solution? Am I missing something?

Awesome library anyway, Thanks!

tj commented 13 years ago

that would be fine too, IMO cluster(server) is the most elegant, but only works well for simple cases