From df9e450d9153d09c3d22f6756c9a36ecb1339144 Mon Sep 17 00:00:00 2001 From: ychung-mot Date: Wed, 19 Jun 2024 13:17:26 -0700 Subject: [PATCH] chore: logs --- helm/_backend/templates/deployment.yaml | 11 +++++++ helm/_backend/templates/pvc.yaml | 14 +++++++++ helm/_backend/values.yaml | 6 +++- helm/_hangfire/templates/deployment.yaml | 11 +++++++ helm/_hangfire/templates/pvc.yaml | 14 +++++++++ helm/_hangfire/values.yaml | 6 +++- .../StrDss.Api/appsettings.Development.json | 30 ------------------- server/StrDss.Api/appsettings.json | 2 +- .../appsettings.Development.json | 30 ------------------- server/StrDss.Hangfire/appsettings.json | 2 +- 10 files changed, 62 insertions(+), 64 deletions(-) create mode 100644 helm/_backend/templates/pvc.yaml create mode 100644 helm/_hangfire/templates/pvc.yaml delete mode 100644 server/StrDss.Api/appsettings.Development.json delete mode 100644 server/StrDss.Hangfire/appsettings.Development.json diff --git a/helm/_backend/templates/deployment.yaml b/helm/_backend/templates/deployment.yaml index c3d04170..dbccfd36 100644 --- a/helm/_backend/templates/deployment.yaml +++ b/helm/_backend/templates/deployment.yaml @@ -101,6 +101,9 @@ spec: periodSeconds: 10 successThreshold: 1 failureThreshold: 5 + volumeMounts: + - name: logs + mountPath: /strdss/logs resources: {{- toYaml .Values.resources | nindent 12 }} {{- with .Values.nodeSelector }} @@ -114,4 +117,12 @@ spec: {{- with .Values.tolerations }} tolerations: {{- toYaml . | nindent 8 }} + {{- end }} + volumes: + - name: logs + {{- if .Values.persistence.enabled }} + persistentVolumeClaim: + claimName: {{ include "app.fullname" . }}-log + {{- else }} + emptyDir: {} {{- end }} \ No newline at end of file diff --git a/helm/_backend/templates/pvc.yaml b/helm/_backend/templates/pvc.yaml new file mode 100644 index 00000000..e0a7e1b1 --- /dev/null +++ b/helm/_backend/templates/pvc.yaml @@ -0,0 +1,14 @@ +{{- if .Values.persistence.enabled }} +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: {{ include "app.fullname" . }}-log + labels: + {{- include "app.labels" . | nindent 4 }} +spec: + accessModes: + - ReadWriteMany + resources: + requests: + storage: {{ .Values.persistence.pvcSize }} +{{- end }} \ No newline at end of file diff --git a/helm/_backend/values.yaml b/helm/_backend/values.yaml index 49b9454a..61d4d338 100644 --- a/helm/_backend/values.yaml +++ b/helm/_backend/values.yaml @@ -53,4 +53,8 @@ nodeSelector: {} tolerations: [] -affinity: {} \ No newline at end of file +affinity: {} + +persistence: + enabled: true + pvcSize: 256Mi diff --git a/helm/_hangfire/templates/deployment.yaml b/helm/_hangfire/templates/deployment.yaml index 4f2d3c96..dafa80e9 100644 --- a/helm/_hangfire/templates/deployment.yaml +++ b/helm/_hangfire/templates/deployment.yaml @@ -101,6 +101,9 @@ spec: periodSeconds: 10 successThreshold: 1 failureThreshold: 5 + volumeMounts: + - name: logs + mountPath: /strdss/logs resources: {{- toYaml .Values.resources | nindent 12 }} {{- with .Values.nodeSelector }} @@ -114,4 +117,12 @@ spec: {{- with .Values.tolerations }} tolerations: {{- toYaml . | nindent 8 }} + {{- end }} + volumes: + - name: logs + {{- if .Values.persistence.enabled }} + persistentVolumeClaim: + claimName: {{ include "app.fullname" . }}-log + {{- else }} + emptyDir: {} {{- end }} \ No newline at end of file diff --git a/helm/_hangfire/templates/pvc.yaml b/helm/_hangfire/templates/pvc.yaml new file mode 100644 index 00000000..e0a7e1b1 --- /dev/null +++ b/helm/_hangfire/templates/pvc.yaml @@ -0,0 +1,14 @@ +{{- if .Values.persistence.enabled }} +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: {{ include "app.fullname" . }}-log + labels: + {{- include "app.labels" . | nindent 4 }} +spec: + accessModes: + - ReadWriteMany + resources: + requests: + storage: {{ .Values.persistence.pvcSize }} +{{- end }} \ No newline at end of file diff --git a/helm/_hangfire/values.yaml b/helm/_hangfire/values.yaml index 4c5cb19a..b9134ab9 100644 --- a/helm/_hangfire/values.yaml +++ b/helm/_hangfire/values.yaml @@ -53,4 +53,8 @@ nodeSelector: {} tolerations: [] -affinity: {} \ No newline at end of file +affinity: {} + +persistence: + enabled: true + pvcSize: 256Mi \ No newline at end of file diff --git a/server/StrDss.Api/appsettings.Development.json b/server/StrDss.Api/appsettings.Development.json deleted file mode 100644 index 03017924..00000000 --- a/server/StrDss.Api/appsettings.Development.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "Serilog": { - "Using": [ "Serilog.Sinks.Console", "Serilog.Sinks.File" ], - "MinimumLevel": { - "Default": "Information", - "Override": { - "Microsoft": "Warning", - "System": "Warning" - } - }, - "WriteTo": [ - { - "Name": "Console" - }, - { - "Name": "File", - "Args": { - "path": "logs/app-.log", - "rollingInterval": "Day", - "fileSizeLimitBytes": 10485760, - "rollOnFileSizeLimit": true, - "retainedFileCountLimit": 2, - "shared": true, - "flushToDiskInterval": "00:00:01" - } - } - ] - }, - "AllowedHosts": "*" -} diff --git a/server/StrDss.Api/appsettings.json b/server/StrDss.Api/appsettings.json index 03017924..ff35d4f7 100644 --- a/server/StrDss.Api/appsettings.json +++ b/server/StrDss.Api/appsettings.json @@ -15,7 +15,7 @@ { "Name": "File", "Args": { - "path": "logs/app-.log", + "path": "/strdss/logs/app-.log", "rollingInterval": "Day", "fileSizeLimitBytes": 10485760, "rollOnFileSizeLimit": true, diff --git a/server/StrDss.Hangfire/appsettings.Development.json b/server/StrDss.Hangfire/appsettings.Development.json deleted file mode 100644 index 301fae35..00000000 --- a/server/StrDss.Hangfire/appsettings.Development.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "Serilog": { - "Using": [ "Serilog.Sinks.Console", "Serilog.Sinks.File" ], - "MinimumLevel": { - "Default": "Information", - "Override": { - "Microsoft": "Warning", - "System": "Warning" - } - }, - "WriteTo": [ - { - "Name": "Console" - }, - { - "Name": "File", - "Args": { - "path": "/tmp/hangfire-.log", - "rollingInterval": "Day", - "fileSizeLimitBytes": 10485760, - "rollOnFileSizeLimit": true, - "retainedFileCountLimit": 2, - "shared": true, - "flushToDiskInterval": "00:00:01" - } - } - ] - }, - "AllowedHosts": "*" -} \ No newline at end of file diff --git a/server/StrDss.Hangfire/appsettings.json b/server/StrDss.Hangfire/appsettings.json index ecda8dbf..65b1acb3 100644 --- a/server/StrDss.Hangfire/appsettings.json +++ b/server/StrDss.Hangfire/appsettings.json @@ -15,7 +15,7 @@ { "Name": "File", "Args": { - "path": "logs/hangfire-.log", + "path": "/strdss/logs/app-.log", "rollingInterval": "Day", "fileSizeLimitBytes": 10485760, "rollOnFileSizeLimit": true,