Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion .github/workflows/lint-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ jobs:

# test the helm chart with imaginary
- name: Imaginary Enabled
helm_args: --namespace nextcloud --skip-clean-up --helm-extra-set-args "--create-namespace --values charts/nextcloud/test-values/imaginary.yaml"
helm_args: |
--namespace nextcloud --skip-clean-up --helm-extra-set-args "--create-namespace --values charts/nextcloud/test-values/imaginary.yaml"
test: true

# test the helm chart with extra manifests
Expand All @@ -103,6 +104,12 @@ jobs:
helm_args: --namespace nextcloud --skip-clean-up --helm-extra-set-args "--create-namespace --values charts/nextcloud/test-values/extra-manifests-map.yaml"
test: true

# test the helm chart with notify push enabled
- name: Notify Push Enabled
helm_args: |
--namespace nextcloud --skip-clean-up --helm-extra-set-args "--create-namespace --values charts/nextcloud/test-values/notify_push.yaml"
testNotifyPush: true

steps:
- name: Checkout
uses: actions/checkout@v7
Expand Down Expand Up @@ -169,6 +176,20 @@ jobs:
kubectl logs --ignore-errors --prefix -l app.kubernetes.io/name=nextcloud
exit $EXIT

- name: Run test for Notify Push
if: matrix.test_cases.testNotifyPush
# applies a kubernetes job that uploads a file and then checks log of finished pod
run: |
EXIT=0
kubectl config set-context --current --namespace=nextcloud
POD=$(kubectl get pods -o name --selector "app.kubernetes.io/component=app")
(kubectl wait --for=condition=Ready --timeout=2m "${POD}" && sleep 60) || EXIT=1
kubectl exec --stdin "${POD}" -c nextcloud -- sh -c '
chsh -s /bin/sh www-data
su -l www-data -c "/var/www/html/occ notify_push:self-test"
' || EXIT=1
exit $EXIT

summary:
runs-on: ubuntu-latest-low
needs: [changes, test]
Expand Down
2 changes: 1 addition & 1 deletion charts/nextcloud/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v2
name: nextcloud
version: 9.2.0
version: 9.3.0
# renovate: image=docker.io/library/nextcloud
appVersion: 34.0.1
description: A file sharing server that puts the control and security of your own data back into your hands.
Expand Down
33 changes: 33 additions & 0 deletions charts/nextcloud/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ helm install my-release nextcloud/nextcloud
- [Headers set on NGINX](#headers-set-on-nginx)
- [Probes Configurations](#probes-configurations)
- [Collabora Configuration](#collabora-configuration)
* [Notify Push](#notify-push)
- [Imaginary](#imaginary)
- [Cron jobs](#cron-jobs)
- [Using the nextcloud docker image auto-configuration via env vars](#using-the-nextcloud-docker-image-auto-configuration-via-env-vars)
Expand Down Expand Up @@ -540,6 +541,38 @@ The nextcloud deployment includes a series of different probes you can use to de
> [!Note]
> If you are getting errors on initialization (such as `Fatal error: require_once(): Failed opening required '/var/www/html/lib/versioncheck.php'`, but you can get other errors as well), a good first step is to try and enable the startupProbe and/or increase the `initialDelaySeconds` for the `livenessProbe` and `readinessProbe` to something much greater (consider using `120` seconds instead of `10`. This is an especially good idea if your cluster is running on older hardware, has a slow internet connection, or you're using a slower storage class, such as NFS that's running with older disks or a slow connection.

### Notify Push

We include an optional Client Push [nextcloud/notify_push](https://github.com/nextcloud/notify_push).


| Parameter | Description | Default |
|----------------------------------------|----------------------------------------------------------------------------------|------------------------|
| `notifyPush.enabled` | Enable another deployment to handle notify_push (sometimes called ClientPush) | `false` |
| `notifyPush.autoSetup` | Setup notify_push on nextcloud per docker-entrypoint-hooks before start | `false` |
| `notifyPush.replicaCount` | Number of notify-push pod replicas to deploy | `1` |
| `notifyPush.image.registry` | notify-push image registry | `docker.io` |
| `notifyPush.image.repository` | notify-push image name | `miles170/notify_push` |
| `notifyPush.image.tag` | notify-push image tag | `v0.7.0` |
| `notifyPush.image.pullPolicy` | notify-push image pull policy | `IfNotPresent` |
| `notifyPush.image.pullSecrets` | notify-push image pull secrets | `[]` |
| `notifyPush.extraEnv` | option additional env (if a external redis is used, you need to set REDIS_URL) | `""` |
| `notifyPush.podAnnotations` | Additional annotations for notify-push pods | `{}` |
| `notifyPush.podLabels` | Additional labels for notify-push pods | `{}` |
| `notifyPush.podSecurityContext` | Optional security context for the notify-push pod | `nil` |
| `notifyPush.securityContext` | Optional security context for the notify-push container | `nil` |
| `notifyPush.resources` | notify-push resources | `{}` |
| `notifyPush.service.type` | notify-push: Kubernetes Service type | `ClusterIP` |
| `notifyPush.service.loadBalancerIP` | Use serviceLoadBalancerIP to request a specific static IP, otherwise leave blank | `nil` |
| `notifyPush.service.nodePort` | notify-push: NodePort for service type NodePort | `nil` |
| `notifyPush.service.annotations` | Additional annotations for service notify-push | `{}` |
| `notifyPush.service.labels` | Additional labels for service notify-push | `{}` |
| `notifyPush.ingress.path` | Add path in default ingress to notify_push service | `/push` |
| `notifyPush.ingress.pathType` | PathType for additional path in default ingress for notify-push path | `Prefix` |

> [!Note]
> notify-push needs an redis (`redis.enabled=true` or `notifyPush.extraEnv=[{name:"REDIS_URL",...}]` )

### Collabora Configuration

This section provides options to enable and configure the Collabora Online server within your deployment. Please ensure to review the [Collabora Online Helm chart documentation](https://github.com/CollaboraOnline/online/tree/master/kubernetes/helm/collabora-online) for additional details and recommended values.
Expand Down
8 changes: 8 additions & 0 deletions charts/nextcloud/files/notify_push.sh.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/sh
/var/www/html/occ app:enable notify_push
/var/www/html/occ config:app:set notify_push base_endpoint --value="http{{ if .Values.ingress.tls }}s{{ end }}://{{ .Values.nextcloud.host }}{{ .Values.notifyPush.ingress.path }}"
{{/*
The command "setup" runs a check, which need a running nextcloud (but we try to configurate it during startup).
So that command always failure and we stuck in bootloop.
/var/www/html/occ notify_push:setup "http{{ if .Values.ingress.tls }}s{{ end }}://{{ .Values.nextcloud.host }}{{ .Values.notifyPush.ingress.path }}"
*/}}
1 change: 0 additions & 1 deletion charts/nextcloud/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,6 @@ Swift as primary object store env vars
{{- end }}
{{- end -}}


{{/*
Create volume mounts for the nextcloud container as well as the cron sidecar container.
*/}}
Expand Down
15 changes: 15 additions & 0 deletions charts/nextcloud/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,12 @@ spec:
{{- end }}
volumeMounts:
{{- include "nextcloud.volumeMounts" . | trim | nindent 12 }}
{{- if and .Values.notifyPush.enabled .Values.notifyPush.autoSetup }}
- name: nextcloud-notify-hooks
mountPath: /docker-entrypoint-hooks.d/before-starting/notify_push.sh
subPath: notify_push.sh
readOnly: true
{{- end }}
{{- range $hook, $shell := .Values.nextcloud.hooks }}
{{- if $shell }}
- name: nextcloud-hooks
Expand Down Expand Up @@ -373,6 +379,15 @@ spec:
configMap:
name: {{ template "nextcloud.fullname" . }}-nginxconfig
{{- end }}
{{- if and .Values.notifyPush.enabled .Values.notifyPush.autoSetup }}
- name: nextcloud-notify-hooks
configMap:
name: {{ template "nextcloud.fullname" . }}-notify-push
defaultMode: 0o755
items:
- key: hook.sh
path: notify_push.sh
{{- end }}
{{- if not (values .Values.nextcloud.hooks | compact | empty) }}
- name: nextcloud-hooks
configMap:
Expand Down
9 changes: 9 additions & 0 deletions charts/nextcloud/templates/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,15 @@ spec:
serviceName: {{ template "nextcloud.fullname" . }}
servicePort: {{ .Values.service.port }}
{{- end }}
{{- if .Values.notifyPush.enabled }}
- path: {{ .Values.notifyPush.ingress.path }}
pathType: {{ .Values.notifyPush.ingress.pathType }}
backend:
service:
name: {{ template "nextcloud.fullname" . }}-notify-push
port:
name: http-websocket
{{- end }}
{{- with .Values.ingress.tls }}
tls:
{{- toYaml . | nindent 4 }}
Expand Down
15 changes: 15 additions & 0 deletions charts/nextcloud/templates/notify_push/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{{- if and .Values.notifyPush.enabled .Values.notifyPush.autoSetup }}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "nextcloud.fullname" . }}-notify-push
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:
hook.sh: |-
{{- tpl (.Files.Get "files/notify_push.sh.tpl" ) . | nindent 4 }}
{{- end }}
65 changes: 65 additions & 0 deletions charts/nextcloud/templates/notify_push/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{{- if .Values.notifyPush.enabled }}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ template "nextcloud.fullname" . }}-notify-push
labels:
{{- include "nextcloud.labels" ( dict "component" "notify-push" "rootContext" $ ) | nindent 4 }}
spec:
replicas: {{ .Values.notifyPush.replicaCount }}
selector:
matchLabels:
{{- include "nextcloud.selectorLabels" ( dict "component" "notify-push" "rootContext" $ ) | nindent 6 }}
template:
metadata:
annotations:
{{- toYaml .Values.notifyPush.podAnnotations | nindent 8 }}
labels:
{{- include "nextcloud.selectorLabels" ( dict "component" "notify-push" "rootContext" $ ) | nindent 8 }}
{{- if .Values.redis.enabled }}
{{ template "nextcloud.redis.fullname" . }}-client: "true"
{{- end }}
{{- with .Values.notifyPush.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
{{- with .Values.notifyPush.image.pullSecrets }}
imagePullSecrets:
{{- range . }}
- name: {{ . }}
{{- end}}
{{- end }}
containers:
- name: notify-push
{{- with .Values.notifyPush.image }}
image: "{{ .registry }}/{{ .repository }}:{{ .tag }}"
imagePullPolicy: {{ .pullPolicy }}
{{- end }}
env:
- name: PORT
value: "7867"
- name: METRICS_PORT
value: "9867"
{{- include "nextcloud.env.database" . | nindent 12 }}
{{- if .Values.redis.enabled }}
{{- include "nextcloud.env.redis" . | nindent 12 }}
{{- end }}
- name: NEXTCLOUD_URL # deployment.namespace.svc.cluster.local
value: "http{{ if .Values.notifyPush.https }}s{{ end }}://{{ template "nextcloud.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local:{{ .Values.service.port }}"
{{- with .Values.notifyPush.extraEnv }}
{{- toYaml . | nindent 12 }}
{{- end }}
ports:
- name: http
containerPort: 7867
- name: metrics
containerPort: 9867
{{- with .Values.notifyPush.resources }}
resources:
{{- toYaml . | nindent 12 }}
{{- end }}
securityContext:
runAsUser: 1000
runAsNonRoot: true
{{- end }}
36 changes: 36 additions & 0 deletions charts/nextcloud/templates/notify_push/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{{- if .Values.notifyPush.enabled }}
{{- with .Values.notifyPush.service }}
---
apiVersion: v1
kind: Service
metadata:
name: {{ template "nextcloud.fullname" $ }}-notify-push
labels:
{{- include "nextcloud.labels" ( dict "component" "notify-push" "rootContext" $ ) | nindent 4 }}
app.kubernetes.io/monitor: enabled
{{- with .labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
type: {{ .type }}
{{- if eq .type "LoadBalancer" }}
{{- with .loadBalancerIP }}
loadBalancerIP: {{ . }}
{{- end }}
{{- end }}
selector:
{{- include "nextcloud.selectorLabels" ( dict "component" "notify-push" "rootContext" $ ) | nindent 4 }}
ports:
- name: http-websocket
port: 80
targetPort: http
# needed for servicemonitor be compatible with main service
- name: http
port: 9100
targetPort: metrics
{{- end }}
{{- end }}
19 changes: 19 additions & 0 deletions charts/nextcloud/test-values/notify_push.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
fullnameOverride: nextcloud

nextcloud:
host: "nextcloud.nextcloud.svc.cluster.local"
trustedDomains:
- 'nextcloud.nextcloud.svc.cluster.local'
- 'nextcloud'

redis:
enabled: true

internalDatabase:
enabled: false
mariadb:
enabled: true

notifyPush:
enabled: true
autoSetup: true
77 changes: 76 additions & 1 deletion charts/nextcloud/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -877,6 +877,81 @@ dnsConfig:
# value: "1"
options: []

# Notify Push (Clientpush)
notifyPush:
# -- Enable another deployment to handle notify_push (sometimes called ClientPush)
# @section -- Notify Push (Clientpush)
enabled: false
# -- Setup notify_push on nextcloud per docker-entrypoint-hooks before start
# @section -- Notify Push (Clientpush)
autoSetup: false

# -- Number of notify-push pod replicas to deploy
# @section -- Notify Push (Clientpush)
replicaCount: 1

image:
# -- notify-push image registry
# @section -- Notify Push (Clientpush)
registry: ghcr.io
# -- notify-push image name
# @section -- Notify Push (Clientpush)
repository: nextcloud/notify_push
# -- notify-push image tag
# @section -- Notify Push (Clientpush)
tag: 1.3.3
# -- notify-push image pull policy
# @section -- Notify Push (Clientpush)
pullPolicy: IfNotPresent
# -- notify-push image pull secrets
# e.g.
# - myRegistrKeySecretName
# @section -- Notify Push (Clientpush)
pullSecrets: []

# -- option additional env (if a external redis is used, you need to set REDIS_URL)
# @section -- Notify Push (Clientpush)
extraEnv: []

# -- Additional annotations for notify-push pods
# @section -- Notify Push (Clientpush)
podAnnotations: {}
# -- Additional labels for notify-push pods
# @section -- Notify Push (Clientpush)
podLabels: {}
# -- Optional security context for the notify-push pod
# @section -- Notify Push (Clientpush)
podSecurityContext: {}

# -- Optional security context for the notify-push container
# @section -- Notify Push (Clientpush)
securityContext: {}
# -- notify-push resources
# @section -- Notify Push (Clientpush)
resources: {}

service:
# -- notify-push: Kubernetes Service type
# @section -- Notify Push (Clientpush)
type: ClusterIP
# -- Use serviceLoadBalancerIP to request a specific static IP, otherwise leave blank
# @section -- Notify Push (Clientpush)
loadBalancerIP:
# -- Additional annotations for service notify-push
# @section -- Notify Push (Clientpush)
annotations: {}
# -- Additional labels for service notify-push
# @section -- Notify Push (Clientpush)
labels: {}

ingress:
# -- Add path in default ingress to notify_push service
# @section -- Notify Push (Clientpush)
path: /push
# -- PathType for additional path in default ingress for notify-push path
# @section -- Notify Push (Clientpush)
pathType: Prefix

imaginary:
# -- Start Imgaginary
enabled: false
Expand Down Expand Up @@ -1032,7 +1107,7 @@ metrics:

prometheus:
## Prometheus Operator ServiceMonitor configuration
## collects data from nextcloud openmetrics and nextcloud-exporter if enabled
## collects data from nextcloud openmetrics, nextcloud-exporter and notify_push if enabled
serviceMonitor:
## @param metrics.serviceMonitor.enabled Create ServiceMonitor Resource for scraping metrics using PrometheusOperator
##
Expand Down
Loading