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

Waiting for initialisation completed #602

Open
raphaelcoeffic opened this issue Dec 6, 2024 · 1 comment
Open

Waiting for initialisation completed #602

raphaelcoeffic opened this issue Dec 6, 2024 · 1 comment

Comments

@raphaelcoeffic
Copy link

raphaelcoeffic commented Dec 6, 2024

For some integration tests, I would need to be able to wait for container initialisation to be fully completed. The framework instrumenting the container needs this to be able to start a series of tests.

Unfortunately, I cannot rely on the service itself, as it may or may not be up, depending on configuration, so that I cannot for open ports or any other type of side-effects.

Ideally, the service I'd want to wait for is a oneshot, so that I cannot even use polling together with s6-svstat or readiness notification. Alternatively, being to check if s6-rc has completed init successfully would help.

Is there any other alternative to poll/wait for a oneshot to be up? In my case, that would be done from outside the container using something similar to docker exec.

@skarnet
Copy link
Contributor

skarnet commented Dec 6, 2024

The natural notification for "the initialization has completed" is just "s6-rc exits 0", but it's true that there's currently no hook in rc.init to notify external programs that it's the case. If there's demand, I can probably add one in the future.

For now, your best bet is probably to add a oneshot that depends on top. Do not add that oneshot to any bundle, that would create a dependency loop and make your initialization fail.

In that oneshot, run whatever notification mechanism you want - write to a file, to a pipe, whatever. Make sure it doesn't block if your external program that needs the notification isn't present.

Since the oneshot depends on top, which is the bundle that s6-rc brings up at container initialization time, it will only run once everything else is up, which is the synchronization you want.

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