Closed tomwhoiscontrary closed 7 years ago
I'd consider this but there are lots of edge cases. What happens if the app crashes on start? Do we retry only a certain number of times? In a certain time period? If the crashing is non-recoverable but temporary (lose network connection) does we eventually stop thrashing? Do we need some sort of exponential backoff?
My original intention with not including this behavior was both because it can get quite complicated and to discourage foreman's use in production as a process supervisor.
I feel less strongly about the production with forego (ruby always felt way too heavy for that sort of job) but I'm curious how we resolve the edge cases.
Hang on, does forego -r
already do this?
I only discovered that by reading the code, so i'm not sure what it does. If it does what i want, can i change this issue to be a request/offer for improved documentation?
With regards to edge cases, those are all good questions, but i don't think a lack of answers to them is a good reason not to implement a basic version of this. Indeed, having terrible handling of edge cases is probably a good thing if you want to discourage production use.
My use case is that i have a microservicey application written in Java with Spring, comprising 19 separate processes so far. If i want to change one process and restart it, at the moment, i have to restart every microservice; this being Spring, it takes several minutes to start everything up, even on a beefy iMac. The ability to restart a single process would make development much more comfortable.
Automatic restarts is one way of getting this, because i can kill the process i want to restart. A way to request restart of a particular process would also do it, but that sounds a lot more complicated.
Okay, so -r does do what i want, but it was broken until 9372bb8. There isn't a release with 9372bb8 in; the latest is v0.16.1, which was db3ef40, a couple of months before.
What do you say i PR in an expanded long description for the start command, then you cut a new release?
Sounds good
When one of the processes started by forego exits, forego exits, and kills all the other processes it started. I believe classic original foreman has the same behaviour.
Sometimes this is useful behaviour, but sometimes it would be more useful if it restarted the process which exited and carried on. Would it be possible for forego to take a flag to make it calmly restart rather fly off the handle and kill everything?
I can try to put together a PR for this if you are amenable to this idea.
The workaround for now is to wrap every process in a script which basically does
while true; do "$@"; done
.