From 71edf4184960d8664ef9da20617e2d0f91793d36 Mon Sep 17 00:00:00 2001 From: VIktor Kuropiantnyk <103574791+vku-ibm@users.noreply.github.com> Date: Thu, 14 Aug 2025 16:10:39 +0200 Subject: [PATCH] docs: example of docling-serve deployment in the RQ engine mode (#321) Signed-off-by: Viktor Kuropiatnyk Signed-off-by: Michele Dolfi Co-authored-by: Michele Dolfi --- .../docling-serve-rq-workers.yaml | 192 ++++++++++++++++++ docs/deployment.md | 25 +++ 2 files changed, 217 insertions(+) create mode 100644 docs/deploy-examples/docling-serve-rq-workers.yaml diff --git a/docs/deploy-examples/docling-serve-rq-workers.yaml b/docs/deploy-examples/docling-serve-rq-workers.yaml new file mode 100644 index 0000000..6d381ba --- /dev/null +++ b/docs/deploy-examples/docling-serve-rq-workers.yaml @@ -0,0 +1,192 @@ +# This example deployment configures Docling Serve with a Service and RQ workers + +# Create following secret +# kubectl create secret generic docling-serve-rq-secrets --from-literal=REDIS_PASSWORD=myredispassword --from-literal=RQ_REDIS_URL=redis://:myredispassword@docling-serve-redis-service:6373/ +--- +apiVersion: v1 +kind: Service +metadata: + name: docling-serve + labels: + app: docling-serve + component: docling-serve-api +spec: + ports: + - name: http + port: 5001 + targetPort: http + selector: + app: docling-serve + component: docling-serve-api +--- +kind: Deployment +apiVersion: apps/v1 +metadata: + name: docling-serve + labels: + app: docling-serve + component: docling-serve-api +spec: + replicas: 1 + selector: + matchLabels: + app: docling-serve + component: docling-serve-api + template: + metadata: + labels: + app: docling-serve + component: docling-serve-api + spec: + restartPolicy: Always + containers: + - name: api + resources: + limits: + cpu: 1 + memory: 8Gi + requests: + cpu: 250m + memory: 1Gi + env: + - name: DOCLING_SERVE_ENABLE_UI + value: 'true' + - name: DOCLING_SERVE_ENG_KIND + value: 'rq' + - name: DOCLING_SERVE_ENG_RQ_REDIS_URL + valueFrom: + secretKeyRef: + name: docling-serve-rq-secrets + key: RQ_REDIS_URL + ports: + - name: http + containerPort: 5001 + protocol: TCP + imagePullPolicy: Always + image: 'ghcr.io/docling-project/docling-serve-cpu' +--- +kind: Deployment +apiVersion: apps/v1 +metadata: + name: docling-serve-rq-workers + labels: + app: docling-serve-rq-workers + component: docling-serve-rq-worker +spec: + replicas: 2 + selector: + matchLabels: + app: docling-serve-rq-workers + component: docling-serve-rq-worker + template: + metadata: + labels: + app: docling-serve-rq-workers + component: docling-serve-rq-worker + spec: + restartPolicy: Always + containers: + - name: worker + resources: + limits: + cpu: 1 + memory: 4Gi + requests: + cpu: 250m + memory: 1Gi + env: + - name: DOCLING_SERVE_ENG_KIND + value: 'rq' + - name: DOCLING_SERVE_ENG_RQ_REDIS_URL + valueFrom: + secretKeyRef: + name: docling-serve-rq-secrets + key: RQ_REDIS_URL + ports: + - name: http + containerPort: 5001 + protocol: TCP + imagePullPolicy: Always + image: 'ghcr.io/docling-project/docling-serve-cpu' + command: ["docling-serve"] + args: ["rq-worker"] +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: docling-serve-redis + labels: + app: docling-serve-redis +spec: + replicas: 1 + selector: + matchLabels: + app: docling-serve-redis + template: + metadata: + labels: + app: docling-serve-redis + spec: + restartPolicy: Always + terminationGracePeriodSeconds: 30 + containers: + - name: redis + resources: + limits: + cpu: 1 + memory: 1Gi + requests: + cpu: 250m + memory: 100Mi + image: redis:latest + command: ["redis-server"] + args: + - "--port" + - "6373" + - "--dir" + - "/mnt/redis/data" + - "--appendonly" + - "yes" + - "--requirepass" + - "$(REDIS_PASSWORD)" + ports: + - containerPort: 6373 + env: + - name: REDIS_PASSWORD + valueFrom: + secretKeyRef: + name: docling-serve-rq-secrets + key: REDIS_PASSWORD + volumeMounts: + - name: redis-data + mountPath: /mnt/redis/data + securityContext: + fsGroup: 1004 + runAsNonRoot: true + allowPrivilegeEscalation: false + capabilities: + drop: + - ALL + seccompProfile: + type: RuntimeDefault + volumes: + - name: redis-data + emptyDir: + medium: Memory + sizeLimit: 2Gi +--- +apiVersion: v1 +kind: Service +metadata: + name: docling-serve-redis-service + labels: + app: docling-serve-redis +spec: + type: NodePort + ports: + - name: redis-service + protocol: TCP + port: 6373 + targetPort: 6373 + selector: + app: docling-serve-redis \ No newline at end of file diff --git a/docs/deployment.md b/docs/deployment.md index 47600df..5344343 100644 --- a/docs/deployment.md +++ b/docs/deployment.md @@ -225,6 +225,31 @@ curl -X 'POST' \ }' ``` +### Multiple workers with RQ + +Manifest example: [`docling-serve-rq-workers.yaml`](./deploy-examples/docling-serve-rq-workers.yaml) + +This deployment example has the following features: + +- Deployment configuration +- Service configuration +- Redis deployment +- Multiple (2 by default) worker Pods + +Install the app with: + +- create k8s secret: + +```sh +kubectl create secret generic docling-serve-rq-secrets --from-literal=REDIS_PASSWORD=myredispassword --from-literal=RQ_REDIS_URL=redis://:myredispassword@docling-serve-redis-service:6373/ +``` + +- apply deployment manifest: + +```sh +oc apply -f docs/deploy-examples/docling-serve-rq-workers.yaml +``` + ### Secure deployment with `oauth-proxy` Manifest example: [docling-serve-oauth.yaml](./deploy-examples/docling-serve-oauth.yaml)