puma-dev
puma-dev copied to clipboard
Add a generic command to the proxy support
I was having a look at the proxy feature of puma-dev and I thought that it would be very useful to have the possibility to write a generic command to be executed together with the port number, so that it would be very easy to work with different setups, like dockerized apps.
Imagine that we have a file where we can specify a port number and a command, like 8082:docker-compose up web -e PORT=8082
: puma-dev will know that it will have to launch this command to start the application, then it will proxy the port number as it would do with the existent proxy feature.
Is it hard to do this? What would be the first steps if you would have to build this feature? I was thinking about creating a fork and poke around :)
I'd start by looking at LaunchApp
; it's responsible for booting the subprocess to run puma and returning the App
to be added to the pool. We currently rely on unix sockets to talk to the underlying process, so I think there'd be some plumbing work to ensure that puma-dev's http server can correctly detect a healthy service and know when (in addition to how) to start and stop it.