From 2c2cf0b81bc73c4862771c13fe16db1265a5e195 Mon Sep 17 00:00:00 2001 From: Stavros kois Date: Thu, 18 Apr 2024 17:34:13 +0300 Subject: [PATCH] nginx conf --- .../charts/nextcloud/ci/basic-values.yaml | 6 +-- .../charts/nextcloud/ci/https-values.yaml | 8 ++-- .../charts/nextcloud/ci/nocmd-values.yaml | 6 +-- .../ix-dev/charts/nextcloud/questions.yaml | 37 ++++++++++++++++++- .../nextcloud/templates/_configuration.tpl | 2 +- .../templates/_nginx-configuration.tpl | 8 ++-- .../charts/nextcloud/templates/_nginx.tpl | 7 ---- library/ix-dev/charts/nextcloud/values.yaml | 8 ++-- 8 files changed, 55 insertions(+), 27 deletions(-) diff --git a/library/ix-dev/charts/nextcloud/ci/basic-values.yaml b/library/ix-dev/charts/nextcloud/ci/basic-values.yaml index beb6ba7078..f94a6c66e3 100644 --- a/library/ix-dev/charts/nextcloud/ci/basic-values.yaml +++ b/library/ix-dev/charts/nextcloud/ci/basic-values.yaml @@ -8,14 +8,14 @@ ncConfig: - smbclient maxUploadLimit: 3 phpMemoryLimit: 512 + +ncNetwork: + webPort: 30001 nginx: proxyTimeouts: 120 useDifferentAccessPort: false externalAccessPort: 80 -ncNetwork: - webPort: 30001 - ncStorage: pgData: type: pvc diff --git a/library/ix-dev/charts/nextcloud/ci/https-values.yaml b/library/ix-dev/charts/nextcloud/ci/https-values.yaml index 86d0520ec4..111f7207b4 100644 --- a/library/ix-dev/charts/nextcloud/ci/https-values.yaml +++ b/library/ix-dev/charts/nextcloud/ci/https-values.yaml @@ -8,14 +8,14 @@ ncConfig: - smbclient maxUploadLimit: 3 phpMemoryLimit: 512 - nginx: - proxyTimeouts: 120 - useDifferentAccessPort: false - externalAccessPort: 80 ncNetwork: webPort: 30001 certificateID: 1 + nginx: + proxyTimeouts: 120 + useDifferentAccessPort: false + externalAccessPort: 80 ncStorage: pgData: diff --git a/library/ix-dev/charts/nextcloud/ci/nocmd-values.yaml b/library/ix-dev/charts/nextcloud/ci/nocmd-values.yaml index 8637be291d..680f8db0bf 100644 --- a/library/ix-dev/charts/nextcloud/ci/nocmd-values.yaml +++ b/library/ix-dev/charts/nextcloud/ci/nocmd-values.yaml @@ -6,14 +6,14 @@ ncConfig: commands: [] maxUploadLimit: 3 phpMemoryLimit: 512 + +ncNetwork: + webPort: 30001 nginx: proxyTimeouts: 120 useDifferentAccessPort: false externalAccessPort: 80 -ncNetwork: - webPort: 30001 - ncStorage: pgData: type: pvc diff --git a/library/ix-dev/charts/nextcloud/questions.yaml b/library/ix-dev/charts/nextcloud/questions.yaml index 670350afcf..15a9366489 100644 --- a/library/ix-dev/charts/nextcloud/questions.yaml +++ b/library/ix-dev/charts/nextcloud/questions.yaml @@ -164,8 +164,43 @@ questions: "null": true $ref: - "definitions/certificate" + - variable: nginx + label: Nginx Configuration + schema: + type: dict + show_if: [["certificateID", "!=", null]] + attrs: + - variable: proxyTimeouts + label: Proxy timeouts (Seconds) + description: | + Applies the timeout to the following settings:
+ - proxy_connect_timeout
+ - proxy_send_timeout
+ - proxy_read_timeout
+ schema: + type: int + min: 30 + default: 60 + required: true + - variable: useDifferentAccessPort + label: Use different port for URL rewrites + description: | + If enabled, the URL rewrite will use [Access Port] defined below instead of the [Node Port].
+ Note that Nextcloud will still listen on the [Node Port]. (Default 9001) + schema: + type: boolean + default: false + - variable: externalAccessPort + label: External Access Port + schema: + type: int + show_if: [["useDifferentAccessPort", "=", true]] + min: 443 + max: 65535 + default: 443 + required: true - - variable: haStorage + - variable: ncStorage label: "" group: Storage Configuration schema: diff --git a/library/ix-dev/charts/nextcloud/templates/_configuration.tpl b/library/ix-dev/charts/nextcloud/templates/_configuration.tpl index c871d38233..90880d784d 100644 --- a/library/ix-dev/charts/nextcloud/templates/_configuration.tpl +++ b/library/ix-dev/charts/nextcloud/templates/_configuration.tpl @@ -60,7 +60,7 @@ secret: TRUSTED_PROXIES: {{ list $svcCidr $clusterCidr "127.0.0.1" | mustUniq | join "," | quote }} {{- if and .Values.ncConfig.host .Values.ncNetwork.webPort }} {{- $overwritehost := .Values.ncConfig.host -}} - {{- if .Values.ncConfig.nginx.useDifferentAccessPort }} + {{- if .Values.ncNetwork.nginx.useDifferentAccessPort }} {{ $overwritehost = (printf "%v:%v" .Values.ncConfig.host .Values.ncNetwork.webPort) }} {{- end }} OVERWRITEHOST: {{ $overwritehost }} diff --git a/library/ix-dev/charts/nextcloud/templates/_nginx-configuration.tpl b/library/ix-dev/charts/nextcloud/templates/_nginx-configuration.tpl index 44acc954ce..cd41c22396 100644 --- a/library/ix-dev/charts/nextcloud/templates/_nginx-configuration.tpl +++ b/library/ix-dev/charts/nextcloud/templates/_nginx-configuration.tpl @@ -12,10 +12,10 @@ scaleCertificate: {{ $useDiffAccessPort := false }} {{ $externalAccessPort := "" }} {{/* Safely access key as it is conditionaly shown */}} - {{ if hasKey .Values.ncConfig "nginx" }} - {{ $useDiffAccessPort = .Values.ncConfig.nginx.useDifferentAccessPort }} - {{ $externalAccessPort = printf ":%v" .Values.ncConfig.nginx.externalAccessPort }} - {{ $timeout = .Values.ncConfig.nginx.proxyTimeouts | default 60 }} + {{ if hasKey .Values.ncNetwork "nginx" }} + {{ $useDiffAccessPort = .Values.ncNetwork.nginx.useDifferentAccessPort }} + {{ $externalAccessPort = printf ":%v" .Values.ncNetwork.nginx.externalAccessPort }} + {{ $timeout = .Values.ncNetwork.nginx.proxyTimeouts | default 60 }} {{ end }} {{/* If its 443, do not append it on the rewrite at all */}} {{ if eq $externalAccessPort ":443" }} diff --git a/library/ix-dev/charts/nextcloud/templates/_nginx.tpl b/library/ix-dev/charts/nextcloud/templates/_nginx.tpl index 5acb0b7ccf..6282209132 100644 --- a/library/ix-dev/charts/nextcloud/templates/_nginx.tpl +++ b/library/ix-dev/charts/nextcloud/templates/_nginx.tpl @@ -26,13 +26,6 @@ workload: - NET_RAW - SETGID - SETUID - {{ with .Values.ncConfig.additionalEnvs }} - envList: - {{ range $env := . }} - - name: {{ $env.name }} - value: {{ $env.value }} - {{ end }} - {{ end }} probes: liveness: enabled: true diff --git a/library/ix-dev/charts/nextcloud/values.yaml b/library/ix-dev/charts/nextcloud/values.yaml index 0b30463a74..82d3763e4f 100644 --- a/library/ix-dev/charts/nextcloud/values.yaml +++ b/library/ix-dev/charts/nextcloud/values.yaml @@ -34,15 +34,15 @@ ncConfig: phpMemoryLimit: 512 opCacheMemoryConsumption: 128 maxExecutionTime: 30 - nginx: - proxyTimeouts: 120 - useDifferentAccessPort: false - externalAccessPort: 80 additionalEnvs: [] ncNetwork: webPort: 9001 certificateID: + nginx: + proxyTimeouts: 120 + useDifferentAccessPort: false + externalAccessPort: 80 ncStorage: pgData: