Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"sleep pause" commands is anti pattern in procfile ? #145

Open
gedw99 opened this issue Jan 23, 2023 · 4 comments
Open

"sleep pause" commands is anti pattern in procfile ? #145

gedw99 opened this issue Jan 23, 2023 · 4 comments

Comments

@gedw99
Copy link

gedw99 commented Jan 23, 2023

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 gedw99 changed the title sleep pause "sleep pause" commands is anti pattern in procfile ? Jan 23, 2023
@DarthSim
Copy link
Owner

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.

@gedw99
Copy link
Author

gedw99 commented Apr 4, 2023

A golang equivalent o wait for it would be good.

Can then wrap any program with it.
Sort of like a proxy ..

I used aqua proxy for this once and it might work well with overmind.
it’s gets a binary if it’s not there and then let’s the caller call it. Basically serverless pattern.

The same sort of thing for a socket is needed. Caller asks and proxy waits for the socket to be there and then lets the call through .

@gedw99
Copy link
Author

gedw99 commented Apr 4, 2023

Golang equivalent

https://github.com/roerohan/wait-for-it

@gedw99
Copy link
Author

gedw99 commented Apr 4, 2023

Also

https://github.com/atkrad/wait4x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants