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

Add healthcheck command #1982

Merged
merged 3 commits into from
Aug 21, 2017
Merged

Add healthcheck command #1982

merged 3 commits into from
Aug 21, 2017

Conversation

emilevauge
Copy link
Member

@emilevauge emilevauge commented Aug 21, 2017

Description

This PR adds a traefik healthcheck command that can be used by Docker with the new HEALTHCHECK instruction (see containous/traefik-library-image#12).

The web provider needs to be enabled.

/cc @EtienneDufresne @vdemeester

  • Remove ping from auth middleware

Fixes #1560

@ldez ldez added this to the 1.4 milestone Aug 21, 2017
@emilevauge emilevauge removed the WIP label Aug 21, 2017
@emilevauge emilevauge force-pushed the add-healthcheck-command branch 4 times, most recently from b5efa4d to 17346d5 Compare August 21, 2017 16:31
fmt.Printf("Error calling healthcheck: %s\n", err)
os.Exit(1)
}
if resp.Status != "200 OK" {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd check resp.StatusCode for http.StatusOK.

Copy link
Member Author

Choose a reason for hiding this comment

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

Absolutely

Copy link
Contributor

@vdemeester vdemeester left a comment

Choose a reason for hiding this comment

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

👼

@@ -26,6 +27,7 @@ import (
"github.com/coreos/go-systemd/daemon"
"github.com/docker/libkv/store"
"github.com/satori/go.uuid"
"net/http"
Copy link
Contributor

Choose a reason for hiding this comment

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

The import are a little messed-up 😓 😛

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed

Copy link
Contributor

@vdemeester vdemeester left a comment

Choose a reason for hiding this comment

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

LGTM 🐸

Copy link
Contributor

@ldez ldez left a comment

Choose a reason for hiding this comment

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

minor changes

DefaultPointersConfig: traefikPointersConfiguration,
Run: func() error {
if traefikConfiguration.Web == nil {
fmt.Printf("Please enable the web provider to use healtcheck.\n")
Copy link
Contributor

Choose a reason for hiding this comment

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

fmt.Println(...)

Copy link
Member Author

Choose a reason for hiding this comment

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

I was thinking of homogeneity, but meh, I can change this if you want.

fmt.Printf("Bad healthcheck status: %s\n", resp.Status)
os.Exit(1)
}
fmt.Printf("OK: %s\n", resp.Request.URL.String())
Copy link
Contributor

Choose a reason for hiding this comment

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

fmt.Println("OK:", resp.Request.URL) or fmt.Printf("OK: %s\n", resp.Request.URL)

Copy link
Member Author

Choose a reason for hiding this comment

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

Not sure to understand, fmt.Printf("OK: %s\n", resp.Request.URL.String()) -> fmt.Printf("OK: %s\n", resp.Request.URL) ? Why ?

Copy link
Contributor

Choose a reason for hiding this comment

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

because %s call .String()

Copy link
Member Author

Choose a reason for hiding this comment

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

OK then ;)

docs/basics.md Outdated
@@ -514,6 +514,7 @@ List of Træfik available commands with description :             
- `version` : Print version 
- `storeconfig` : Store the static traefik configuration into a Key-value stores. Please refer to the [Store Træfik configuration](/user-guide/kv-config/#store-trfk-configuration) section to get documentation on it.
- `bug`: The easiest way to submit a pre-filled issue.
- `healthcheck`: Calls traefik `/ping` to check health
Copy link
Contributor

Choose a reason for hiding this comment

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

Add a dot at the end of the sentence.

Copy link
Contributor

@nmengin nmengin left a comment

Choose a reason for hiding this comment

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

LGTM 👨‍⚕️ 💉

Copy link
Contributor

@ldez ldez left a comment

Choose a reason for hiding this comment

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

LGTM

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

Successfully merging this pull request may close these issues.

7 participants