Closed bcoe closed 10 years ago
Could you explain what are you thinking about?
@piranna @rvagg @ceejbot, @marcellodesales, I'd like to add a foreground option to ndm, I'm picturing it would work like this:
If I understand the challenges we're facing, correct me if I'm wrong, I think this would make it easier to run npm Enterprise in a Docker container?
Upstart is a system service not present inside Docker containers. You could use init.d to daemonize a service, but that's more or less writing shell script boilerplate. What I'd like ideally is an npm run script target for each service in the npme package.json. Something like npm run registry-frontdoor
could fire off frontdoor with the correct options, in the foreground. Write a tiny bash wrapper to background it.
Couchdb needs the same treatment. Either I'll have to run that in a completely separate container (might be sensible) or find another way to launch it.
Ok, I see. This reminds me somewhat as a Docker init process (that probably is a bad thing), and have some similitudes to the patch I did to forever to read config from a file. It's not a bad idea, though, but the biggest problem I see is about how several services will be exec with the foreground
flag. Only allow one of them and exec it the last one, for example to show a shell or a system monitor?
@bcoe, If the purpose is to run in single container for npm enterprise, I would be looking at https://docs.docker.com/articles/using_supervisord/. As usual, Docker containers are used to decouple system dependencies as much as possible, so that it makes it easier to change/update/replace/remove containers independently. Multiple logs can be collected using techniques like http://jpetazzo.github.io/2014/08/24/syslog-docker/.
So, I would suggest using @ceejbot's former approach to use Couchdb separate... In addition, all the other services in different containers and all of them linked together. Docker will be logging persisting the output of the stdout automatically and you can view them using "docker logs"...
I think the most common use-case for npme in Docker would be just to try it out in a way that makes clean-up easy, if you complicate the Docker set-up by requiring multiple containers then you may take away this benefit ... perhaps ... Of course you could always distribute pre-made images via Docker Hub and have a simple script that bootstraps the required containers, that would be neat.
@rvagg @ceejbot I ended up adding Init.d support to ndm, which works better with Docker. There's now an npm Enterprise Docker container:
It would be great for docker if scripts could be executed in the foreground.