-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
add: --ready
flag for postgrest healthcheck
#4269
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
base: main
Are you sure you want to change the base?
Conversation
746e41b
to
3850612
Compare
@steve-chavez Where do we document this new flag, I guess in https://docs.postgrest.org/en/v13/references/cli.html? |
@taimoorzaeem Yes, should be in CLI. |
3850612
to
fc1a5ec
Compare
@taimoorzaeem Just tried: $ postgrest-run -- --ready
postgrest: HttpExceptionRequest Request {
host = "0.0.0.0"
port = 3001
secure = False
requestHeaders = []
path = "/ready"
queryString = ""
method = "GET"
proxy = Nothing
rawBody = False
redirectCount = 10
responseTimeout = ResponseTimeoutDefault
requestVersion = HTTP/1.1
proxySecureMode = ProxySecureWithConnect
}
(ConnectionFailure Network.Socket.connect: <socket: 13>: does not exist (Connection refused)) The error is expected, but can we make it clearer? (no Haskell type wrapping) |
Also noted that on success we don't print anything: $ postgrest-run -- --ready
# result is good
$ echo $?
0 Maybe we should print something like traefik:
|
The `--ready` flag is a wrapper around the admin server `/ready` request. This is done through using an http client library in postgrest. Signed-off-by: Taimoor Zaeem <taimoorzaeem@gmail.com>
fc1a5ec
to
d958101
Compare
healthcheck_process = subprocess.run(command, env=env, capture_output=True) | ||
assert healthcheck_process.returncode == 1 | ||
assert ( | ||
"postgrest: health check request failed - connection refused to" | ||
in healthcheck_process.stderr.decode() | ||
) |
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.
This test is flaky and fails sometimes because the subprocess.run
exits without capturing the stderr output. I guess this happens due to output not being flushed properly. Any ideas on how to handle this cleanly?
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.
Maybe instead try to force a schema cache failure so /ready
always fails. An idea could be to put a bad database connection uri. Check the io tests too, likely this was done before.
The
--ready
flag is a wrapper around the admin server/ready
request. This is done through using an http client library in postgrest.Closes #4239.