Problem: Kelvin REST API Container Reports Unhealthy

Problem

The Kelvin REST API 4.0.2 container reports unhealthy. docker logs produces no output, and the health check fails with:

urllib.error.HTTPError: HTTP Error 503: Service Unavailable

The container is missing the localhost proxy exception, although it is already configured on the UCS host.

Investigation

Run on the UCS host. Replace the example container ID and published port with the values from docker ps.

docker ps
docker logs a53e9db36bff

Read the health-check output and application log:

docker inspect --format '{{range .State.Health.Log}}{{println .Start "ExitCode:" .ExitCode}}{{println .Output}}{{end}}' a53e9db36bff
tail -n 200 /var/log/univention/ucsschool-kelvin-rest-api/http.log

Test the endpoint without a proxy:

curl --noproxy '*' -i --max-time 10 http://127.0.0.1:40002/health

Compare requests inside the container:

docker exec -i a53e9db36bff python3 - <<'PY'
import urllib.request
from urllib.error import HTTPError

url = "http://localhost:8911/health"
print("Localhost bypass:", urllib.request.proxy_bypass("localhost"))
for name, opener in [
    ("Default", urllib.request.build_opener()),
    ("No proxy", urllib.request.build_opener(urllib.request.ProxyHandler({}))),
]:
    try:
        with opener.open(url, timeout=5) as response:
            print(name, response.status)
    except HTTPError as error:
        print(name, error.code, error.headers)
PY

Confirmed results:

  • Direct requests: HTTP 200.
  • Default container request: HTTP 503, Server: squid/4.13, X-Squid-Error: ERR_CONNECT_FAIL 111.
  • Localhost bypass: False.

Compare the exceptions:

ucr get proxy/no_proxy
docker exec a53e9db36bff python3 -c 'import os; print({k:v for k,v in os.environ.items() if k.lower() == "no_proxy"})'

localhost was present on the host but missing from the container.

Solution

Ensure proxy/no_proxy on the host includes localhost. Preserve existing exceptions. Example:

ucr set proxy/no_proxy='server.example.de,localhost'

If already configured, skip this change.

Recreate the app containers to apply the current host settings:

univention-app reinitialize ucsschool-kelvin-rest-api

This interrupts the app. Changes stored only inside the replaced containers may be lost; persistent host-mounted data remains.

Use docker ps to identify the new API container. Repeat the proxy test above: expect Localhost bypass: True and HTTP 200. Docker should then report healthy.