Prod upgrade fixes: profiler compatibility with new FastAPI, pinned dependencies
- profiler: Literal instead of Query(enum=...) (broke on FastAPI 0.162) - pin fastapi/starlette/uvicorn/pydantic for the profiler, upper bounds for APP_CORE - health check: show the service log when an HTTP check fails - update.sh: the "before" version comes from deploy.state - migrate.py: hint about OVPMON_*_DB_PATH when the default database is missing - docs: --source --no-pull mode, dependency pinning, PIP_CONSTRAINT - tests: new test for the section parameter, fixed test_server_process.py Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
1bbf9b7cc1
commit
79c950f8f7
14 files changed
+156
-38
No files matched your search
+10
-7
@@ -983,10 +983,12 @@ nginx_apply() { # test the configuration, reload or start nginx
|
||||
# ---------------------------------------------------------------------------------------------
|
||||
http_code() { curl -sk -o /dev/null -w '%{http_code}' --max-time 5 "$@" 2>/dev/null || true; }
|
||||
|
||||
# wait_http LABEL URL REGEX: waits until the HTTP status matches REGEX (e.g. '200' or '401|403')
|
||||
# wait_http LABEL URL REGEX [SERVICE...]: waits until the HTTP status matches REGEX (e.g. '200' or '401|403').
|
||||
# On failure the log of the given services is shown (to find the reason)
|
||||
wait_http() {
|
||||
local label url re w code
|
||||
local label url re w code s
|
||||
label="$1"; url="$2"; re="$3"
|
||||
shift 3 || true
|
||||
w=0
|
||||
while :; do
|
||||
code=$(http_code "$url")
|
||||
@@ -996,6 +998,7 @@ wait_http() {
|
||||
fi
|
||||
if [ "$w" -ge "$HEALTH_TIMEOUT" ]; then
|
||||
log " $label: no good answer after ${HEALTH_TIMEOUT}s (last HTTP status '$code', wanted $re): $url" >&2
|
||||
for s in "$@"; do show_service_log "$s"; done
|
||||
return 1
|
||||
fi
|
||||
sleep 2
|
||||
@@ -1012,12 +1015,12 @@ health_check() {
|
||||
if svc_active "$s"; then log " $s: $(svc_state_word "$s")"; else log " $s: NOT running" >&2; show_service_log "$s"; bad=1; fi
|
||||
done
|
||||
[ "$bad" = 0 ] || return 1
|
||||
wait_http "monitoring API" "http://127.0.0.1:5001/" '[1-5][0-9][0-9]' || bad=1
|
||||
wait_http "profiler API" "http://127.0.0.1:8000/" '200' || bad=1
|
||||
wait_http "monitoring API" "http://127.0.0.1:5001/" '[1-5][0-9][0-9]' ovpmon-api || bad=1
|
||||
wait_http "profiler API" "http://127.0.0.1:8000/" '200' ovpmon-profiler || bad=1
|
||||
if [ -n "${1:-}" ]; then
|
||||
wait_http "UI (nginx)" "https://127.0.0.1:$1/" '200' || bad=1
|
||||
wait_http "monitoring API through nginx" "https://127.0.0.1:$1/api/v1/user/me" '401|403' || bad=1
|
||||
wait_http "profiler API through nginx" "https://127.0.0.1:$1/profiles-api/config" '401|403' || bad=1
|
||||
wait_http "UI (nginx)" "https://127.0.0.1:$1/" '200' $SERVICES || bad=1
|
||||
wait_http "monitoring API through nginx" "https://127.0.0.1:$1/api/v1/user/me" '401|403' $SERVICES || bad=1
|
||||
wait_http "profiler API through nginx" "https://127.0.0.1:$1/profiles-api/config" '401|403' $SERVICES || bad=1
|
||||
fi
|
||||
[ "$bad" = 0 ] || return 1
|
||||
log "all health checks passed"
|
||||
|
||||
Reference in new issue
Block a user