Skip to content

Commit 71edf41

Browse files
vku-ibmdolfim-ibm
andauthored
docs: example of docling-serve deployment in the RQ engine mode (#321)
Signed-off-by: Viktor Kuropiatnyk <[email protected]> Signed-off-by: Michele Dolfi <[email protected]> Co-authored-by: Michele Dolfi <[email protected]>
1 parent 9a64410 commit 71edf41

File tree

2 files changed

+217
-0
lines changed

2 files changed

+217
-0
lines changed
Lines changed: 192 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,192 @@
1+
# This example deployment configures Docling Serve with a Service and RQ workers
2+
3+
# Create following secret
4+
# 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/
5+
---
6+
apiVersion: v1
7+
kind: Service
8+
metadata:
9+
name: docling-serve
10+
labels:
11+
app: docling-serve
12+
component: docling-serve-api
13+
spec:
14+
ports:
15+
- name: http
16+
port: 5001
17+
targetPort: http
18+
selector:
19+
app: docling-serve
20+
component: docling-serve-api
21+
---
22+
kind: Deployment
23+
apiVersion: apps/v1
24+
metadata:
25+
name: docling-serve
26+
labels:
27+
app: docling-serve
28+
component: docling-serve-api
29+
spec:
30+
replicas: 1
31+
selector:
32+
matchLabels:
33+
app: docling-serve
34+
component: docling-serve-api
35+
template:
36+
metadata:
37+
labels:
38+
app: docling-serve
39+
component: docling-serve-api
40+
spec:
41+
restartPolicy: Always
42+
containers:
43+
- name: api
44+
resources:
45+
limits:
46+
cpu: 1
47+
memory: 8Gi
48+
requests:
49+
cpu: 250m
50+
memory: 1Gi
51+
env:
52+
- name: DOCLING_SERVE_ENABLE_UI
53+
value: 'true'
54+
- name: DOCLING_SERVE_ENG_KIND
55+
value: 'rq'
56+
- name: DOCLING_SERVE_ENG_RQ_REDIS_URL
57+
valueFrom:
58+
secretKeyRef:
59+
name: docling-serve-rq-secrets
60+
key: RQ_REDIS_URL
61+
ports:
62+
- name: http
63+
containerPort: 5001
64+
protocol: TCP
65+
imagePullPolicy: Always
66+
image: 'ghcr.io/docling-project/docling-serve-cpu'
67+
---
68+
kind: Deployment
69+
apiVersion: apps/v1
70+
metadata:
71+
name: docling-serve-rq-workers
72+
labels:
73+
app: docling-serve-rq-workers
74+
component: docling-serve-rq-worker
75+
spec:
76+
replicas: 2
77+
selector:
78+
matchLabels:
79+
app: docling-serve-rq-workers
80+
component: docling-serve-rq-worker
81+
template:
82+
metadata:
83+
labels:
84+
app: docling-serve-rq-workers
85+
component: docling-serve-rq-worker
86+
spec:
87+
restartPolicy: Always
88+
containers:
89+
- name: worker
90+
resources:
91+
limits:
92+
cpu: 1
93+
memory: 4Gi
94+
requests:
95+
cpu: 250m
96+
memory: 1Gi
97+
env:
98+
- name: DOCLING_SERVE_ENG_KIND
99+
value: 'rq'
100+
- name: DOCLING_SERVE_ENG_RQ_REDIS_URL
101+
valueFrom:
102+
secretKeyRef:
103+
name: docling-serve-rq-secrets
104+
key: RQ_REDIS_URL
105+
ports:
106+
- name: http
107+
containerPort: 5001
108+
protocol: TCP
109+
imagePullPolicy: Always
110+
image: 'ghcr.io/docling-project/docling-serve-cpu'
111+
command: ["docling-serve"]
112+
args: ["rq-worker"]
113+
---
114+
apiVersion: apps/v1
115+
kind: Deployment
116+
metadata:
117+
name: docling-serve-redis
118+
labels:
119+
app: docling-serve-redis
120+
spec:
121+
replicas: 1
122+
selector:
123+
matchLabels:
124+
app: docling-serve-redis
125+
template:
126+
metadata:
127+
labels:
128+
app: docling-serve-redis
129+
spec:
130+
restartPolicy: Always
131+
terminationGracePeriodSeconds: 30
132+
containers:
133+
- name: redis
134+
resources:
135+
limits:
136+
cpu: 1
137+
memory: 1Gi
138+
requests:
139+
cpu: 250m
140+
memory: 100Mi
141+
image: redis:latest
142+
command: ["redis-server"]
143+
args:
144+
- "--port"
145+
- "6373"
146+
- "--dir"
147+
- "/mnt/redis/data"
148+
- "--appendonly"
149+
- "yes"
150+
- "--requirepass"
151+
- "$(REDIS_PASSWORD)"
152+
ports:
153+
- containerPort: 6373
154+
env:
155+
- name: REDIS_PASSWORD
156+
valueFrom:
157+
secretKeyRef:
158+
name: docling-serve-rq-secrets
159+
key: REDIS_PASSWORD
160+
volumeMounts:
161+
- name: redis-data
162+
mountPath: /mnt/redis/data
163+
securityContext:
164+
fsGroup: 1004
165+
runAsNonRoot: true
166+
allowPrivilegeEscalation: false
167+
capabilities:
168+
drop:
169+
- ALL
170+
seccompProfile:
171+
type: RuntimeDefault
172+
volumes:
173+
- name: redis-data
174+
emptyDir:
175+
medium: Memory
176+
sizeLimit: 2Gi
177+
---
178+
apiVersion: v1
179+
kind: Service
180+
metadata:
181+
name: docling-serve-redis-service
182+
labels:
183+
app: docling-serve-redis
184+
spec:
185+
type: NodePort
186+
ports:
187+
- name: redis-service
188+
protocol: TCP
189+
port: 6373
190+
targetPort: 6373
191+
selector:
192+
app: docling-serve-redis

docs/deployment.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,31 @@ curl -X 'POST' \
225225
}'
226226
```
227227

228+
### Multiple workers with RQ
229+
230+
Manifest example: [`docling-serve-rq-workers.yaml`](./deploy-examples/docling-serve-rq-workers.yaml)
231+
232+
This deployment example has the following features:
233+
234+
- Deployment configuration
235+
- Service configuration
236+
- Redis deployment
237+
- Multiple (2 by default) worker Pods
238+
239+
Install the app with:
240+
241+
- create k8s secret:
242+
243+
```sh
244+
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/
245+
```
246+
247+
- apply deployment manifest:
248+
249+
```sh
250+
oc apply -f docs/deploy-examples/docling-serve-rq-workers.yaml
251+
```
252+
228253
### Secure deployment with `oauth-proxy`
229254

230255
Manifest example: [docling-serve-oauth.yaml](./deploy-examples/docling-serve-oauth.yaml)

0 commit comments

Comments
 (0)