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

Check hippo health #594

Merged
merged 1 commit into from
Jun 27, 2022
Merged

Conversation

FrankYang0529
Copy link
Contributor

resolves #562

> ~/Project/spin/target/debug/spin deploy -f spin.toml --deploy-existing-bindle
Error: Hippo server http://localhost:5309/ is unhealthy
# follow nomad tutorial to start nomad
> ~/Project/spin/target/debug/spin deploy -f spin.toml --deploy-existing-bindle
Deployed spin-hello-world version 1.0.0+qb632d35
Available Routes:
  hello: http://spin-deploy.spin-hello-world.hippofactory.io/hello
    A simple component that returns hello.

.await?
.text()
.await?;
if result == "Unhealthy" {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this should perhaps be:

Suggested change
if result == "Unhealthy" {
if result != "Healthy" {

Unless I'm forgetting how reqwest works, I think this would return Ok on a - for example - 502 Bad Gateway, as long as the body wasn't Unhealthy.

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree with @lann and would also recommend using error_for_status, e.g.:

        let result = reqwest::get(hippo_healthz_url.to_string())
            .await?
            .error_for_status()?
            .text()
            .await?;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @dicej and @lann, thanks for the suggestion. If we use error_for_status, it looks like we don't need to check result text.

> curl -k http://localhost:5309/healthz
Unhealthy%

> ~/Project/spin/target/debug/spin deploy -f spin.toml --deploy-existing-bindle
Error: HTTP status server error (503 Service Unavailable) for url (http://localhost:5309/healthz)

# start nomad

> ~/Project/spin/target/debug/spin deploy -f spin.toml --deploy-existing-bindle
Deployed spin-hello-world version 1.0.0+qb632d35
Available Routes:
  hello: http://spin-deploy.spin-hello-world.hippofactory.io/hello
    A simple component that returns hello.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I believe Hippo still returns 200 with an Unhealthy status: deislabs/hippo#889

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for pointing it out. I add the check for result != "Healthy" back.

@FrankYang0529 FrankYang0529 force-pushed the check-hippo-health branch 2 times, most recently from 955d4a9 to d7d3978 Compare June 23, 2022 15:33
Signed-off-by: Frank Yang <yangpoan@gmail.com>
Copy link
Collaborator

@lann lann left a comment

Choose a reason for hiding this comment

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

Looks good to me. I'd like @michelleN to sanity-check the behavior.

@bacongobbler
Copy link
Member

FYI in the latest version of hippo, /healthz will now return a 503 if something is unhealthy.

@michelleN
Copy link
Member

Going to merge and then we can update.

@michelleN michelleN merged commit 2b08823 into fermyon:main Jun 27, 2022
@FrankYang0529 FrankYang0529 deleted the check-hippo-health branch June 27, 2022 16:43
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.

add flag on spin deploy to check if underlying platform is healthy
5 participants