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

Define a Docker health check #2046

Open
GergelyKalmar opened this issue Nov 29, 2023 · 5 comments
Open

Define a Docker health check #2046

GergelyKalmar opened this issue Nov 29, 2023 · 5 comments
Assignees
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@GergelyKalmar
Copy link

Feature Description

I'd like to use Docker Compose's health checks to bring up the proxy before starting dependent services, but I can't seem to be able to ping the readiness endpoints from within the container image.

It would be awesome if there was a health check defined in the cloud-sql-proxy image itself (see https://docs.docker.com/engine/reference/builder/#healthcheck).

Sample code

No response

Alternatives Considered

I tried pinging the existing readiness endpoint:

services:
  ...
  cloud_sql_proxy:
    ...
    healthcheck:
      test: ['CMD', 'curl', '-f', 'http://localhost:9999/readiness']
      interval: 3s
      timeout: 3s
      retries: 5

However, it seems that curl is not available in the Docker image, and neither is any other utility that would allow one to hit the readiness endpoint.

Additional Details

No response

@GergelyKalmar GergelyKalmar added the type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. label Nov 29, 2023
@jackwotherspoon
Copy link
Collaborator

Hi @GergelyKalmar thanks for raising an issue on the Cloud SQL Proxy 😄

I'll take a look into this and see about adding a built-in health check to the docker image.

@jackwotherspoon jackwotherspoon added the priority: p2 Moderately-important priority. Fix may not be included in next release. label Nov 29, 2023
@enocom
Copy link
Member

enocom commented Nov 29, 2023

I bet the new wait command would be a perfect fit for this: #2041. @GergelyKalmar Do you think the new wait command would help?

In terms of Kubernetes, I see the Docker healthcheck has been disabled for years now: kubernetes/kubernetes#50703. So I think that means we could safely add a health check to our images without affecting kubernetes.

@GergelyKalmar
Copy link
Author

Hm, I'm not yet sure if the wait command helps. In this case we would want to wait until the image itself is ready to serve traffic (as opposed to waiting for proxysql running in a separate process).

@enocom
Copy link
Member

enocom commented Dec 6, 2023

Got it. I think it would be nice if we could avoid a dependency on curl or similar, such that people could use this with the distroless container. Maybe cloud-sql-proxy ready that exits 0 or otherwise?

@GergelyKalmar
Copy link
Author

Sure, that should work fine!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

No branches or pull requests

3 participants