fix: add proxy health checks from app.json readiness

The caddy, haproxy, openresty, and traefik docs stated that requests are only routed to containers passing healthchecks, but these proxies route to a new container as soon as it starts. The first `web` readiness healthcheck in `app.json` is now also turned into health checks and retries for caddy and openresty, as it already was for traefik, so requests are routed away from containers that are not yet ready, and the docs now describe how each proxy actually behaves.
This commit is contained in:
Jose Diaz-Gonzalez committed 2026-11-02 00:33:35 -05:00
1 parent 1910c3fb68
commit 83c9c4d72e
15 files changed
+694 -39

No files matched your search

+26
View File
@@ -17,6 +17,32 @@ fn-proxy-get-labels-file-path() {
echo "$PROXY_FILE"
}
fn-proxy-get-readiness-healthcheck() {
declare desc="outputs the first web readiness healthcheck with a path from the app's app.json as json"
declare APP="$1"
local app_json
app_json="$(plugn trigger app-json-get-content "$APP" 2>/dev/null || echo "{}")"
echo "$app_json" | jq -c '.healthchecks.web // [] | map(select(.type == "readiness" and .path != null and .path != "")) | .[0] // empty'
}
fn-proxy-healthcheck-path-is-valid() {
declare desc="checks that an app.json healthcheck path is absolute and free of whitespace, control, quote, and backslash characters"
declare HC_PATH="$1"
[[ "$HC_PATH" == /* ]] || return 1
[[ "$HC_PATH" =~ [[:space:][:cntrl:]\"\'\\] ]] && return 1
return 0
}
fn-proxy-healthcheck-scheme-is-valid() {
declare desc="checks that an app.json healthcheck scheme is either http or https"
declare HC_SCHEME="$1"
[[ -z "$HC_SCHEME" ]] && return 0
[[ "${HC_SCHEME,,}" == "http" ]] || [[ "${HC_SCHEME,,}" == "https" ]]
}
fn-proxy-display-labels() {
declare desc="print user-set app container labels for specified proxy"
declare PROXY="$1" APP="$2"