From c7ac02baca7295233178fd4a3473db9d550e4876 Mon Sep 17 00:00:00 2001 From: Cedric Thiebault Date: Tue, 9 Jul 2019 00:22:02 +0200 Subject: [PATCH] [stable/nexcloud] Multiple config.php file (#15212) Use `ConfigMap` & `volumeMounts` to create extra config file in `/var/www/html/config` Signed-off-by: Cedric Thiebault --- stable/nextcloud/Chart.yaml | 2 +- stable/nextcloud/README.md | 29 ++++++++++++++++++++++ stable/nextcloud/templates/config.yaml | 16 ++++++++++++ stable/nextcloud/templates/deployment.yaml | 10 ++++++++ stable/nextcloud/values.yaml | 23 +++++++++++++++++ 5 files changed, 79 insertions(+), 1 deletion(-) create mode 100644 stable/nextcloud/templates/config.yaml diff --git a/stable/nextcloud/Chart.yaml b/stable/nextcloud/Chart.yaml index fa30d50882..39cd96d358 100644 --- a/stable/nextcloud/Chart.yaml +++ b/stable/nextcloud/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v1 name: nextcloud -version: 1.5.0 +version: 1.6.0 appVersion: 16.0.1 description: A file sharing server that puts the control and security of your own data back into your hands. keywords: diff --git a/stable/nextcloud/README.md b/stable/nextcloud/README.md index fbb0e2eedf..6b501384a3 100644 --- a/stable/nextcloud/README.md +++ b/stable/nextcloud/README.md @@ -70,6 +70,7 @@ The following table lists the configurable parameters of the nextcloud chart and | `nextcloud.mail.smtp.authtype` | SMTP authentication method | `LOGIN` | | `nextcloud.mail.smtp.name` | SMTP username | `''` | | `nextcloud.mail.smtp.password` | SMTP password | `''` | +| `nextcloud.configs` | Config files created in `/var/www/html/config`| `{}` | | `internalDatabase.enabled` | Whether to use internal sqlite database | `true` | | `internalDatabase.database` | Name of the existing database | `nextcloud` | | `externalDatabase.enabled` | Whether to use external database | `false` | @@ -157,3 +158,31 @@ To use this functionality, set `cronjob.enabled` parameter to `true` and switch See the [Configuration](#configuration) section for further configuration of the cronjob resource. > **Note**: For the cronjobs to work correctly, ingress must be also enabled (set `ingress.enabled` to `true`) and `nextcloud.host` has to be publicly resolvable. + +## Multiple config.php file + +Nextcloud supports loading configuration parameters from multiple files. +You can add arbitrary files ending with `.config.php` in the `config/` directory. +See [documentation](https://docs.nextcloud.com/server/15/admin_manual/configuration_server/config_sample_php_parameters.html#multiple-config-php-file). + +For example, following config will configure Nextcloud with [S3 as primary storage](https://docs.nextcloud.com/server/13/admin_manual/configuration_files/primary_storage.html#simple-storage-service-s3) by creating file `/var/www/html/config/s3.config.php`: + +```yaml +nextcloud: + configs: + s3.config.php: |- + array( + 'class' => '\\OC\\Files\\ObjectStore\\S3', + 'arguments' => array( + 'bucket' => 'my-bucket', + 'autocreate' => true, + 'key' => 'xxx', + 'secret' => 'xxx', + 'region' => 'us-east-1', + 'use_ssl' => true + ) + ) + ); +``` diff --git a/stable/nextcloud/templates/config.yaml b/stable/nextcloud/templates/config.yaml new file mode 100644 index 0000000000..26e488b394 --- /dev/null +++ b/stable/nextcloud/templates/config.yaml @@ -0,0 +1,16 @@ +{{- if .Values.nextcloud.configs -}} +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ template "nextcloud.fullname" . }}-config + labels: + app.kubernetes.io/name: {{ include "nextcloud.name" . }} + helm.sh/chart: {{ include "nextcloud.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} +data: +{{- range $key, $value := .Values.nextcloud.configs }} + {{ $key }}: |- +{{ $value | indent 4 }} +{{- end }} +{{- end }} diff --git a/stable/nextcloud/templates/deployment.yaml b/stable/nextcloud/templates/deployment.yaml index 75044fa253..b5426a39e7 100644 --- a/stable/nextcloud/templates/deployment.yaml +++ b/stable/nextcloud/templates/deployment.yaml @@ -185,6 +185,11 @@ spec: - name: nextcloud-data mountPath: /var/www/html/themes subPath: themes + {{- range $key, $value := .Values.nextcloud.configs }} + - name: nextcloud-config + mountPath: /var/www/html/config/{{ $key }} + subPath: {{ $key }} + {{- end }} {{- with .Values.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} @@ -205,3 +210,8 @@ spec: {{- else }} emptyDir: {} {{- end }} + {{- if .Values.nextcloud.configs }} + - name: nextcloud-config + configMap: + name: {{ template "nextcloud.fullname" . }}-config + {{- end }} diff --git a/stable/nextcloud/values.yaml b/stable/nextcloud/values.yaml index d664ced68d..aa38fbbfc6 100644 --- a/stable/nextcloud/values.yaml +++ b/stable/nextcloud/values.yaml @@ -75,6 +75,29 @@ nextcloud: authtype: LOGIN name: user password: pass + # Extra config files created in /var/www/html/config/ + # ref: https://docs.nextcloud.com/server/15/admin_manual/configuration_server/config_sample_php_parameters.html#multiple-config-php-file + configs: {} + + # For example, to use S3 as primary storage + # ref: https://docs.nextcloud.com/server/13/admin_manual/configuration_files/primary_storage.html#simple-storage-service-s3 + # + # configs: + # s3.config.php: |- + # array( + # 'class' => '\\OC\\Files\\ObjectStore\\S3', + # 'arguments' => array( + # 'bucket' => 'my-bucket', + # 'autocreate' => true, + # 'key' => 'xxx', + # 'secret' => 'xxx', + # 'region' => 'us-east-1', + # 'use_ssl' => true + # ) + # ) + # ); internalDatabase: enabled: true