diff --git a/apps/nextcloud/apps_v1_Deployment_nextcloud.yaml b/apps/nextcloud/apps_v1_Deployment_nextcloud.yaml
index 10168ff..4e6abf9 100644
--- a/apps/nextcloud/apps_v1_Deployment_nextcloud.yaml
+++ b/apps/nextcloud/apps_v1_Deployment_nextcloud.yaml
@@ -12,7 +12,7 @@ metadata:
spec:
replicas: 1
strategy:
- type: Recreate
+ type: RollingUpdate
selector:
matchLabels:
app.kubernetes.io/name: nextcloud
@@ -26,7 +26,7 @@ spec:
app.kubernetes.io/component: app
nextcloud-redis-client: "true"
annotations:
- nextcloud-config-hash: a5aae02b1b8278a9c8a2dc143e82d3737fc295f62c34afd617207f37d1b2b438
+ nextcloud-config-hash: c9d560d7e6bc215ec96525af2d0fcee94cef91005ec939e0100dc0fa6999d4c4
php-config-hash: 44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a
nginx-config-hash: 18dd8f905a93ed27f032e9ae68084222ed7e5926f7144cda17b979780f4da54b
spec:
@@ -42,76 +42,12 @@ spec:
- name: POSTGRES_USER
valueFrom:
secretKeyRef:
- name: nextcloud-admin
+ name: nextcloud-db
key: username
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
- name: nextcloud-admin
- key: password
- - name: NEXTCLOUD_ADMIN_USER
- valueFrom:
- secretKeyRef:
- name: nextcloud
- key: nextcloud-username
- - name: NEXTCLOUD_ADMIN_PASSWORD
- valueFrom:
- secretKeyRef:
- name: nextcloud
- key: nextcloud-password
- - name: NEXTCLOUD_TRUSTED_DOMAINS
- value: nextcloud.kube.home
- - name: NEXTCLOUD_DATA_DIR
- value: "/var/www/html/data"
- - name: REDIS_HOST
- value: nextcloud-redis-master
- - name: REDIS_HOST_PORT
- value: "6379"
- - name: REDIS_HOST_PASSWORD
- value: changeme
- resources:
- {}
- volumeMounts:
- - name: nextcloud-main
- mountPath: /var/www/
- subPath: root
- - name: nextcloud-main
- mountPath: /var/www/html
- subPath: html
- - name: nextcloud-main
- mountPath: /var/www/html/data
- subPath: data
- - name: nextcloud-main
- mountPath: /var/www/html/config
- subPath: config
- - name: nextcloud-main
- mountPath: /var/www/html/custom_apps
- subPath: custom_apps
- - name: nextcloud-main
- mountPath: /var/www/tmp
- subPath: tmp
- - name: nextcloud-main
- mountPath: /var/www/html/themes
- subPath: themes
- - name: nextcloud-cron
- image: nextcloud:27.0.0-apache
- imagePullPolicy: IfNotPresent
- command:
- - /cron.sh
- env:
- - name: POSTGRES_HOST
- value:
- - name: POSTGRES_DB
- value: "nextcloud"
- - name: POSTGRES_USER
- valueFrom:
- secretKeyRef:
- name: nextcloud-admin
- key: username
- - name: POSTGRES_PASSWORD
- valueFrom:
- secretKeyRef:
- name: nextcloud-admin
+ name: nextcloud-db
key: password
- name: NEXTCLOUD_ADMIN_USER
valueFrom:
@@ -125,6 +61,8 @@ spec:
key: nextcloud-password
- name: NEXTCLOUD_TRUSTED_DOMAINS
value: nextcloud.kube.home
+ - name: NEXTCLOUD_UPDATE
+ value: "1"
- name: NEXTCLOUD_DATA_DIR
value: "/var/www/html/data"
- name: REDIS_HOST
@@ -157,6 +95,30 @@ spec:
- name: nextcloud-main
mountPath: /var/www/html/themes
subPath: themes
+ - name: nextcloud-config
+ mountPath: /var/www/html/config/locale.config.php
+ subPath: locale.config.php
+ - name: nextcloud-config
+ mountPath: /var/www/html/config/.htaccess
+ subPath: .htaccess
+ - name: nextcloud-config
+ mountPath: /var/www/html/config/apache-pretty-urls.config.php
+ subPath: apache-pretty-urls.config.php
+ - name: nextcloud-config
+ mountPath: /var/www/html/config/apcu.config.php
+ subPath: apcu.config.php
+ - name: nextcloud-config
+ mountPath: /var/www/html/config/apps.config.php
+ subPath: apps.config.php
+ - name: nextcloud-config
+ mountPath: /var/www/html/config/autoconfig.php
+ subPath: autoconfig.php
+ - name: nextcloud-config
+ mountPath: /var/www/html/config/redis.config.php
+ subPath: redis.config.php
+ - name: nextcloud-config
+ mountPath: /var/www/html/config/smtp.config.php
+ subPath: smtp.config.php
- name: nextcloud-nginx
image: "nginx:alpine"
imagePullPolicy: IfNotPresent
@@ -220,6 +182,9 @@ spec:
- name: nextcloud-main
persistentVolumeClaim:
claimName: nextcloud-nextcloud
+ - name: nextcloud-config
+ configMap:
+ name: nextcloud-config
- name: nextcloud-nginx-config
configMap:
name: nextcloud-nginxconfig
diff --git a/apps/nextcloud/datas.tf b/apps/nextcloud/datas.tf
index 6ba751b..096b3fd 100644
--- a/apps/nextcloud/datas.tf
+++ b/apps/nextcloud/datas.tf
@@ -67,42 +67,6 @@ data "kustomization_overlay" "data" {
value: ""
resources:
{}
- - name: nextcloud-cron
- image: "${var.images.nextcloud.registry}/${var.images.nextcloud.repository}:${var.images.nextcloud.tag}"
- imagePullPolicy: "${var.images.nextcloud.pullPolicy}"
- command:
- - /cron.sh
- env:
- - name: POSTGRES_HOST
- value: "${var.instance}-${var.component}"
- - name: POSTGRES_DB
- value: "${var.component}"
- - name: POSTGRES_USER
- valueFrom:
- secretKeyRef:
- name: "${var.component}.${var.instance}-${var.component}.credentials.postgresql.acid.zalan.do"
- - name: POSTGRES_PASSWORD
- valueFrom:
- secretKeyRef:
- name: "${var.component}.${var.instance}-${var.component}.credentials.postgresql.acid.zalan.do"
- - name: NEXTCLOUD_ADMIN_USER
- valueFrom:
- secretKeyRef:
- name: nextcloud
- key: nextcloud-username
- - name: NEXTCLOUD_ADMIN_PASSWORD
- valueFrom:
- secretKeyRef:
- name: nextcloud
- key: nextcloud-password
- - name: NEXTCLOUD_TRUSTED_DOMAINS
- value: nextcloud.kube.home
- - name: REDIS_HOST
- value: "${var.instance}-${var.component}-redis.${var.namespace}.svc"
- - name: REDIS_HOST_PASSWORD
- value: ""
- resources:
- {}
- name: nextcloud-nginx
image: "${var.images.nginx.registry}/${var.images.nginx.repository}:${var.images.nginx.tag}"
imagePullPolicy: "${var.images.nginx.pullPolicy}"
diff --git a/apps/nextcloud/index.yaml b/apps/nextcloud/index.yaml
index 1a7617f..7a44ec1 100644
--- a/apps/nextcloud/index.yaml
+++ b/apps/nextcloud/index.yaml
@@ -6,15 +6,10 @@ metadata:
name: nextcloud
description: null
options:
- domain:
- default: your-company
+ sub-domain:
+ default: cloud
examples:
- - your-company
- type: string
- ingress-class:
- default: traefik
- examples:
- - traefik
+ - cloud
type: string
hpa:
default:
@@ -139,15 +134,30 @@ options:
type: string
type: object
type: object
+ ingress-class:
+ default: traefik
+ examples:
+ - traefik
+ type: string
+ admin:
+ default:
+ name: nextcloud_admin
+ examples:
+ - name: nextcloud_admin
+ properties:
+ name:
+ default: nextcloud_admin
+ type: string
+ type: object
domain-name:
default: your_company.com
examples:
- your_company.com
type: string
- sub-domain:
- default: cloud
+ domain:
+ default: your-company
examples:
- - cloud
+ - your-company
type: string
issuer:
default: letsencrypt-prod
@@ -173,16 +183,6 @@ options:
default: 10Gi
type: string
type: object
- admin:
- default:
- name: nextcloud_admin
- examples:
- - name: nextcloud_admin
- properties:
- name:
- default: nextcloud_admin
- type: string
- type: object
dependencies: []
providers:
kubernetes: true
diff --git a/apps/nextcloud/ingress.tf b/apps/nextcloud/ingress.tf
index 4040793..0fe1a91 100644
--- a/apps/nextcloud/ingress.tf
+++ b/apps/nextcloud/ingress.tf
@@ -1,7 +1,7 @@
locals {
dns-name = "${var.sub-domain}.${var.domain-name}"
dns-names = [local.dns-name]
- middlewares = ["${var.instance}-https"]
+ middlewares = ["${var.instance}-https","${var.instance}-redirectregex"]
service = {
"name" = "${var.component}"
"port" = {
diff --git a/apps/nextcloud/middlewares.tf b/apps/nextcloud/middlewares.tf
new file mode 100644
index 0000000..383adec
--- /dev/null
+++ b/apps/nextcloud/middlewares.tf
@@ -0,0 +1,15 @@
+resource "kubectl_manifest" "redirectregex" {
+ yaml_body = <<-EOF
+apiVersion: traefik.containo.us/v1alpha1
+kind: Middleware
+metadata:
+ name: "${var.instance}-redirectregex"
+ namespace: "${var.namespace}"
+ labels: ${jsonencode(local.common-labels)}
+spec:
+ redirectRegex:
+ permanent: true
+ regex: "https://(.*)/.well-known/(card|cal)dav"
+ replacement: "https://${1}/remote.php/dav/"
+ EOF
+}
diff --git a/apps/nextcloud/v1_ConfigMap_nextcloud-config.yaml b/apps/nextcloud/v1_ConfigMap_nextcloud-config.yaml
new file mode 100644
index 0000000..61126e6
--- /dev/null
+++ b/apps/nextcloud/v1_ConfigMap_nextcloud-config.yaml
@@ -0,0 +1,112 @@
+# Source: nextcloud/templates/config.yaml
+apiVersion: v1
+kind: ConfigMap
+metadata:
+ name: nextcloud-config
+ labels:
+ app.kubernetes.io/name: nextcloud
+ helm.sh/chart: nextcloud-3.5.19
+ app.kubernetes.io/instance: nextcloud
+ app.kubernetes.io/managed-by: Helm
+data:
+ locale.config.php: |-
+ 'fr',
+ 'default_locale' => 'fr_FR',
+ 'default_phone_region' => 'FR',
+ 'logdateformat' => 'F d, Y H:i:s',
+ );
+ .htaccess: |-
+ # line below if for Apache 2.4
+
+ Require all denied
+
+ # line below if for Apache 2.2
+
+ deny from all
+
+ # section for Apache 2.2 and 2.4
+
+ IndexIgnore *
+
+ redis.config.php: |-
+ '\OC\Memcache\Redis',
+ 'memcache.locking' => '\OC\Memcache\Redis',
+ 'redis' => array(
+ 'host' => getenv('REDIS_HOST'),
+ 'port' => getenv('REDIS_HOST_PORT') ?: 6379,
+ 'password' => getenv('REDIS_HOST_PASSWORD'),
+ ),
+ );
+ }
+ apache-pretty-urls.config.php: |-
+ '/',
+ );
+ apcu.config.php: |-
+ '\OC\Memcache\APCu',
+ );
+ apps.config.php: |-
+ array (
+ 0 => array (
+ "path" => OC::$SERVERROOT."/apps",
+ "url" => "/apps",
+ "writable" => false,
+ ),
+ 1 => array (
+ "path" => OC::$SERVERROOT."/custom_apps",
+ "url" => "/custom_apps",
+ "writable" => true,
+ ),
+ ),
+ );
+ autoconfig.php: |-
+ 'smtp',
+ 'mail_smtphost' => getenv('SMTP_HOST'),
+ 'mail_smtpport' => getenv('SMTP_PORT') ?: (getenv('SMTP_SECURE') ? 465 : 25),
+ 'mail_smtpsecure' => getenv('SMTP_SECURE') ?: '',
+ 'mail_smtpauth' => getenv('SMTP_NAME') && getenv('SMTP_PASSWORD'),
+ 'mail_smtpauthtype' => getenv('SMTP_AUTHTYPE') ?: 'LOGIN',
+ 'mail_smtpname' => getenv('SMTP_NAME') ?: '',
+ 'mail_smtppassword' => getenv('SMTP_PASSWORD') ?: '',
+ 'mail_from_address' => getenv('MAIL_FROM_ADDRESS'),
+ 'mail_domain' => getenv('MAIL_DOMAIN'),
+ );
+ }
\ No newline at end of file