Skip to content

Commit

Permalink
Merge pull request #56 from regulaforensics/sdk-error-log
Browse files Browse the repository at this point in the history
[Docreader] Add support for SDK Error Log
  • Loading branch information
sdauhuchytsrf authored Dec 23, 2024
2 parents 513ce75 + c116351 commit 5ad59ab
Show file tree
Hide file tree
Showing 7 changed files with 102 additions and 1 deletion.
2 changes: 1 addition & 1 deletion charts/docreader/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
apiVersion: v2
name: docreader
home: https://api.regulaforensics.com/
version: 1.3.4
version: 1.4.0
appVersion: nightly
description: Fast and accurate data extraction from identity documents. On-premise and cloud integration
icon: https://secure.gravatar.com/avatar/71a5efd69d82e444129ad18f51224bbb.jpg
Expand Down
20 changes: 20 additions & 0 deletions charts/docreader/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,11 @@ A major chart version change (like v0.1.2 -> v1.0.0) indicates that there is an
| `config.service.webServer.port` | Port server binding | `8080` |
| `config.service.webServer.workers` | Number of workers per pod | `1` |
| `config.service.webServer.timeout` | Number of seconds for the worker to process the request | `30` |
| `config.service.webServer.maxRequests` | The maximum number of requests a worker will process before restarting | `0` |
| `config.service.webServer.maxRequestsJitter` | The maximum jitter to add to the `maxRequests` setting | `0` |
| `config.service.webServer.gracefulTimeout` | Timeout for graceful workers restart | `30` |
| `config.service.webServer.keepalive` | The number of seconds to wait for requests on a Keep-Alive connection | `0` |
| `config.service.webServer.workerConnections` | The maximum number of simultaneous clients | `1000` |
| `config.service.webServer.demoApp.enabled` | Serve a demo web app | `true` |
| `config.service.webServer.demoApp.webComponent.enabled` | Whether to enable Web Component | `false` |
| `config.service.webServer.cors.origins` | Origin, allowed to use API | `*` |
Expand Down Expand Up @@ -252,6 +257,21 @@ A major chart version change (like v0.1.2 -> v1.0.0) indicates that there is an
| `config.service.sessionApi.transactions.persistence.existingClaim` | Name of the existing Persistent Volume Claim | `""` |


## SDK Error Logs parameters
| Parameter | Description | Default |
|-----------------------------------------------------------|-----------------------------------------------------------------------------------------|---------------------------------|
| `config.service.sdkErrorLog.enabled` | Whether to enable SDK Error Log | `false` |
| `config.service.sdkErrorLog.location.folder` | The SDK Error Log folder name in case of `fs` storage type | `/app/docreader-errors/sdk` |
| `config.service.sdkErrorLog.location.bucket` | The SDK Error Log bucket name in case of `s3`/`gcs` storage type | `docreader-errors` |
| `config.service.sdkErrorLog.location.container` | The SDK Error Log storage container name in case of `az` storage type | `docreader-errors` |
| `config.service.sdkErrorLog.location.prefix` | The SDK Error Log prefix path in the `bucket/container` | `sdk` |
| `config.service.sdkErrorLog.persistence.enabled` | Whether to enable SDK Error Log persistence (Applicable only for the `fs` storage type) | `false` |
| `config.service.sdkErrorLog.persistence.accessMode` | The SDK Error Log data Persistence access mode | `ReadWriteMany` |
| `config.service.sdkErrorLog.persistence.size` | The size of SDK Error Log data Persistent Volume storage | `10Gi` |
| `config.service.sdkErrorLog.persistence.storageClassName` | The SDK Error Log data Persistent Volume storage Class Name | `""` |
| `config.service.sdkErrorLog.persistence.existingClaim` | Name of the existing Persistent Volume Claim | `""` |


> [!NOTE]
> The subcharts are used for the demonstration and Dev/Test purposes.
> We strongly recommend to deploying separate installations of the DB in Production.
Expand Down
9 changes: 9 additions & 0 deletions charts/docreader/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,15 @@ app.kubernetes.io/instance: {{ .Release.Name }}
{{- end -}}
{{- end -}}

{{/* SDK Error Log volume claim */}}
{{- define "docreader.sdkErrorLog.pvc" -}}
{{- if .Values.config.service.sdkErrorLog.persistence.existingClaim -}}
{{ .Values.config.service.sdkErrorLog.persistence.existingClaim }}
{{- else -}}
{{ .Release.Name }}-sdk-error-log
{{- end -}}
{{- end -}}

{{/* Docreader RFID PKD PA volume claim */}}
{{- define "docreader.rfid.pkd.pvc" -}}
{{- if .Values.config.sdk.rfid.persistence.existingClaim -}}
Expand Down
22 changes: 22 additions & 0 deletions charts/docreader/templates/config.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ service:
port: {{ .Values.config.service.webServer.port }}
workers: {{ .Values.config.service.webServer.workers }}
timeout: {{ .Values.config.service.webServer.timeout }}
maxRequests: {{ .Values.config.service.webServer.maxRequests }}
maxRequestsJitter: {{ .Values.config.service.webServer.maxRequestsJitter }}
gracefulTimeout: {{ .Values.config.service.webServer.gracefulTimeout }}
keepalive: {{ .Values.config.service.webServer.keepalive }}
workerConnections: {{ .Values.config.service.webServer.workerConnections }}
demoApp:
enabled: {{ .Values.config.service.webServer.demoApp.enabled }}
{{- if .Values.config.service.webServer.demoApp.enabled }}
Expand Down Expand Up @@ -134,4 +139,21 @@ service:
folder: {{ quote .Values.config.service.sessionApi.transactions.location.folder }}
{{- end }}
{{- end }}

sdkErrorLog:
enabled: {{ .Values.config.service.sdkErrorLog.enabled }}
{{- if .Values.config.service.sdkErrorLog.enabled }}
location:
{{- if or (eq .Values.config.service.storage.type "s3") (eq .Values.config.service.storage.type "gcs") }}
bucket: {{ quote .Values.config.service.sdkErrorLog.location.bucket }}
prefix: {{ quote .Values.config.service.sdkErrorLog.location.prefix }}
{{- end }}
{{- if eq .Values.config.service.storage.type "az" }}
container: {{ quote .Values.config.service.sdkErrorLog.location.container }}
prefix: {{ quote .Values.config.service.sdkErrorLog.location.prefix }}
{{- end }}
{{- if eq .Values.config.service.storage.type "fs" }}
folder: {{ quote .Values.config.service.sdkErrorLog.location.folder }}
{{- end }}
{{- end }}
{{- end }}
9 changes: 9 additions & 0 deletions charts/docreader/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,10 @@ spec:
- name: session-api-transactions
mountPath: {{ quote .Values.config.service.sessionApi.transactions.location.folder }}
{{- end }}
{{- if and (eq .Values.config.service.storage.type "fs") .Values.config.service.sdkErrorLog.enabled .Values.config.service.sdkErrorLog.persistence.enabled }}
- name: sdk-error-log
mountPath: {{ quote .Values.config.service.sdkErrorLog.location.folder }}
{{- end }}
{{- if and .Values.config.sdk.rfid.enabled .Values.config.sdk.rfid.persistence.enabled }}
- name: rfid-pkd
mountPath: {{ quote .Values.config.sdk.rfid.pkdPaPath }}
Expand Down Expand Up @@ -191,6 +195,11 @@ spec:
persistentVolumeClaim:
claimName: {{ template "docreader.sessionApi.transactions.pvc" . }}
{{- end }}
{{- if and (eq .Values.config.service.storage.type "fs") .Values.config.service.sdkErrorLog.enabled .Values.config.service.sdkErrorLog.persistence.enabled }}
- name: sdk-error-log
persistentVolumeClaim:
claimName: {{ template "docreader.sdkErrorLog.pvc" . }}
{{- end }}
{{- if and .Values.config.sdk.rfid.enabled .Values.config.sdk.rfid.persistence.enabled }}
- name: rfid-pkd
persistentVolumeClaim:
Expand Down
20 changes: 20 additions & 0 deletions charts/docreader/templates/sdk-error-pvc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{{- if and (eq .Values.config.service.storage.type "fs") .Values.config.service.sdkErrorLog.enabled .Values.config.service.sdkErrorLog.persistence.enabled (not .Values.config.service.sdkErrorLog.persistence.existingClaim) }}
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: {{ template "docreader.sdkErrorLog.pvc" . }}
labels: {{- include "docreader.labels" . | nindent 4 }}
spec:
accessModes:
- {{ .Values.config.service.sdkErrorLog.persistence.accessMode }}
resources:
requests:
storage: {{ .Values.config.service.sdkErrorLog.persistence.size | quote }}
{{- if .Values.config.service.sdkErrorLog.persistence.storageClassName }}
{{- if (eq "-" .Values.config.service.sdkErrorLog.persistence.storageClassName) }}
storageClassName: ""
{{- else }}
storageClassName: {{ quote .Values.config.service.sdkErrorLog.persistence.storageClassName }}
{{- end }}
{{- end }}
{{- end }}
21 changes: 21 additions & 0 deletions charts/docreader/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@ config:
port: 8080
workers: 1
timeout: 30
maxRequests: 0
maxRequestsJitter: 0
gracefulTimeout: 30
keepalive: 0
workerConnections: 1000

demoApp:
enabled: true
Expand Down Expand Up @@ -215,6 +220,22 @@ config:
storageClassName: ~
existingClaim: ~

sdkErrorLog:
enabled: false
location:
folder: "/app/docreader-errors/sdk"
# bucket: "docreader-errors" # storage type s3/gcs
# container: "docreader-errors" # storage type az
prefix: "sdk"
# Persistence is only applicable for the fs storage type
persistence:
# Enable persistent volume for storing transactions data
enabled: false
accessMode: ReadWriteMany
size: 10Gi
storageClassName: ~
existingClaim: ~

env: []
# - name: ""
# value: ""
Expand Down

0 comments on commit 5ad59ab

Please sign in to comment.