Commit 253a7443 authored by sonicaj's avatar sonicaj

Update nextcloud version

parent 028523e0
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*~
# Various IDEs
.project
.idea/
*.tmproj
dependencies:
- name: common
repository: file://../../../library/common/2105.0.0
version: 2105.0.0
digest: sha256:11522ab36487826700d7ad0f86f713a4bb5d35248014bcef690fe94acbc09ef6
generated: "2021-05-10T13:07:35.317071+05:00"
apiVersion: v2
name: nextcloud
version: 1.3.0
appVersion: 21.0.2
description: A file sharing server that puts the control and security of your own data back into your hands.
keywords:
- nextcloud
- storage
- http
- web
- php
home: https://nextcloud.com/
icon: https://cdn.rawgit.com/docker-library/docs/defa5ffc7123177acd60ddef6e16bddf694cc35f/nextcloud/logo.svg
sources:
- https://github.com/nextcloud/docker
- https://github.com/nextcloud/helm
upstream_version: 2.3.2
dependencies:
- name: common
repository: file://../../../library/common/2105.0.0
version: 2105.0.0
# nextcloud
[nextcloud](https://nextcloud.com/) is a file sharing server that puts the control and security of your own data back into your hands.
## Introduction
This chart bootstraps an [nextcloud](https://hub.docker.com/_/nextcloud/) deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager.
## Configuration
Please refer to questions.yaml for a detailed overview on supported configurable values.
# nextcloud
[nextcloud](https://nextcloud.com/) is a file sharing server that puts the control and security of your own data back into your hands.
## Official nextcloud image version
## ref: https://hub.docker.com/r/library/nextcloud/tags/
##
image:
repository: nextcloud
tag: 19.0.3-apache
pullPolicy: IfNotPresent
nextcloud:
host: nextcloud.kube.home
username: admin
password: changeme
datadir: /var/www/html/data
strategy: "Recreate"
service:
nodePort: 9001
appVolumeMounts:
nextcloud-data:
emptyDir: true
mountPath: "/var/www"
postgresAppVolumeMounts:
postgres-data:
emptyDir: true
mountPath: "/var/lib/postgresql/data"
postgres-backup:
emptyDir: true
mountPath: "/postgres_backups"
image:
repository: nextcloud
tag: 21.0.2
pullPolicy: IfNotPresent
#!/usr/bin/python3
import json
import os
import sys
def migrate(values):
values.update({
'appVolumeMounts': {
'nextcloud-data': {
'hostPathEnabled': values['nextcloudDataHostPathEnabled'],
**({'hostPath': values['nextcloudHostPath']} if values.get('nextcloudHostPath') else {})
},
},
'updateStrategy': values.get('nextcloud').get('strategy', 'Recreate'),
})
return values
if __name__ == '__main__':
if len(sys.argv) != 2:
exit(1)
if os.path.exists(sys.argv[1]):
with open(sys.argv[1], 'r') as f:
print(json.dumps(migrate(json.loads(f.read()))))
groups:
- name: "Container Images"
description: "Image to be used for container"
- name: "Nextcloud Configuration"
description: "Configuration details for Nextcloud workload"
- name: "Storage"
description: "Configure Storage for Nextcloud"
- name: "Container Configuration"
description: "Configure nextcloud container parameters"
- name: "Postgresql Configuration"
description: "Configure Postgresql for nextcloud"
- name: "Scaling/Upgrade Policy"
description: "Configure how pods are replaced when configuration is upgraded"
- name: "Advanced DNS Settings"
description: "Configure DNS settings"
portals:
web_portal:
protocols:
- "http"
host:
- "$variable-nextcloud.host"
ports:
- "$variable-service.nodePort"
questions:
- variable: dnsConfig
label: "DNS Configuration"
group: "Advanced DNS Settings"
schema:
type: dict
attrs:
- variable: options
label: "DNS Options"
schema:
type: list
items:
- variable: optionsEntry
label: "Option Entry Configuration"
schema:
type: dict
attrs:
- variable: name
label: "Option Name"
schema:
type: string
required: true
- variable: value
label: "Option Value"
schema:
type: string
required: true
- variable: nextcloud
description: "Nextcloud configuration details"
label: "Nextcloud Configuration"
group: "Nextcloud Configuration"
schema:
type: dict
required: true
additional_attrs: true
attrs:
- variable: host
description: "Nextcloud host to create application URLs"
label: "Nextcloud host"
schema:
type: string
$ref:
- "definitions/nodeIP"
- variable: username
label: "Username"
description: "Name of the Nextcloud admin user"
schema:
type: string
default: "admin"
required: true
- variable: password
label: "Password"
description: "Password for the Nextcloud admin user"
schema:
type: string
private: true
default: "changeme"
required: true
- variable: datadir
label: "Nextcloud data directory"
description: "Configures the data directory where nextcloud stores all files from the users"
schema:
type: path
default: "/var/www/html/data"
required: true
# Update strategy
- variable: updateStrategy
description: "Upgrade Policy"
label: "Update Strategy"
group: "Scaling/Upgrade Policy"
schema:
type: string
default: "Recreate"
enum:
- value: "RollingUpdate"
description: "Create new pods and then kill old ones"
- value: "Recreate"
description: "Kill existing pods before creating new ones"
- variable: service
description: "Nextcloud Service Configuration"
label: "Nextcloud Service Configuration"
group: "Nextcloud Configuration"
schema:
type: dict
required: true
attrs:
- variable: nodePort
label: "Node Port to use for Nextcloud"
schema:
type: int
min: 9000
max: 65535
default: 9001
required: true
- variable: appVolumeMounts
label: "Nextcloud Storage"
group: "Storage"
schema:
type: dict
attrs:
- variable: nextcloud-data
label: "Nextcloud Data Volume"
schema:
type: dict
attrs:
- variable: datasetName
label: "Nextcloud Data Volume Name"
schema:
type: string
hidden: true
$ref:
- "normalize/ixVolume"
show_if: [["hostPathEnabled", "=", false]]
default: "ix-nextcloud_data"
editable: false
- variable: mountPath
label: "Nextcloud Data Mount Path"
description: "Path where the volume will be mounted inside the pod"
schema:
type: path
hidden: true
editable: false
default: "/var/www"
- variable: hostPathEnabled
label: "Enable Host Path for Nextcloud Data Volume"
schema:
type: boolean
default: false
show_subquestions_if: true
subquestions:
- variable: hostPath
label: "Host Path for Nextcloud Data Volume"
schema:
type: hostpath
required: true
- variable: extraAppVolumeMounts
label: "Nextcloud Extra Host Path Volumes"
group: "Storage"
schema:
type: list
items:
- variable: extraAppVolume
label: "Nextcloud Host Path Volume"
description: "Add an extra host path volume for nextcloud application"
schema:
type: dict
attrs:
- variable: mountPath
label: "Mount Path in Pod"
description: "Path where the volume will be mounted inside the pod"
schema:
type: path
required: true
- variable: hostPath
label: "Host Path"
description: "Host path"
schema:
type: hostpath
required: true
- variable: postgresAppVolumeMounts
label: "Postgres Storage"
group: "Storage"
schema:
type: dict
hidden: true
attrs:
- variable: postgres-data
label: "Postgres Data Volume"
schema:
type: dict
attrs:
- variable: datasetName
label: "Postgres Data Volume Name"
schema:
type: string
$ref:
- "normalize/ixVolume"
default: "ix-postgres_data"
editable: false
- variable: mountPath
label: "Postgresql Data Mount Path"
description: "Path where the volume will be mounted inside the pod"
schema:
type: path
editable: false
default: "/var/lib/postgresql/data"
- variable: postgres-backup
label: "Postgres Backup Volume"
schema:
type: dict
attrs:
- variable: datasetName
label: "Postgres Backup Volume Name"
schema:
type: string
$ref:
- "normalize/ixVolume"
default: "ix-postgres_backups"
editable: false
- variable: mountPath
label: "Postgresql Backup Mount Path"
description: "Path where the volume will be mounted inside the pod"
schema:
type: path
editable: false
default: "/postgres_backups"
1. Get the nextcloud URL by running:
echo http://{{ .Values.nextcloud.host }}:{{ .Values.service.nodePort }}/
{{/*
Get Nextloud Postgres Database Name
*/}}
{{- define "postgres.DatabaseName" -}}
{{- print "nextcloud" -}}
{{- end -}}
{{- define "postgres.imageName" -}}
{{- print "postgres:13.1" -}}
{{- end -}}
{{/*
Retrieve postgres backup name
This will return a unique name based on revision and chart numbers specified.
*/}}
{{- define "postgres.backupName" -}}
{{- $upgradeDict := .Values.ixChartContext.upgradeMetadata -}}
{{- printf "postgres-backup-from-%s-to-%s-revision-%d" $upgradeDict.oldChartVersion $upgradeDict.newChartVersion (int64 $upgradeDict.preUpgradeRevision) -}}
{{- end }}
{{/*
Retrieve postgres credentials for environment variables configuration
*/}}
{{- define "postgres.envVariableConfiguration" -}}
{{ $envList := list }}
{{ $envList = mustAppend $envList (dict "name" "POSTGRES_USER" "valueFromSecret" true "secretName" "db-details" "secretKey" "db-user") }}
{{ $envList = mustAppend $envList (dict "name" "POSTGRES_PASSWORD" "valueFromSecret" true "secretName" "db-details" "secretKey" "db-password") }}
{{ include "common.containers.environmentVariables" (dict "environmentVariables" $envList) }}
{{- end -}}
{{/*
Retrieve postgres volume configuration
*/}}
{{- define "postgres.volumeConfiguration" -}}
{{ include "common.storage.configureAppVolumes" (dict "appVolumeMounts" .Values.postgresAppVolumeMounts "emptyDirVolumes" .Values.emptyDirVolumes "ixVolumes" .Values.ixVolumes) | nindent 0 }}
{{- end -}}
{{/*
Retrieve postgres volume mounts configuration
*/}}
{{- define "postgres.volumeMountsConfiguration" -}}
{{ include "common.storage.configureAppVolumeMountsInContainer" (dict "appVolumeMounts" .Values.postgresAppVolumeMounts ) | nindent 0 }}
{{- end -}}
apiVersion: v1
kind: ConfigMap
metadata:
name: "postgres-backup-hook-config-map"
annotations:
rollme: {{ randAlphaNum 5 | quote }}
data:
entrypoint.sh: |-
#!/bin/sh
cmd="/docker-entrypoint.sh postgres"
eval "${cmd}" & disown;
until pg_isready; do
sleep 5;
done;
pg_dump -U $POSTGRES_USER -d {{ template "postgres.DatabaseName" . }} > /postgres_backups/$BACKUP_NAME;
{{- if .Values.ixChartContext.isUpgrade -}}
{{ $values := (. | mustDeepCopy) }}
{{ $_ := set $values "common" (dict "nameSuffix" "postgres") }}
apiVersion: batch/v1
kind: Job
metadata:
name: "pre-upgrade-hook2"
annotations:
"helm.sh/hook": pre-upgrade
"helm.sh/hook-weight": "1"
"helm.sh/hook-delete-policy": hook-succeeded
rollme: {{ randAlphaNum 5 | quote }}
spec:
template:
metadata:
name: "pre-upgrade-hook2"
spec:
restartPolicy: Never
serviceAccountName: "{{ template "common.names.serviceAccountName" . }}"
containers:
- name: {{ .Chart.Name }}-postgres-backup
image: {{ template "postgres.imageName" . }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
env: {{ include "postgres.envVariableConfiguration" $values | nindent 10 }}
- name: BACKUP_NAME
value: {{ template "postgres.backupName" . }}
volumeMounts: {{ include "postgres.volumeMountsConfiguration" $values | nindent 10 }}
- name: backup-script-configmap
mountPath: /bin/backup_entrypoint.sh
readOnly: true
subPath: entrypoint.sh
command:
- "/bin/backup_entrypoint.sh"
volumes: {{ include "postgres.volumeConfiguration" $values | nindent 8 }}
- name: backup-script-configmap
configMap:
defaultMode: 0700
name: "postgres-backup-hook-config-map"
{{- end -}}
{{ $postgres_values := (. | mustDeepCopy) }}
{{ $_ := set $postgres_values "common" (dict "nameSuffix" "postgres") }}
{{ include "common.deployment.common_config" . | nindent 0 }}
spec: {{ include "common.deployment.common_spec" . | nindent 2 }}
template: {{ include "common.deployment.pod.metadata" . | nindent 4 }}
spec:
initContainers:
- name: init-postgresdb
image: {{ template "postgres.imageName" . }}
command: ['sh', '-c', "until pg_isready -h {{ template "common.names.fullname" $postgres_values }}; do echo waiting for postgres; sleep 2; done"]
imagePullPolicy: {{ .Values.image.pullPolicy }}
containers:
- name: {{ .Chart.Name }}
{{ include "common.containers.imageConfig" .Values.image | nindent 8 }}
env: {{ include "postgres.envVariableConfiguration" $postgres_values | nindent 10 }}
{{ $envList := list }}
{{ $secretName := (include "common.names.fullname" .) }}
{{ $envList = mustAppend $envList (dict "name" "POSTGRES_HOST" "value" (printf "%s:5432" (include "common.names.fullname" $postgres_values))) }}
{{ $envList = mustAppend $envList (dict "name" "POSTGRES_DB" "value" (include "postgres.DatabaseName" .)) }}
{{ $envList = mustAppend $envList (dict "name" "NEXTCLOUD_DATA_DIR" "value" .Values.nextcloud.datadir) }}
{{ $envList = mustAppend $envList (dict "name" "NEXTCLOUD_TRUSTED_DOMAINS" "value" .Values.nextcloud.host) }}
{{ $envList = mustAppend $envList (dict "name" "NEXTCLOUD_ADMIN_USER" "valueFromSecret" true "secretName" $secretName "secretKey" "nextcloud-username") }}
{{ $envList = mustAppend $envList (dict "name" "NEXTCLOUD_ADMIN_PASSWORD" "valueFromSecret" true "secretName" $secretName "secretKey" "nextcloud-password") }}
{{ include "common.containers.environmentVariables" (dict "environmentVariables" $envList) | nindent 10 }}
ports:
- name: http
containerPort: 80
protocol: TCP
volumeMounts:
- name: nextcloud-data
mountPath: /var/www/
subPath: "root"
- name: nextcloud-data
mountPath: /var/www/html
subPath: "html"
- name: nextcloud-data
mountPath: {{ .Values.nextcloud.datadir }}
subPath: "data"
- name: nextcloud-data
mountPath: /var/www/html/config
subPath: "config"
- name: nextcloud-data
mountPath: /var/www/html/custom_apps
subPath: "custom_apps"
- name: nextcloud-data
mountPath: /var/www/tmp
subPath: "tmp"
- name: nextcloud-data
mountPath: /var/www/html/themes
subPath: "themes"
{{ range $index, $hostPathConfiguration := .Values.extraAppVolumeMounts }}
- name: extrappvolume-{{ $index }}
mountPath: {{ $hostPathConfiguration.mountPath }}
{{ end }}
{{ include "common.networking.dnsConfiguration" .Values | nindent 6 }}
{{ include "common.storage.allAppVolumes" .Values | nindent 6 }}
{{ range $index, $hostPathConfiguration := .Values.extraAppVolumeMounts }}
- name: extrappvolume-{{ $index }}
hostPath:
path: {{ $hostPathConfiguration.hostPath }}
{{ end }}
# Will mount configuration files as www-data (id: 33) for nextcloud
securityContext:
fsGroup: 33
{{- if .Values.ixChartContext.isUpgrade -}}
{{ $values := (. | mustDeepCopy) }}
{{ $_ := set $values "common" (dict "nameSuffix" "postgres") }}
apiVersion: batch/v1
kind: Job
metadata:
name: "pre-upgrade-hook1"
annotations:
"helm.sh/hook": pre-upgrade
"helm.sh/hook-weight": "-1"
"helm.sh/hook-delete-policy": hook-succeeded
rollme: {{ randAlphaNum 5 | quote }}
spec:
template:
metadata:
name: "pre-upgrade-hook1"
spec:
restartPolicy: Never
serviceAccountName: "{{ template "common.names.serviceAccountName" . }}"
containers:
- name: kubectl
image: "bitnami/kubectl:1.19"
command: ["kubectl", "delete" , "deployment", "{{ template "common.names.fullname" . }}", "{{ template "common.names.fullname" $values }}"]
{{- end -}}
{{ $values := (. | mustDeepCopy) }}
{{ $_ := set $values "common" (dict "nameSuffix" "postgres") }}
{{ include "common.deployment.common_config" $values | nindent 0 }}
spec: {{ include "common.deployment.common_spec" $values | nindent 2 }}
template: {{ include "common.deployment.pod.metadata" $values | nindent 4 }}
spec:
containers:
- name: {{ .Chart.Name }}-postgres
image: {{ template "postgres.imageName" . }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
env: {{ include "postgres.envVariableConfiguration" $values | nindent 10 }}
volumeMounts: {{ include "postgres.volumeMountsConfiguration" $values | nindent 10 }}
ports:
- name: postgres-tcp
containerPort: 5432
protocol: TCP
volumes: {{ include "postgres.volumeConfiguration" $values | nindent 8 }}
apiVersion: v1
kind: Secret
metadata:
name: db-details
data:
db-user: postgres
{{- if .Release.IsInstall }}
db-password: {{ randAlphaNum 15 | b64enc | quote }}
{{ else }}
# `index` function is necessary because the property name contains a dash.
# Otherwise (...).data.db_password would have worked too.
db-password: {{ index (lookup "v1" "Secret" .Release.Namespace "db-details").data "db-password" }}
{{ end }}
{{ $ports := list }}
{{ $ports = mustAppend $ports (dict "name" "postgres-tcp" "port" 5432 "targetPort" 5432) }}
{{ $values := (. | mustDeepCopy) }}
{{ $_ := set $values "common" (dict "nameSuffix" "postgres") }}
{{ $_1 := set $values "commonService" (dict "type" "ClusterIP" "ports" $ports ) }}
{{ include "common.classes.service" $values }}
apiVersion: v1
kind: Secret
metadata:
name: {{ template "common.names.fullname" . }}
labels: {{ include "common.labels" . | nindent 4 }}
type: Opaque
data:
nextcloud-username: {{ .Values.nextcloud.username | b64enc | quote }}
{{ if .Values.nextcloud.password }}
nextcloud-password: {{ .Values.nextcloud.password | b64enc | quote }}
{{ else }}
nextcloud-password: {{ randAlphaNum 10 | b64enc | quote }}
{{ end }}
{{ $svc := .Values.service }}
{{ $ports := list }}
{{ $ports = mustAppend $ports (dict "name" "http" "port" 80 "nodePort" $svc.nodePort) }}
{{ $params := . }}
{{ $_ := set $params "commonService" (dict "type" "NodePort" "ports" $ports ) }}
{{ include "common.classes.service" $params }}
{{ include "common.serviceaccount" . | nindent 0 }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: "{{ .Release.Name }}-service-account-role-binding"
subjects:
- kind: ServiceAccount
name: "{{ template "common.names.serviceAccountName" . }}"
namespace: {{ .Release.Namespace }}
roleRef:
kind: Role
name: "{{ .Release.Name }}-service-account-role"
apiGroup: rbac.authorization.k8s.io
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: "{{ .Release.Name }}-service-account-role"
namespace: {{ .Release.Namespace }}
rules:
- apiGroups:
- ""
- "apps"
resources:
- pods
- deployments
verbs:
- delete
- get
- list
## Official nextcloud image version
## ref: https://hub.docker.com/r/library/nextcloud/tags/
##
image:
repository: nextcloud
tag: 19.0.3-apache
pullPolicy: IfNotPresent
nextcloud:
host: nextcloud.kube.home
username: admin
password: changeme
datadir: /var/www/html/data
updateStrategy: "Recreate"
postgresql:
backupVolume:
mountPath: "/postgres_backups"
datasetName: "ix-postgres_backups"
dataVolume:
mountPath: "/var/lib/postgresql/data"
datasetName: "ix-postgres_data"
service:
nodePort: 31000
emptyDirVolumes: true
ixChartContext: {}
environmentVariables: []
appVolumeMounts:
nextcloud-data:
emptyDir: true
mountPath: "/var/www"
postgresAppVolumeMounts:
postgres-data:
emptyDir: true
mountPath: "/var/lib/postgresql/data"
postgres-backup:
emptyDir: true
mountPath: "/postgres_backups"
dnsConfig:
options: []
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment