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

Services: Custom Health Checks #8037

Open
aluzzardi opened this issue Jul 25, 2024 · 1 comment
Open

Services: Custom Health Checks #8037

aluzzardi opened this issue Jul 25, 2024 · 1 comment

Comments

@aluzzardi
Copy link
Member

Currently, services have a built-in health checker (portHealthChecker) that verifies the container ports defined in withExposedPort are reachable.

Sometimes, this is not enough for services binding ports before they're actually healthy.

Dagger could provide a way to define "custom" healthchecks.

Possible solutions:

  • Define a custom command that gets invoked in the service container to check for health
  • Same as above, but use the HEALTHCHECK docker/oci directive
    • Dagger uses HEALTHCHECK to check for service readiness (would also work for any container images having that metadata)
    • Dagger provides a WithHealthcheck (also useful for non-services to export the HEALTHCHECK metadata)
  • Define a custom container that gets executed to check for health
    • Same concept as above, but the health check container can be an entirely different thing than the actual service container
    • The main advantage is running health checks on 3rd party containers that might lack the toolchain to actually test (e.g. curl, grep etc on a nginx container)

IMHO, the HEALTHCHECK approach feels better:

  • It's somewhat "standard"
  • A ton of OCI images already come with healthchecks that would work out of the box with dagger
  • WithHealthcheck is useful even outside of services to publish OCI images with that metadata

/cc @vito

@vito
Copy link
Contributor

vito commented Sep 19, 2024

Looks like HEALTHCHECK never became part of the OCI spec, but there is a separate Docker Image spec that we can use?

Context: opencontainers/image-spec#749 (comment)

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

No branches or pull requests

3 participants