Commit e90915bc authored by Varac's avatar Varac

Merge branch '1-automatically-install-sso-saml-app-after-installing-nextcloud' into 'master'

Resolve "Automatically install Collabora after installing Nextcloud"

Closes #1

See merge request !1
parents 49dab576 d6e38357
values-local.yaml
charts
*.swp
# 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
.vscode/
README.md
apiVersion: v1
appVersion: "1.0"
description: |
A helm chart for installing NextCloud and setting up collabora integration
name: nextcloud-collabora
version: 0.1.0
# What is this?
Installs Nextcloud and Collabora and configures Nextcloud to use Collabora as
its document editor. Depends on the
[Nextcloud](https://github.com/helm/charts/tree/master/stable/nextcloud) and
[Collabora-code](https://github.com/helm/charts/tree/master/stable/collabora-code)
`@stable` charts. For configuration details on those charts, refer to their
documentation.
## Installation
Install with:
```
helm install . --wait
```
**The `--wait` is important!** We need that because of how [helm chart
hooks](https://helm.sh/docs/charts_hooks/#hooks-and-the-release-lifecycle) work:
> Note that if the --wait flag is set, Tiller will wait until all resources are
> in a ready state and will not run the post-install hook until they are ready.
The job in this chart needs the Nextcloud pod to be in a ready state before
being executed.
## Values
The included `values.yaml` file configures Nextcloud to use a Mariadb database,
otherwise the Job can not access the database for plugin installation.
dependencies:
- name: nextcloud
repository: https://kubernetes-charts.storage.googleapis.com
version: 1.0.2
- name: collabora-code
repository: https://kubernetes-charts.storage.googleapis.com
version: 1.0.2
digest: sha256:53d9ba3d4b86bea6e2b7aa480abd03737e623e14cf14275feb27a0ff320a15f6
generated: 2019-04-30T13:00:36.870647752+02:00
dependencies:
- name: nextcloud
version: 1.0.2
repository: "@stable"
tags:
- nextcloud
# Needs https://github.com/helm/charts/pull/13311
- name: collabora-code
version: 1.0.2
repository: "@stable"
tags:
- collabora
- nextcloud
{{- $collabora := index .Values "collabora-code" -}}
Thank you for installing {{ .Chart.Name }}.
Your release is named {{ .Release.Name }}. This chart has installed Nextcloud
with Mariadb enabled and Collabora. Nextcloud is available under a pod starting
with the name {{ .Release.Name }}-nextcloud, the Collabora pod name starts with
{{ .Release.Name }}-office.
Nextcloud has been configured to use Collabora for opening rich text documents,
using the `richdocuments` app. It uses WOPI url:
"https://{{ $collabora.collabora.server_name }}"
To learn more, try:
$ helm status {{ .Release.Name }}
$ helm get {{ .Release.Name }}
{{- $nextcloudname := printf "%s-%s" .Release.Name "nextcloud" | trunc 63 | trimSuffix "-" }}
1. To log into Nextcloud, get the nextcloud URL by running:
{{ if .Values.nextcloud.ingress.enabled }}
echo https://{{ .Values.nextcloud.nextcloud.host }}{{ if .Values.nextcloud.nextcloudPort }}:{{ .Values.nextcloud.nextcloudPort }}{{ end }}/
{{- else if eq .Values.nextcloud.service.type "ClusterIP" }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ $nextcloudname }}" -o jsonpath="{.items[0].metadata.name}")
echo http://127.0.0.1:8080/
kubectl port-forward $POD_NAME 8080:8080
{{- end }}
2. Get your nextcloud login credentials by running:
echo User: {{ .Values.nextcloud.nextcloud.username }}
echo Password: $(kubectl get secret --namespace {{ .Release.Namespace }} {{ $nextcloudname }} -o jsonpath="{.data.nextcloud-password}" | base64 --decode)
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "nextcloud-collabora.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "nextcloud-collabora.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- if contains $name .Release.Name -}}
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "nextcloud-collabora.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
# Work around the fact that we can not index hyphenated names
# (https://github.com/helm/helm/issues/2993)
{{- $collabora := index .Values "collabora-code" }}
apiVersion: batch/v1
kind: Job
metadata:
name: "{{ .Release.Name }}-register-collabora"
labels:
app.kubernetes.io/managed-by: {{ .Release.Service | quote }}
app.kubernetes.io/instance: {{ .Release.Name | quote }}
helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
annotations:
"helm.sh/hook": post-install
"helm.sh/hook-weight": "0"
"helm.sh/hook-delete-policy": hook-succeeded
spec:
template:
metadata:
name: "{{.Release.Name}}"
labels:
app.kubernetes.io/managed-by: {{ .Release.Service | quote }}
app.kubernetes.io/instance: {{.Release.Name | quote }}
helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
spec:
restartPolicy: Never
containers:
- name: {{ .Release.Name }}-register-collabora-job
image: {{ .Values.nextcloud.image.repository }}:{{ .Values.nextcloud.image.tag }}
securityContext:
runAsUser: 33
runAsGroup: 33
fsGroup: 33
command:
- "/bin/bash"
- "-c"
- "echo 'install' && php occ app:install richdocuments && echo 'enable' && php occ app:enable richdocuments && echo 'config 1' && php occ config:app:set richdocuments disable_certificate_verification --value yes && echo 'config 2' && php occ config:app:set richdocuments wopi_url --value https://{{ $collabora.collabora.server_name }}"
volumeMounts:
- name: nextcloud-data
mountPath: /var/www/html/
subPath: root
- name: nextcloud-data
mountPath: /var/www/html/data
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/html/themes
subPath: themes
env:
{{- if .Values.nextcloud.internalDatabase.enabled }}
- name: SQLITE_DATABASE
value: {{ .Values.nextcloud.internalDatabase.name | quote }}
{{- else if .Values.nextcloud.mariadb.enabled }}
- name: MYSQL_HOST
value: {{ template "nextcloud.mariadb.fullname" . }}
- name: MYSQL_DATABASE
value: {{ .Values.nextcloud.mariadb.db.name | quote }}
- name: MYSQL_USER
valueFrom:
secretKeyRef:
name: {{ printf "%s-%s" .Release.Name "db" }}
key: db-username
- name: MYSQL_PASSWORD
valueFrom:
secretKeyRef:
name: {{ printf "%s-%s" .Release.Name "db" }}
key: db-password
{{- else }}
- name: MYSQL_HOST
value: {{ .Values.nextcloud.externalDatabase.host | quote }}
- name: MYSQL_DATABASE
value: {{ .Values.nextcloud.externalDatabase.database | quote }}
- name: MYSQL_USER
valueFrom:
secretKeyRef:
name: {{ printf "%s-%s" .Release.Name "db" }}
key: db-username
- name: MYSQL_PASSWORD
valueFrom:
secretKeyRef:
name: {{ printf "%s-%s" .Release.Name "db" }}
key: db-password
{{- end }}
- name: NEXTCLOUD_ADMIN_USER
valueFrom:
secretKeyRef:
name: {{ printf "%s-%s" .Release.Name "nextcloud" }}
key: nextcloud-username
- name: NEXTCLOUD_ADMIN_PASSWORD
valueFrom:
secretKeyRef:
name: {{ printf "%s-%s" .Release.Name "nextcloud" }}
key: nextcloud-password
- name: NEXTCLOUD_TRUSTED_DOMAINS
value: {{ .Values.nextcloud.nextcloud.host }}
volumes:
- name: nextcloud-data
{{- if .Values.nextcloud.persistence.enabled }}
persistentVolumeClaim:
claimName: {{ if .Values.nextcloud.persistence.existingClaim }}{{ .Values.nextcloud.persistence.existingClaim }}{{- else }}{{ printf "%s-%s" .Release.Name "nextcloud-nextcloud" }}{{- end }}
{{- else }}
emptyDir: {}
{{- end }}
nextcloud:
# Disable use of internal database
internalDatabase:
enabled: false
# Enable and configure MariaDB chart
mariadb:
enabled: true
# Necessary so the chart gets installed (because the requirements.yaml has a
# condition: `condition: mariadb.enabled`). Follow
# https://github.com/helm/helm/issues/5135 for more info.
mariadb:
enabled: true
collabora-code:
livenessProbe:
initialDelaySeconds: 90
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