nicolas-van / multirun

A minimalist init process designed for Docker
https://nicolas-van.github.io/multirun/
MIT License
182 stars 9 forks source link

Forward stdin #19

Closed tpetry closed 6 months ago

tpetry commented 2 years ago

Thanks Nicolas for building multirun, it made building docker containers so much more simple compared to supervisord. While extending the docker images I build to some more I found an interesting use case that I believe still fits multirun:

Take for example you are launching e.g. two processes with multirun.

  1. The first one is a CLI application that is packaged in docker because it needs very specific libraries.
  2. The second one (and some more) are just helper daemons that need to run on the container (e.g. some socket services)

That works perfectly as expected. Very good work! But if you extend the CLI application to now also ask questions on the stdin from the user this does not work anymore as the stdin is not forwarded.

My idea would be to always forward stdin to the first process in the multirun list of commands to run. For anyone using multirun until now nothing changes. But for the few also wanting to use stdin they can now have one process responsible to handle the stdin. That's also important for application servers that launch an http server and provide a stdin console to control the server.

nicolas-van commented 2 years ago

Frankly I wouldn't be for adding that kind of feature. It's not a use case multirun was designed for and it would seem cumbersome to use at best.

For such a thing I would more recommend to use some kind of well-designed bash script on top of your application. There are already plenty of examples of how to launch services in the background in a quick&dirty way in bash just to have them running during a user session.