Skip to content

Commit 0a99180

Browse files
committed
Add documentation and an example
Signed-off-by: Stephan Austermühle <au@hcsd.de>
1 parent 370b130 commit 0a99180

2 files changed

Lines changed: 153 additions & 52 deletions

File tree

charts/nextcloud/README.md

Lines changed: 101 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -11,26 +11,34 @@ helm install my-release nextcloud/nextcloud
1111

1212
## Quick Links
1313

14-
* [Introduction](#introduction)
15-
* [Prerequisites](#prerequisites)
16-
* [Installing the Chart](#installing-the-chart)
17-
* [Uninstalling the Chart](#uninstalling-the-chart)
18-
* [Configuration](#configuration)
19-
* [Database Configurations](#database-configurations)
20-
* [Persistence Configurations](#persistence-configurations)
21-
* [Metrics Configurations](#metrics-configurations)
22-
* [Cron jobs](#cron-jobs)
23-
* [Multiple config.php file](#multiple-configphp-file)
24-
* [Using nginx](#using-nginx)
25-
* [Preserving Source IP](#preserving-source-ip)
26-
* [Hugepages](#hugepages)
27-
* [HPA (Clustering)](#hpa-clustering)
28-
* [Running `occ` commands](#running-occ-commands)
29-
* [Putting Nextcloud into maintanence mode](#putting-nextcloud-into-maintanence-mode)
30-
* [Downloading models for recognize](#downloading-models-for-recognize)
31-
* [Backups](#backups)
32-
* [Upgrades](#upgrades)
33-
* [Troubleshooting](#troubleshooting)
14+
- [TL;DR;](#tldr)
15+
- [Quick Links](#quick-links)
16+
- [Introduction](#introduction)
17+
- [Prerequisites](#prerequisites)
18+
- [Installing the Chart](#installing-the-chart)
19+
- [Uninstalling the Chart](#uninstalling-the-chart)
20+
- [Configuration](#configuration)
21+
- [Database Configurations](#database-configurations)
22+
- [Persistence Configurations](#persistence-configurations)
23+
- [Metrics Configurations](#metrics-configurations)
24+
- [Cron jobs](#cron-jobs)
25+
- [Multiple config.php file](#multiple-configphp-file)
26+
- [Using nginx](#using-nginx)
27+
- [Service discovery with nginx and ingress](#service-discovery-with-nginx-and-ingress)
28+
- [Preserving Source IP](#preserving-source-ip)
29+
- [Hugepages](#hugepages)
30+
- [HPA (Clustering)](#hpa-clustering)
31+
- [Running `occ` commands](#running-occ-commands)
32+
- [Putting Nextcloud into maintanence mode](#putting-nextcloud-into-maintanence-mode)
33+
- [Downloading models for recognize](#downloading-models-for-recognize)
34+
- [Backup Cronjobs](#backup-cronjobs)
35+
- [Logging](#logging)
36+
- [Changing the logging behavior](#changing-the-logging-behavior)
37+
- [Viewing the logs](#viewing-the-logs)
38+
- [Exec into the kubernetes pod:](#exec-into-the-kubernetes-pod)
39+
- [Then look for the `nextcloud.log` file with tail or cat:](#then-look-for-the-nextcloudlog-file-with-tail-or-cat)
40+
- [Copy the log file to your local machine:](#copy-the-log-file-to-your-local-machine)
41+
- [Sharing the logs](#sharing-the-logs)
3442

3543
## Introduction
3644

@@ -137,6 +145,7 @@ The following table lists the configurable parameters of the nextcloud chart and
137145
| `nextcloud.extraVolumeMounts` | specify additional volume mounts for the NextCloud pod | `{}` |
138146
| `nextcloud.securityContext` | Optional security context for the NextCloud container | `nil` |
139147
| `nextcloud.podSecurityContext` | Optional security context for the NextCloud pod (applies to all containers in the pod) | `nil` |
148+
| `nextcloud.backupCronjobs` | specify data volume backup cronjobs ([see below](#backup-cronjobs)) | `[]` |
140149
| `nginx.enabled` | Enable nginx (requires you use php-fpm image) | `false` |
141150
| `nginx.image.repository` | nginx Image name, e.g. use `nginxinc/nginx-unprivileged` for rootless container | `nginx` |
142151
| `nginx.image.tag` | nginx Image tag | `alpine` |
@@ -392,7 +401,7 @@ nginx
392401
393402
### Service discovery with nginx and ingress
394403
395-
For service discovery (CalDAV, CardDAV, webfinger, nodeinfo) to work you need to add redirects to your ingress.
404+
For service discovery (CalDAV, CardDAV, webfinger, nodeinfo) to work you need to add redirects to your ingress.
396405
If you use the [ingress-nginx](https://github.com/kubernetes/ingress-nginx) you can use the following server snippet annotation:
397406
398407
<!-- Keep this in sync with the values.yaml -->
@@ -513,10 +522,79 @@ kubectl exec $NEXTCLOUD_POD -- su -s /bin/sh www-data -c "php occ recognize:down
513522
```
514523
515524
# Backups
516-
Check out the [official Nextcloud backup docs](https://docs.nextcloud.com/server/latest/admin_manual/maintenance/backup.html). For your files, if you're using persistent volumes, and you'd like to back up to s3 backed storage (such as minio), consider using [k8up](https://github.com/k8up-io/k8up) or [velero](https://github.com/vmware-tanzu/velero).
525+
Check out the [official Nextcloud backup docs](https://docs.nextcloud.com/server/latest/admin_manual/maintenance/backup.html). For your files, if you're using persistent volumes, and you'd like to back up to s3 backed storage (such as minio), consider using [k8up](https://github.com/k8up-io/k8up) or [velero](https://github.com/vmware-tanzu/velero).
526+
527+
## Backup Cronjobs
528+
529+
Configure `.nextcloud.backupCronjobs` to install Kubernetes Cronjobs
530+
to backup the Nextcloud data volume. The Helm chart automatically
531+
adds `volumes` and `volumeMounts` to the Cronjobs to make the
532+
Nextcloud data folder accessible at the same paths as the Nextcloud
533+
containers. The Cronjobs also include all `extraVolumes` and
534+
`extraVolumeMounts`.
535+
536+
Example:
537+
538+
```yaml
539+
backupCronjobs:
540+
- name: backup
541+
schedule: "15 * * * *"
542+
concurrencyPolicy: Forbid
543+
startingDeadlineSeconds: 300
544+
successfulJobsHistoryLimit: 3
545+
suspend: false
546+
jobTemplate:
547+
spec:
548+
backoffLimit: 1
549+
ttlSecondsAfterFinished: 300
550+
template:
551+
spec:
552+
restartPolicy: Never
553+
containers:
554+
- name: restic
555+
image: restic/restic:0.16.4
556+
imagePullPolicy: IfNotPresent
557+
command:
558+
- /bin/sh
559+
- -c
560+
- "restic --quiet --json --host nextcloud-data --tag cron backup /var/www/html/data"
561+
env:
562+
- name: RESTIC_CACHE_DIR
563+
value: /run/restic/cache
564+
- name: RESTIC_CACERT
565+
value: /run/secrets/ca-cert/ca.crt
566+
- name: RESTIC_REPOSITORY
567+
valueFrom:
568+
secretKeyRef:
569+
name: nextcloud-restic-repository
570+
key: repository
571+
- name: RESTIC_PASSWORD
572+
valueFrom:
573+
secretKeyRef:
574+
name: nextcloud-restic-repository
575+
key: password
576+
volumeMounts:
577+
- name: ca-cert
578+
mountPath: /run/secrets/ca-cert
579+
readOnly: true
580+
- name: restic-cache
581+
mountPath: /run/restic/cache
582+
readOnly: false
583+
terminationGracePeriodSeconds: 1
584+
volumes:
585+
- name: ca-cert
586+
secret:
587+
secretName: restic-ca-cert
588+
- name: restic-cache
589+
emptyDir: {}
590+
```
591+
592+
⚠️ *Please note that the Helm chart does not provide additional infrastructure (e.g., Kubernetes Secrets) to support backups.*
593+
594+
See the [Kubernetes Cronjobs documentation](https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/) for more information.
517595
518596
# Upgrades
519-
Since this chart utilizes the [nextcloud/docker](https://github.com/nextcloud/docker) image, provided you are using persistent volumes, [upgrades of your Nextcloud server are handled automatically](https://github.com/nextcloud/docker#update-to-a-newer-version) from one version to the next, however, you can only upgrade one major version at a time. For example, if you want to upgrade from version `25` to `27`, you will have to upgrade from version `25` to `26`, then from `26` to `27`. Since our docker tag is set via the [`appVersion` in `Chart.yaml`](https://github.com/nextcloud/helm/blob/main/charts/nextcloud/Chart.yaml#L4), you'll need to make sure you gradually upgrade the helm chart if you have missed serveral app versions.
597+
Since this chart utilizes the [nextcloud/docker](https://github.com/nextcloud/docker) image, provided you are using persistent volumes, [upgrades of your Nextcloud server are handled automatically](https://github.com/nextcloud/docker#update-to-a-newer-version) from one version to the next, however, you can only upgrade one major version at a time. For example, if you want to upgrade from version `25` to `27`, you will have to upgrade from version `25` to `26`, then from `26` to `27`. Since our docker tag is set via the [`appVersion` in `Chart.yaml`](https://github.com/nextcloud/helm/blob/main/charts/nextcloud/Chart.yaml#L4), you'll need to make sure you gradually upgrade the helm chart if you have missed serveral app versions.
520598
521599
⚠️ *Before Upgrading Nextcloud or the attached database, always make sure you take [backups](#backups)!*
522600

charts/nextcloud/values.yaml

Lines changed: 52 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -196,35 +196,58 @@ nextcloud:
196196
# Nextcloud data backup Cronjobs
197197
# See https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/
198198
backupCronjobs: []
199-
# - name: backup
200-
# schedule: "15 * * * *"
201-
# concurrencyPolicy: Forbid
202-
# startingDeadlineSeconds: 300
203-
# successfulJobsHistoryLimit: 3
204-
# suspend: true
205-
# jobTemplate:
206-
# spec:
207-
# backoffLimit: 1
208-
# ttlSecondsAfterFinished: 300
209-
# template:
210-
# spec:
211-
# restartPolicy: OnFailure
212-
# initContainers: []
213-
# containers:
214-
# - name: restic
215-
# image: restic/restic:0.16.4
216-
# imagePullPolicy: IfNotPresent
217-
# command:
218-
# - /bin/sh
219-
# - -c
220-
# - restic backup
221-
# # volumeMounts:
222-
# # - name: privatedir
223-
# # mountPath: /srv/private
224-
# # readOnly: false
225-
# # volumes:
226-
# # - name: privatedir
227-
# # emptyDir: {}
199+
# - name: backup
200+
# schedule: "15 * * * *"
201+
# concurrencyPolicy: Forbid
202+
# startingDeadlineSeconds: 300
203+
# successfulJobsHistoryLimit: 3
204+
# suspend: true
205+
# jobTemplate:
206+
# spec:
207+
# backoffLimit: 1
208+
# ttlSecondsAfterFinished: 300
209+
# template:
210+
# spec:
211+
# restartPolicy: Never
212+
# containers:
213+
# - name: restic
214+
# image: restic/restic:0.16.4
215+
# imagePullPolicy: IfNotPresent
216+
# command:
217+
# - /bin/sh
218+
# - -c
219+
# - "restic --quiet --json --host nextcloud-data --tag cron backup /var/www/html/data"
220+
# env:
221+
# - name: TZ
222+
# value: "Europe/Berlin"
223+
# - name: RESTIC_CACHE_DIR
224+
# value: /run/restic/cache
225+
# - name: RESTIC_CACERT
226+
# value: /run/secrets/ca-cert/ca.crt
227+
# - name: RESTIC_REPOSITORY
228+
# valueFrom:
229+
# secretKeyRef:
230+
# name: nextcloud-restic-repository
231+
# key: repository
232+
# - name: RESTIC_PASSWORD
233+
# valueFrom:
234+
# secretKeyRef:
235+
# name: nextcloud-restic-repository
236+
# key: password
237+
# volumeMounts:
238+
# - name: ca-cert
239+
# mountPath: /run/secrets/ca-cert
240+
# readOnly: true
241+
# - name: restic-cache
242+
# mountPath: /run/restic/cache
243+
# readOnly: false
244+
# terminationGracePeriodSeconds: 1
245+
# volumes:
246+
# - name: ca-cert
247+
# secret:
248+
# secretName: restic-ca-cert
249+
# - name: restic-cache
250+
# emptyDir: {}
228251

229252
# Extra mounts for the pods. Example shown is for connecting a legacy NFS volume
230253
# to NextCloud pods in Kubernetes. This can then be configured in External Storage

0 commit comments

Comments
 (0)