feat: warn when incorrect interface/port in use for web processes
Users that misconfigure their process's listening interface or port will now see an additional healthcheck warning for web deploys. While only a single port is checked, this ensures that users at least have some context as to why their app isn't responding as expected. Closes #4798
This commit is contained in:
@@ -31,7 +31,10 @@ if __name__ == "__main__":
|
||||
for arg in sys.argv:
|
||||
print(f"Arg: {arg}")
|
||||
|
||||
port = int(os.getenv("PORT", 5000))
|
||||
port = int(os.getenv("PORT", "5000"))
|
||||
if os.getenv("ALT_PORT"):
|
||||
port = int(os.getenv("ALT_PORT", "5000"))
|
||||
|
||||
server = http.server.HTTPServer(("0.0.0.0", port), GetHandler)
|
||||
print("Listening on port {0}".format(port))
|
||||
server.serve_forever()
|
||||
|
||||
@@ -268,3 +268,21 @@ teardown() {
|
||||
assert_output_contains "/healthcheck"
|
||||
assert_success
|
||||
}
|
||||
|
||||
@test "(checks) listening checks" {
|
||||
if [[ "$TERM_PROGRAM" == "vscode" ]]; then
|
||||
skip "environment must be running in the host namespace"
|
||||
fi
|
||||
|
||||
run /bin/bash -c "dokku config:set $TEST_APP ALT_PORT=5001"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run deploy_app
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
assert_output_contains "Failure in name='port listening check': container listening on expected IPv4 interface with an unexpected port: expected=5000 actual=5001"
|
||||
assert_output_contains "Running healthcheck name='port listening check' attempts=3 port=5000 retries=2 timeout=5 type='listening' wait=5"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user