overmind icon indicating copy to clipboard operation
overmind copied to clipboard

"sleep pause" commands is anti pattern in procfile ?

Open gedw99 opened this issue 2 years ago • 4 comments

this is working very well on mac . really useful tool.

I was wondering about startup dependency ordering, and am looking for advice.

I read in the issues about users wanting a sleep function to force the procfile processing to wait for something to start. But it seems like an anti pattern. Better to design your calling binaries to try to connect to something else and then back off and try again ?

gedw99 avatar Jan 23 '23 17:01 gedw99

Procfile is a very simple format that doesn't support health checks. Applications that use it can't determine the readiness of processes and thus can't make processes wait for their dependencies' readiness.

In this situation, sleep is the easiest solution, yet it's not ideal.

Changing your application so it retries connection to its dependency is a good solution, yet it's not always possible to change your application like this.

So I think the best solution is to use some kind of tool or wrapper that waits for dependency readiness before starting a process. For example, the wait-for-it script can wait until it can connect to the requested port.

DarthSim avatar Jan 24 '23 13:01 DarthSim