From 4dbe47f1878cd0482f620f34455a5738f01da38b Mon Sep 17 00:00:00 2001 From: Stavros Kois <47820033+stavros-k@users.noreply.github.com> Date: Tue, 19 Apr 2022 13:10:08 +0300 Subject: [PATCH] fix(apps): use proxy on vikunja and fix nocodb request body size (#2511) --- charts/incubator/nocodb/Chart.yaml | 2 +- charts/incubator/nocodb/questions.yaml | 4 +-- .../incubator/nocodb/templates/_secrets.tpl | 20 +++++++++++++ charts/incubator/nocodb/templates/common.yaml | 3 ++ charts/incubator/nocodb/values.yaml | 4 +++ charts/incubator/vikunja/Chart.yaml | 2 +- .../incubator/vikunja/templates/_secrets.tpl | 20 +++++++++++++ .../incubator/vikunja/templates/common.yaml | 20 ++++++++++++- .../vikunja/templates/configmap.yaml | 30 +++++++++++++++++++ charts/incubator/vikunja/values.yaml | 28 ++++++++++++----- 10 files changed, 120 insertions(+), 13 deletions(-) create mode 100644 charts/incubator/nocodb/templates/_secrets.tpl create mode 100644 charts/incubator/vikunja/templates/_secrets.tpl create mode 100644 charts/incubator/vikunja/templates/configmap.yaml diff --git a/charts/incubator/nocodb/Chart.yaml b/charts/incubator/nocodb/Chart.yaml index e9d2a2359cf..30db7e7b80d 100644 --- a/charts/incubator/nocodb/Chart.yaml +++ b/charts/incubator/nocodb/Chart.yaml @@ -26,7 +26,7 @@ name: nocodb sources: - https://hub.docker.com/r/nocodb/nocodb - https://github.com/nocodb/nocodb -version: 0.0.4 +version: 0.0.5 annotations: truecharts.org/catagories: | - productivity diff --git a/charts/incubator/nocodb/questions.yaml b/charts/incubator/nocodb/questions.yaml index 0ad994c6d86..c8aec57c153 100644 --- a/charts/incubator/nocodb/questions.yaml +++ b/charts/incubator/nocodb/questions.yaml @@ -173,8 +173,8 @@ questions: label: "Request Body Size" description: "Request body size limit." schema: - type: int - default: 1048576 + type: string + default: "1MB" - variable: NC_EXPORT_MAX_TIMEOUT label: "Export Max Timeout" description: "After timeout, csv gets downloaded in batches." diff --git a/charts/incubator/nocodb/templates/_secrets.tpl b/charts/incubator/nocodb/templates/_secrets.tpl new file mode 100644 index 00000000000..fa77fcdcbdf --- /dev/null +++ b/charts/incubator/nocodb/templates/_secrets.tpl @@ -0,0 +1,20 @@ +{{/* Define the secrets */}} +{{- define "nocodb.secrets" -}} +--- + +apiVersion: v1 +kind: Secret +type: Opaque +metadata: + name: nocodb-secrets +{{- $nocodbprevious := lookup "v1" "Secret" .Release.Namespace "nocodb-secrets" }} +{{- $auth_jwt_token := "" }} +data: + {{- if $nocodbprevious}} + NC_AUTH_JWT_SECRET: {{ index $nocodbprevious.data "NC_AUTH_JWT_SECRET" }} + {{- else }} + {{- $auth_jwt_token := randAlphaNum 32 }} + NC_AUTH_JWT_SECRET: {{ $auth_jwt_token | b64enc }} + {{- end }} + +{{- end -}} diff --git a/charts/incubator/nocodb/templates/common.yaml b/charts/incubator/nocodb/templates/common.yaml index bba9ff6415d..fbaa7698de4 100644 --- a/charts/incubator/nocodb/templates/common.yaml +++ b/charts/incubator/nocodb/templates/common.yaml @@ -4,5 +4,8 @@ {{/* Render configmap for nocodb */}} {{- include "nocodb.configmap" . }} +{{/* Render secrets for nocodb */}} +{{- include "nocodb.secrets" . }} + {{/* Render the templates */}} {{ include "common.postSetup" . }} diff --git a/charts/incubator/nocodb/values.yaml b/charts/incubator/nocodb/values.yaml index 331eb0a7849..143db66f3c6 100644 --- a/charts/incubator/nocodb/values.yaml +++ b/charts/incubator/nocodb/values.yaml @@ -24,6 +24,10 @@ envValueFrom: secretKeyRef: name: rediscreds key: url + NC_AUTH_JWT_SECRET: + secretKeyRef: + name: nocodb-secrets + key: NC_AUTH_JWT_SECRET envFrom: - configMapRef: diff --git a/charts/incubator/vikunja/Chart.yaml b/charts/incubator/vikunja/Chart.yaml index d1004653933..3978a4ed3fb 100644 --- a/charts/incubator/vikunja/Chart.yaml +++ b/charts/incubator/vikunja/Chart.yaml @@ -25,7 +25,7 @@ maintainers: name: vikunja sources: - https://vikunja.io/docs -version: 0.0.3 +version: 0.0.4 annotations: truecharts.org/catagories: | - productivity diff --git a/charts/incubator/vikunja/templates/_secrets.tpl b/charts/incubator/vikunja/templates/_secrets.tpl new file mode 100644 index 00000000000..d3f96474240 --- /dev/null +++ b/charts/incubator/vikunja/templates/_secrets.tpl @@ -0,0 +1,20 @@ +{{/* Define the secrets */}} +{{- define "vikunja.secrets" -}} +--- + +apiVersion: v1 +kind: Secret +type: Opaque +metadata: + name: vikunja-secrets +{{- $vikunjaprevious := lookup "v1" "Secret" .Release.Namespace "vikunja-secrets" }} +{{- $jwt_secret := "" }} +data: + {{- if $vikunjaprevious}} + VIKUNJA_SERVICE_JWT_SECRET: {{ index $vikunjaprevious.data "VIKUNJA_SERVICE_JWT_SECRET" }} + {{- else }} + {{- $jwt_secret := randAlphaNum 32 }} + VIKUNJA_SERVICE_JWT_SECRET: {{ $jwt_secret | b64enc }} + {{- end }} + +{{- end -}} diff --git a/charts/incubator/vikunja/templates/common.yaml b/charts/incubator/vikunja/templates/common.yaml index a17e923ef88..30e4276f842 100644 --- a/charts/incubator/vikunja/templates/common.yaml +++ b/charts/incubator/vikunja/templates/common.yaml @@ -1 +1,19 @@ -{{- include "common.all" . }} +{{- include "common.setup" . }} + +{{/* Append the general configMap volume to the volumes */}} +{{- define "vikunja.harcodedValues" -}} +persistence: + vikunja-config: + enabled: "true" + mountPath: "/etc/nginx/conf.d/default.conf" + subPath: "nginx-config" + type: "custom" + volumeSpec: + configMap: + name: {{ printf "%v-config" (include "common.names.fullname" .) }} +{{- end -}} +{{- $_ := mergeOverwrite .Values (include "vikunja.harcodedValues" . | fromYaml) -}} + +{{- include "vikunja.secrets" . }} + +{{ include "common.postSetup" . }} diff --git a/charts/incubator/vikunja/templates/configmap.yaml b/charts/incubator/vikunja/templates/configmap.yaml new file mode 100644 index 00000000000..a2854b4365f --- /dev/null +++ b/charts/incubator/vikunja/templates/configmap.yaml @@ -0,0 +1,30 @@ +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "common.names.fullname" . }}-config + labels: + {{- include "common.labels" . | nindent 4 }} +data: + nginx-config: |- + gzip on; + gzip_disable "msie6"; + + gzip_vary on; + gzip_proxied any; + gzip_comp_level 6; + gzip_buffers 16 8k; + gzip_http_version 1.1; + gzip_min_length 256; + gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/vnd.ms-fontobject application/x-font-ttf font/opentype image/svg+xml; + + server { + listen 8080; + server_name localhost; + + location / { + root /app/vikunja/files; + try_files $uri $uri/ /; + index index.html index.htm; + } + } diff --git a/charts/incubator/vikunja/values.yaml b/charts/incubator/vikunja/values.yaml index 87efde3c9f7..1accbd95fb8 100644 --- a/charts/incubator/vikunja/values.yaml +++ b/charts/incubator/vikunja/values.yaml @@ -8,6 +8,10 @@ frontendImage: tag: v0.18.2@sha256:a5b2600ad6854e34d4ded50504b89dc37189ac80140edfbfbcbb25c1124b88ab pullPolicy: IfNotPresent +nginxImage: + repository: tccr.io/truecharts/nginx + tag: v1.21.6@sha256:e530cd55de35803870c5c54ff5140f79807137937f7cfd9841fba73bee83d554 + securityContext: readOnlyRootFilesystem: false runAsNonRoot: false @@ -43,9 +47,6 @@ env: VIKUNJA_RATELIMIT_PERIOD: 60 VIKUNJA_RATELIMIT_LIMIT: 100 -frontendConfig: - VIKUNJA_API_URL: "http://localhost:3456/api/v1" - envValueFrom: VIKUNJA_DATABASE_HOST: secretKeyRef: @@ -63,24 +64,35 @@ envValueFrom: secretKeyRef: name: rediscreds key: redis-password + VIKUNJA_SERVICE_JWT_SECRET: + secretKeyRef: + name: vikunja-secrets + key: VIKUNJA_SERVICE_JWT_SECRET service: main: ports: main: port: 10220 - targetPort: 80 + targetPort: 8080 additionalContainers: frontend: name: frontend image: "{{ .Values.frontendImage.repository }}:{{ .Values.frontendImage.tag }}" - env: - - name: VIKUNJA_API_URL - value: "{{ .Values.frontendConfig.VIKUNJA_API_URL }}" + proxy: + name: proxy + image: "{{ .Values.nginxImage.repository }}:{{ .Values.nginxImage.tag }}" ports: - - containerPort: 80 + - containerPort: 8080 name: main + volumeMounts: + - name: vikunja-config + mountPath: "/etc/nginx/conf.d/default.conf" + subPath: nginx-config + readOnly: true + - name: files + mountPath: "/app/vikunja/files" persistence: files: