Skip to content

fix: use UVICORN_ROOT_PATH as root_path for FastAPI app#549

Open
morincl wants to merge 2 commits intodocling-project:mainfrom
morincl:patch-1
Open

fix: use UVICORN_ROOT_PATH as root_path for FastAPI app#549
morincl wants to merge 2 commits intodocling-project:mainfrom
morincl:patch-1

Conversation

@morincl
Copy link
Copy Markdown

@morincl morincl commented Mar 24, 2026

Description of the changes:
This should fix the issue described here: #485
The root path specified by the user as UVICORN_ROOT_PATH shall be used when instantiating the fastapi.FastAPI app.

Issue resolved by this Pull Request:
Resolves #485

This should fix the issue described here: docling-project#485

Signed-off-by: Clément Morin <clement.morin@tobii.com>
@mergify
Copy link
Copy Markdown

mergify bot commented Mar 24, 2026

Merge Protections

Your pull request matches the following merge protections and will not be merged until they are valid.

🟢 Enforce conventional commit

Wonderful, this rule succeeded.

Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/

  • title ~= ^(fix|feat|docs|style|refactor|perf|test|build|ci|chore|revert)(?:\(.+\))?(!)?:

@dosubot
Copy link
Copy Markdown

dosubot bot commented Mar 24, 2026

Related Documentation

1 document(s) may need updating based on files changed in this PR:

Docling

How can you mount a PersistentVolumeClaim (PVC) in docling-serve on OpenShift to store EasyOCR models, and what steps are required to ensure docling-serve can access these models?
View Suggested Changes
@@ -69,9 +69,13 @@
 
 - **livenessProbe** (`/health`): Lightweight liveness check that verifies the API is responsive without checking model or dependency status. Used to detect and restart crashed pods.
 
-## Metrics endpoint configuration
+## Environment variables
 
-docling-serve supports serving Prometheus metrics on a separate port from the main API via the `DOCLING_SERVE_METRICS_PORT` environment variable. When set, this starts a dedicated HTTP server on the specified port that serves the `/metrics` endpoint. This is useful for production deployments where you want to expose metrics on a different port with separate network policies.
+docling-serve supports several environment variables for deployment configuration:
+
+### DOCLING_SERVE_METRICS_PORT
+
+Serves Prometheus metrics on a separate port from the main API. When set, this starts a dedicated HTTP server on the specified port that serves the `/metrics` endpoint. This is useful for production deployments where you want to expose metrics on a different port with separate network policies.
 
 Example deployment configuration:
 
@@ -95,6 +99,23 @@
 
 With this configuration, the main API remains accessible on port 5000 while Prometheus can scrape metrics from port 9090. This allows you to apply different network policies or service configurations for API traffic versus monitoring traffic.
 
+### UVICORN_ROOT_PATH
+
+Sets the root path for the FastAPI application. This is useful when docling-serve is deployed behind a reverse proxy or ingress with a path prefix (e.g., `/api/v1/`). The value should be the path prefix where the application is mounted.
+
+Example usage: If your OpenShift route exposes the service at `https://example.com/docling-api`, you would set `UVICORN_ROOT_PATH=/docling-api`.
+
+```yaml
+spec:
+  template:
+    spec:
+      containers:
+        - name: api
+          env:
+            - name: UVICORN_ROOT_PATH
+              value: "/docling-api"
+```
+
 **Troubleshooting tips:**
 - Ensure your PVC is `Bound` and healthy (`oc get pvc`).
 - Inspect pod events and logs for mount errors (`oc describe pod ...`).

[Accept] [Decline]

Note: You must be authenticated to accept/decline updates.

How did I do? Any feedback?  Join Discord

`UvicornSettings` actually defines the empty string as default value for `root_path`. The `or ""` part of the expression is thus not needed.

Signed-off-by: Clément Morin <clement.morin@tobii.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 24, 2026

DCO Check Passed

Thanks @morincl, all your commits are properly signed off. 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Docs pages don't use UVICORN_ROOT_PATH

1 participant