-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
Add healthcheck command #1982
Conversation
b5efa4d
to
17346d5
Compare
cmd/traefik/traefik.go
Outdated
fmt.Printf("Error calling healthcheck: %s\n", err) | ||
os.Exit(1) | ||
} | ||
if resp.Status != "200 OK" { |
There was a problem hiding this comment.
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
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Absolutely
17346d5
to
b346951
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👼
cmd/traefik/traefik.go
Outdated
@@ -26,6 +27,7 @@ import ( | |||
"github.com/coreos/go-systemd/daemon" | |||
"github.com/docker/libkv/store" | |||
"github.com/satori/go.uuid" | |||
"net/http" |
There was a problem hiding this comment.
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 😓 😛
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
852ff18
to
f99b765
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🐸
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor changes
cmd/traefik/traefik.go
Outdated
DefaultPointersConfig: traefikPointersConfiguration, | ||
Run: func() error { | ||
if traefikConfiguration.Web == nil { | ||
fmt.Printf("Please enable the web provider to use healtcheck.\n") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fmt.Println(...)
There was a problem hiding this comment.
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.
cmd/traefik/traefik.go
Outdated
fmt.Printf("Bad healthcheck status: %s\n", resp.Status) | ||
os.Exit(1) | ||
} | ||
fmt.Printf("OK: %s\n", resp.Request.URL.String()) |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because %s
call .String()
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👨⚕️ 💉
5c3e416
to
57dc669
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Signed-off-by: Emile Vauge <[email protected]>
Signed-off-by: Emile Vauge <[email protected]>
Signed-off-by: Emile Vauge <[email protected]>
57dc669
to
aaa2743
Compare
Description
This PR adds a
traefik healthcheck
command that can be used by Docker with the newHEALTHCHECK
instruction (see containous/traefik-library-image#12).The
web
provider needs to be enabled./cc @EtienneDufresne @vdemeester
Fixes #1560