fix: use UVICORN_ROOT_PATH as root_path for FastAPI app#549
Open
morincl wants to merge 2 commits intodocling-project:mainfrom
Open
fix: use UVICORN_ROOT_PATH as root_path for FastAPI app#549morincl wants to merge 2 commits intodocling-project:mainfrom
morincl wants to merge 2 commits intodocling-project:mainfrom
Conversation
This should fix the issue described here: docling-project#485 Signed-off-by: Clément Morin <clement.morin@tobii.com>
Merge ProtectionsYour pull request matches the following merge protections and will not be merged until they are valid. 🟢 Enforce conventional commitWonderful, this rule succeeded.Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/
|
|
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 ...`).Note: You must be authenticated to accept/decline updates. |
`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>
Contributor
|
✅ DCO Check Passed Thanks @morincl, all your commits are properly signed off. 🎉 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of the changes:
This should fix the issue described here: #485
The root path specified by the user as
UVICORN_ROOT_PATHshall be used when instantiating thefastapi.FastAPIapp.Issue resolved by this Pull Request:
Resolves #485