use statefulSets and readinessProbes instead of initContainers
This commit is contained in:
@@ -1,15 +1,15 @@
|
|||||||
---
|
---
|
||||||
apiVersion: apps/v1
|
apiVersion: apps/v1
|
||||||
kind: Deployment
|
kind: StatefulSet
|
||||||
metadata:
|
metadata:
|
||||||
name: paperless-ngx-db
|
name: paperless-ngx-db
|
||||||
namespace: tools
|
namespace: tools
|
||||||
spec:
|
spec:
|
||||||
strategy:
|
|
||||||
type: Recreate
|
|
||||||
selector:
|
selector:
|
||||||
matchLabels:
|
matchLabels:
|
||||||
app: paperless-ngx-db
|
app: paperless-ngx-db
|
||||||
|
serviceName: paperless-ngx-db
|
||||||
|
replicas: 1
|
||||||
template:
|
template:
|
||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
@@ -21,10 +21,15 @@ spec:
|
|||||||
ports:
|
ports:
|
||||||
- containerPort: 6379
|
- containerPort: 6379
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- name: data
|
- name: paperless-ngx-db
|
||||||
mountPath: /data
|
mountPath: /data
|
||||||
subPath: redis
|
subPath: redis
|
||||||
volumes:
|
volumeClaimTemplates:
|
||||||
- name: data
|
- metadata:
|
||||||
persistentVolumeClaim:
|
name: paperless-ngx-db
|
||||||
claimName: paperless-db-longhorn
|
spec:
|
||||||
|
accessModes: ["ReadWriteOnce"]
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: 500Mi
|
||||||
|
storageClassName: longhorn
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ spec:
|
|||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: Service
|
kind: Service
|
||||||
metadata:
|
metadata:
|
||||||
name: paperless-ngx-db-service
|
name: paperless-ngx-db
|
||||||
namespace: tools
|
namespace: tools
|
||||||
spec:
|
spec:
|
||||||
selector:
|
selector:
|
||||||
|
|||||||
@@ -15,18 +15,24 @@ spec:
|
|||||||
labels:
|
labels:
|
||||||
app: paperless-ngx
|
app: paperless-ngx
|
||||||
spec:
|
spec:
|
||||||
initContainers:
|
|
||||||
- name: wait-for-redis
|
|
||||||
image: busybox:latest
|
|
||||||
command: ['sh', '-c', 'until nc -z paperless-ngx-db-service 6379; do echo waiting for redis; sleep 2; done;']
|
|
||||||
containers:
|
containers:
|
||||||
- name: paperless-ngx
|
- name: paperless-ngx
|
||||||
image: ghcr.io/paperless-ngx/paperless-ngx:2.20.2
|
image: ghcr.io/paperless-ngx/paperless-ngx:2.20.2
|
||||||
|
readinessProbe:
|
||||||
|
exec:
|
||||||
|
command:
|
||||||
|
- bash
|
||||||
|
- -c
|
||||||
|
- |
|
||||||
|
(echo >/dev/tcp/paperless-ngx-db.tools.svc.cluster.local/6379)
|
||||||
|
initialDelaySeconds: 5
|
||||||
|
periodSeconds: 5
|
||||||
|
failureThreshold: 3
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 8000
|
- containerPort: 8000
|
||||||
env:
|
env:
|
||||||
- name: PAPERLESS_REDIS
|
- name: PAPERLESS_REDIS
|
||||||
value: "redis://paperless-ngx-db-service:6379"
|
value: "redis://paperless-ngx-db.tools.svc.cluster.local:6379"
|
||||||
- name: PAPERLESS_URL
|
- name: PAPERLESS_URL
|
||||||
valueFrom:
|
valueFrom:
|
||||||
secretKeyRef:
|
secretKeyRef:
|
||||||
@@ -47,9 +53,9 @@ spec:
|
|||||||
- name: PAPERLESS_TIKA_ENABLED
|
- name: PAPERLESS_TIKA_ENABLED
|
||||||
value: "1"
|
value: "1"
|
||||||
- name: PAPERLESS_TIKA_ENDPOINT
|
- name: PAPERLESS_TIKA_ENDPOINT
|
||||||
value: "http://tika-service:9998"
|
value: "http://tika-service.tools.svc.cluster.local:9998"
|
||||||
- name: PAPERLESS_TIKA_GOTENBERG_ENDPOINT
|
- name: PAPERLESS_TIKA_GOTENBERG_ENDPOINT
|
||||||
value: "http://gotenberg-service:3000"
|
value: "http://gotenberg-service.tools.svc.cluster.local:3000"
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- name: data
|
- name: data
|
||||||
mountPath: /usr/src/paperless/data
|
mountPath: /usr/src/paperless/data
|
||||||
|
|||||||
@@ -12,18 +12,3 @@ spec:
|
|||||||
requests:
|
requests:
|
||||||
storage: 2Gi
|
storage: 2Gi
|
||||||
storageClassName: longhorn
|
storageClassName: longhorn
|
||||||
|
|
||||||
---
|
|
||||||
apiVersion: v1
|
|
||||||
kind: PersistentVolumeClaim
|
|
||||||
metadata:
|
|
||||||
name: paperless-db-longhorn
|
|
||||||
namespace: tools
|
|
||||||
spec:
|
|
||||||
accessModes:
|
|
||||||
- ReadWriteOnce
|
|
||||||
volumeMode: Filesystem
|
|
||||||
resources:
|
|
||||||
requests:
|
|
||||||
storage: 1Gi
|
|
||||||
storageClassName: longhorn
|
|
||||||
|
|||||||
Reference in New Issue
Block a user