-
Notifications
You must be signed in to change notification settings - Fork 36
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
[WIP] refactor and add http and script checks #9
Changes from 3 commits
c5927cf
b452fc1
7359201
1a8dc74
dc2a791
296b46f
f8e392f
b8ce7a9
667aa16
f6c2b8c
687b550
de4dae1
c115758
7b1127e
c27b432
607a644
e98dd19
0321e74
500434f
2a8369d
4eb333e
fd09b6c
c62118c
faa39bd
61a145b
03544b5
308c457
00fc8e5
cf2321b
59c1e2a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# health-checker | ||
|
||
A simple HTTP server that will return `200 OK` if the given TCP ports are all successfully accepting connections. | ||
A simple HTTP server that will return `200 OK` if the configured checks are all successful. | ||
|
||
## Motivation | ||
|
||
|
@@ -12,14 +12,14 @@ the TCP Listeners of both services are successfully accepting connections. But t | |
a single TCP port, or an HTTP(S) endpoint. As a result, our use case just isn't supported natively by AWS. | ||
|
||
We wrote health-checker so that we could run a daemon on the server that reports the true health of the server by | ||
attempting to open a TCP connection to more than one port when it receives an inbound HTTP request on the given listener. | ||
checking more conditions than a just single port or HTTP request while still allowing for a single HTTP request on the given listener. | ||
|
||
## How It Works | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perhaps rename this section to configuring health-checker? |
||
|
||
When health-checker is started, it will listen for inbound HTTP requests for any URL on the IP address and port specified | ||
by `--listener`. When it receives a request, it will attempt to open TCP connections to each of the ports specified by | ||
an instance of `--port`. If all TCP connections succeed, it will return `HTTP 200 OK`. If any TCP connection fails, it | ||
will return `HTTP 504 Gateway Not Found`. | ||
When health-checker is started, it will parse a YAML file specified with the `--config` flag (example config | ||
in [examples/config.yml.simple]()) and listen for inbound HTTP requests for any URL on the IP address and port specified | ||
by `listener` directive. When it receives a request, it will attempt to run all checks specified in the config | ||
and return `HTTP 200 OK` if all checks pass. If any of the checks fail, it will return `HTTP 504 GATEWAY TIMEOUT`. | ||
|
||
Configure your AWS Health Check to only pass the Health Check on `HTTP 200 OK`. Now when an HTTP Health Check request | ||
comes in, all desired TCP ports will be checked. | ||
|
@@ -42,19 +42,23 @@ health-checker [options] | |
|
||
| Option | Description | Default | ||
| ------ | ----------- | ------- | ||
| `--port` | The port number on which a TCP connection will be attempted. Specify one or more times. | | | ||
| `--listener` | The IP address and port on which inbound HTTP connections will be accepted. | `0.0.0.0:5000` | ||
| `--config` | A YAML config file containing options and checks | | | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perhaps |
||
| `--log-level` | Set the log level to LEVEL. Must be one of: `panic`, `fatal`, `error,` `warning`, `info`, or `debug` | `info` | ||
| `--help` | Show the help screen | | | ||
| `--version` | Show the program's version | | | ||
|
||
#### Example | ||
#### Config File Options | ||
|
||
Run a listener on port 6000 that accepts all inbound HTTP connections for any URL. When the request is received, | ||
attempt to open TCP connections to port 5432 and 3306. If both succeed, return `HTTP 200 OK`. If any fails, return `HTTP | ||
504 Gateway Not Found`. | ||
TODO: add more info on the config options | ||
|
||
#### Examples | ||
|
||
Parse configuration from `health-checker.yml` and run a listener that accepts all inbound HTTP connections for any URL. When | ||
the request is received, attempt to run all checks specified in `health-checker.yml`. If all checks succeed, return `HTTP 200 OK`. | ||
If any fail, return `HTTP 504 GATEWAY TIMEOUT`. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Doesn't look like this paragraph adds much. I'd just say "see the examples folder for all examples." |
||
|
||
``` | ||
health-checker --listener "0.0.0.0:6000" --port 5432 --port 3306 | ||
health-checker --config health-checker.yml | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd put this right below the table of options. |
||
``` | ||
|
||
See [examples/]() for configuration examples. |
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 add a quick start right here so users get a very clear idea of what this is and, most importantly, why they'd want to use it.