npm / ndm

ndm allows you to deploy OS-specific service-wrappers directly from npm-packages.
ISC License
182 stars 22 forks source link

Use ndm to manage the containing module #105

Open simonexmachina opened 9 years ago

simonexmachina commented 9 years ago

It would be great to be able to use ndm on the containing module. I want to be able to use ndm to create service wrappers for the module itself, rather than modules in node_modules. Obviously I can use a wrapper module but this isn't a good solution for my use case.

bcoe commented 9 years ago

Good news @aexmachina, ndm should already do the trick for you. Either:

  1. Create a service.json that references the same package name as the containing module. For the module foo:
{
  "foo": {
     "args" {

      },
     "env": {

     }
  }
}

Here's an example of this in the wild:

https://github.com/npm/download-counts/blob/master/service.json

If you have no need to pass in env and args variables, the default behavior of ndm is to use package.json.

Let me know if this solves your problem.

simonexmachina commented 9 years ago

That's great, thanks. That has generated the correct plist file.

However now I have another problem: when I run ghostrunner install as simonwade (which calls ndm.install()) it creates the logs/ directory with an owner of root, and the service won't start until I sudo chown logs simonwade. Any ideas.

simonexmachina commented 9 years ago

Not sure if it's relevant but the ghostrunner script is owned by simonwade, not root:

$ ls -al `which ghostrunner`
lrwxr-xr-x  1 simonwade  admin  42  4 Jan 22:52 /usr/local/bin/ghostrunner -> ../lib/node_modules/ghostrunner/lib/cli.js
bcoe commented 9 years ago

@aexmachina what's the path to the logs directory in question? I'm surprised that it would have created it as root unless you'd installed using sudo.

I think it defaults to logging to HOME/Library/Logs/?

If you don't mind, could you open a new ticket that describes this behavior in detail and I'll dig into it.

simonexmachina commented 9 years ago

At what point would you expect the log directory to be created? I can't reproduce the issue now.