npm/ndm — pull request #85 by bcoe (2014-10-12 01:53:33+00:00)
Title: You can now set a `processes` variable, and indicate that multiple processes should be run

@zeke pointed out that there's a lot of repeated code in the service.json when you need to run multiple copies of the same service:

https://github.com/npm/newww/pull/164/files

I think this is a nice approach to reducing the footprint of service.json. I'm on the fence as to whether we should also fallback to variables in package.json:

* on one hand, there are repeated stanzas in service.json (scripts, description).
* on the other hand, it's nice that a service.json has all the necessary information required to execute a service in it:
* module name.
* script to run.
* environment variables.
* there's no rule that says a service.json needs to be in the same folder as the module it is executing, which could make things a bit confusing. Take npme, the service.json sits at the top level directory, and describes several modules that need to run: policy-follower, registry-frontdoor, etc, it would be hard to know here to look for each of the package.jsons to pull default values from.

With this change, starting up multiple processes for newww becomes a slick little service.json, which looks like this:

```json
{
"newww": {
"description": "Run multiple copies of the newww web-server."
"processes": 4,
"scripts": {
"start": "node server.js"
},
"env": {
"PORT": "808%i",
"NODE_ENV": "production"
}
}
}
```

Does this get things closer to what you're looking for @zeke?