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

Populate docker compose healthcheck status #6414

Closed

Conversation

remi00
Copy link

@remi00 remi00 commented Jul 22, 2024

With this change docker compose healthcheck status details are populated into runtime status, making the tilt UI reflect detailed information.

Closes #6413

@remi00 remi00 force-pushed the dc-healthcheck-into-runtime-status branch from 9d5f7bc to 99ff5bc Compare July 22, 2024 11:23
Copy link
Member

@nicks nicks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks! let me test this a bit manually

return state.Status
}
if state.Health.Status == types.Starting {
return ContainerStatusRestarting
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i wonder if this should be created?

Copy link
Author

@remi00 remi00 Jul 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This, combined with a change in RuntimeStatus() method, improves the user experience on container rebuild in case of docker containers with healthcheck. It reflects that there is an additional "pending" state of healthcheck status.

Without it, in case when the healthcheck started failing after the rebuild, the runtime status would be first green and only after the healthcheck is considered as failing by docker, the runtime status would become red. This can take quite some time, because healthcheck status will become reported unhealthy at minimum after interval times retries from healthcheck definition on docker-compose.yml, adding up potential confusion to the user.

With this change the runtime status will be "pending" as long as the the healthcheck is "healthcheck: starting".

By the runtime status I mean the red element on Tilt UI:
image

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do ContainerStatusRestarting and ContainerStatusCreated have different displays in the UI?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ContainerStatusCreated ->> green runtime status
image

ContainerStatusRestarting ->> below animated. At the end of animation is a transition to unhealthy state.

Screen.Recording.2024-07-24.at.11.08.29.mov

Again, without the change in question when the healthcheck procedure is ongoing the runtime status would mistakenly indicate green status.

@nicks nicks self-requested a review July 23, 2024 12:29
if state.Health == nil || state.Health.Status != types.Unhealthy {
return ""
}
result := "container is unhealthy"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this log displayed anywhere today? i didn't see it anywhere in the UI, only in the tilt cli output

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't find it on the UI either.

@nicks
Copy link
Member

nicks commented Jul 26, 2024

OK, I played with this in a few projects, and now I remember why we did it this way.

The Compose Spec says this:

Compose guarantees dependency services have been started before starting a dependent service. Compose waits for dependency services to be "ready" before starting a dependent service.

i.e., the default definition of readiness is "the service has started", NOT "the service is healthy"

if we define readiness the way this PR does it, it will break startup order.

the problem here is that Tilt and Compose model dependencies differently -- in Tilt, if 2 resources depend on 'common', then both resources can start once 'common' is ready. In Compose, 2 resources can have dependencies on different parts of the 'common' lifecycle

i have some ideas on how to address your use-case a bit differently but need to play around with it a bit.

@remi00
Copy link
Author

remi00 commented Jul 27, 2024

@nicks Thanks for explaining. Let me know if I can help more. In the projects I am using tilt, this change drastically improves UX, but I understand that the readiness aspect is more important here than just displaying it on the UI.

@remi00
Copy link
Author

remi00 commented Jul 29, 2024

Just to add to my previous comment. The healthcheck reporting is an important capability for devs by itself. Considering that docker does support concept of a healthchecks, there should be a way to present the healthcheck status on the tilt UI if it supports docker-compose in the first place. Missing that is a huge gap. In my case current behavior was a huge confusion (tilt supports probing, supports docker-compose and it misses supporting combination of both). Even if there was no news on tilt-dev website that Tilt has joined Docker.

@nicks
Copy link
Member

nicks commented Aug 1, 2024

addressed this in another pr #6419

@nicks nicks closed this Aug 1, 2024
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

Successfully merging this pull request may close these issues.

Use docker compose healthcheck status as runtime status on the UI
2 participants