nextcloud

by groundhog2k

Helm chartv0.22.10App 35.0.3

A Helm chart for Nextcloud on Kubernetes

About this chart

Nextcloud

Changelog

see RELEASENOTES.md

A Helm chart for Nextcloud on Kubernetes

TL;DR

helm repo add groundhog2k https://groundhog2k.github.io/helm-charts/
helm install my-release groundhog2k/nextcloud

Introduction

This chart uses the original Nextcloud from Docker to deploy Nextcloud in Kubernetes.

It fully supports deployment of the multi-architecture docker image.

Prerequisites

  • Kubernetes 1.12+
  • Helm 3.x
  • PV provisioner support in the underlying infrastructure

Installing the Chart

To install the chart with the release name my-release:

helm install my-release groundhog2k/nextcloud

Upgrading the Chart

To upgrade the chart or Nextcloud version with the release name my-release:

helm upgrade my-release groundhog2k/nextcloud

Post-upgrade steps

After some Nextcloud version upgrades it's necessary to update database indicies of Nextcloud too. Therefor an post-upgrade step was prepared in this helm chart.

The post upgrade will be started during the Nextcloud/chart upgrade after a delay, which is configurable by setting postUpgradeHook.delay. The default value is 30 seconds.

helm upgrade my-release groundhog2k/nextcloud --set postUpgradeHook.delay=120

Custom *.config.php files

The chart supports adding multiple Nextcloud configuration files by setting file name and value in the customConfigs: section.

Example:

customConfigs:
  region.config.php: |
    <?php
    $CONFIG = array (
      'default_phone_region' => 'DE',
    );

The custom *.config.php files will be copied during a post-install/upgrade hook that can be configured by customConfigsHook: section.

Uninstalling the Chart

To uninstall/delete the my-release deployment:

helm uninstall my-release

Requirements

RepositoryNameVersion
@groundhog2kmariadb0.3.14
@groundhog2kpostgres0.4.8
@groundhog2kredis0.7.10

Common parameters

KeyTypeDefaultDescription
fullnameOverridestring""Fully override the deployment name
nameOverridestring""Partially override the deployment name

Deployment parameters

KeyTypeDefaultDescription
image.pullPolicystring"IfNotPresent"Image pull policy
image.registrystring"docker.io"Image registry
image.repositorystring"nextcloud"Image name
image.tagstring""Image tag
imagePullSecretslist[]Image pull secrets
strategy.typeobject"RollingUpdate"Pod deployment strategy
livenessProbeobjectsee values.yamlLiveness probe configuration
startupProbeobjectsee values.yamlStartup probe configuration
readinessProbeobjectsee values.yamlReadiness probe configuration
customLivenessProbeobject{}Custom liveness probe (overwrites default liveness probe configuration)
customStartupProbeobject{}Custom startup probe (overwrites default startup probe configuration)
customReadinessProbeobject{}Custom readiness probe (overwrites default readiness probe configuration)
resourcesobject{}Resource limits and requests
priorityClassNamestring""Deployment priority class name
nodeSelectorobject{}Deployment node selector
customLabelsobject{}Additional labels for Deployment or StatefulSet
customAnnotationsobject{}Additional annotations for Deployment or StatefulSet
podAnnotationsobject{}Additional pod annotations
podLabelsobject{}Additional pod labels
podSecurityContextobjectsee values.yamlPod security context
securityContextobjectsee values.yamlContainer security context
envlist[]Additional container environmment variables
argslist[]Additional container command arguments
serviceAccount.createboolfalseEnable service account creation
serviceAccount.namestring""Optional name of the service account
serviceAccount.annotationsobject{}Additional service account annotations
affinityobject{}Affinity for pod assignment
tolerationslist[]Tolerations for pod assignment
topologySpreadConstraintsobject{}Topology spread constraints for pods
containerPortint8000Internal container port — use 8000 for Apache mode (default) or 9000 for FPM mode (nginx.enabled: true)
replicaCountint1Number of replicas
initImage.pullPolicystring"IfNotPresent"Init container image pull policy
initImage.registrystring"docker.io"Image registry
initImage.repositorystring"busybox"Default init container image
initImage.tagstring"stable"Init container image tag
postUpgradeHook.enabledbooltrueEnable post upgrade hook
postUpgradeHook.delayint30Delay in seconds before post-upgrade steps are initiated
postUpgradeStepslistsee values.yamlScript with post upgrade steps
customConfigsHook.enabledbooltrueEnable custom configuration copy hook
customConfigsHook.waitBeforeRetryint10Delay before retrying to copy *.config.php files
customConfigsHook.retriesint10Max. number of retries before job fails
revisionHistoryLimitintnilMaximum number of revisions maintained in revision history
podDisruptionBudgetobject{}Pod disruption budget
podDisruptionBudget.minAvailableintnilMinimum number of pods that must be available after eviction
podDisruptionBudget.maxUnavailableintnilMaximum number of pods that can be unavailable after eviction

Nginx sidecar parameters

When nginx.enabled is set to true, the chart switches from the Apache-based image to the PHP-FPM image (nextcloud:*-fpm) and adds an nginx container as a sidecar. The nginx sidecar acts as the HTTP reverse proxy and passes PHP requests to the FPM process via TCP (127.0.0.1:<containerPort>).

Set image.tag explicitly to an FPM image tag (e.g. 34.0.1-fpm) and containerPort to 9000 when enabling this mode.

KeyTypeDefaultDescription
nginx.enabledboolfalseEnable nginx sidecar (switches to FPM+nginx mode)
nginx.image.pullPolicystring"IfNotPresent"Nginx image pull policy
nginx.image.registrystring"docker.io"Nginx image registry
nginx.image.repositorystring"nginx"Nginx image name
nginx.image.tagstring"stable"Nginx image tag
nginx.containerPortint8080HTTP port the nginx sidecar listens on
nginx.resourcesobject{}Resource limits and requests for the nginx sidecar
nginx.securityContextobjectsee values.yamlSecurity context for the nginx sidecar container
nginx.livenessProbeobjectsee values.yamlLiveness probe configuration for the nginx sidecar
nginx.startupProbeobjectsee values.yamlStartup probe configuration for the nginx sidecar
nginx.readinessProbeobjectsee values.yamlReadiness probe configuration for the nginx sidecar
nginx.customLivenessProbeobject{}Custom liveness probe (overwrites default liveness probe for nginx sidecar)
nginx.customStartupProbeobject{}Custom startup probe (overwrites default startup probe for nginx sidecar)
nginx.customReadinessProbeobject{}Custom readiness probe (overwrites default readiness probe for nginx sidecar)

Cron jobs

KeyTypeDefaultDescription
defaultCronJobslist'[1]'Internal planned default cron job
defaultCronJobs[1].namestring"cronphp"Name of the default cron job
defaultCronJobs[1].schedulestring"*/5 * * * *"Schedule for the default cron job (5 minutes)
defaultCronJobs[1].commandstring"php -f /var/www/html/cron.php"Command for default cron.php job
cronJobslist[]List of additional planned cron jobs
cronJobs[].namestringnilName of the cron job
cronJobs[].schedulestringnilSchedule for the cron job
cronJobs[].commandstringnilCommand for planned execution
cronJobs[].affinityobject{}Affinity for pod assignment
cronJobs[].tolerationslist[]Tolerations for pod assignment
cronJobs[].nodeSelectorobject{}Deployment node selector
cronJobs[].resourcesobject{}Resource limits and requests
cronJobs[].annotationsobject{}Additional cron job annotations
cronJobs[].labelsobject{}Additional cron job labels

Service paramters

KeyTypeDefaultDescription
service.portint80Commento HTTP service port
service.typestring"ClusterIP"Service type
service.nodePortintnilThe node port (only relevant for type LoadBalancer or NodePort)
service.clusterIPstringnilThe cluster ip address (only relevant for type LoadBalancer or NodePort)
service.loadBalancerIPstringnilThe load balancer ip address (only relevant for type LoadBalancer)
service.loadBalancerSourceRangeslist[]The list of IP CIDR ranges that are allowed to access the load balancer (only relevent for type LoadBalancer)
service.annotationsobject{}Additional service annotations
service.labelsobject{}Additional service labels

Ingress parameters

KeyTypeDefaultDescription
ingress.enabledboolfalseEnable ingress for Nextcloud service
ingress.classNamestringnilOptional ingress class name
ingress.annotationsobject{}Additional annotations for ingress
ingress.hosts[0].hoststring""Hostname for the ingress endpoint
ingress.labelsobject{}Additional ingress labels
ingress.maxBodySizestring"512m"Maximum body size for post requests

HTTPRoute parameters

KeyTypeDefaultDescription
httpRoute.enabledboolfalseEnable HTTPRoute for the Nextcloud service
httpRoute.annotationsobject{}Additional HTTPRoute annotations
httpRoute.labelsobject{}Additional HTTPRoute labels
httpRoute.parentRefslist[]Gateway parent references (required when httpRoute is enabled and listenerSet is disabled)
httpRoute.hostnameslist[]Hostnames for the HTTPRoute
httpRoute.ruleslistsee values.yamlHTTPRoute rules for the Nextcloud service

ListenerSet parameters

KeyTypeDefaultDescription
listenerSet.enabledboolfalseEnable ListenerSet for Gateway API
listenerSet.annotationsobject{}Additional ListenerSet annotations
listenerSet.labelsobject{}Additional ListenerSet labels
listenerSet.parentRefobject{}Gateway parent reference (required)
listenerSet.listenerslist[]Listeners to attach to the parent Gateway

Network policies

Allows to define optional network policies for ingress and egress The policyTypes will be automatically set

KeyTypeDefaultDescription
networkPolicy.ingressobject{}Ingress network policies
networkPolicy.egressobject{}Egress network policies

Redis session cache

KeyTypeDefaultDescription
externalCache.enabledboolfalseEnable external Redis cache
externalCache.hoststringnilExternal Redis host
externalCache.passwordstringnilExternal Redis password
externalCache.portint6379External Redis port
redis.enabledboolfalseEnable Redis cache deployment (will disable external cache settings)
redis.storagestringnilRedis storage settings

Database settings

KeyTypeDefaultDescription
externalDatabase.hoststringnilExternal database host
externalDatabase.namestring"nextcloud"External database name
externalDatabase.userstringnilExternal database user name
externalDatabase.passwordstringnilExternal database user password
externalDatabase.typestring"sqlite"External database type (mariadb/mysql or postgres - default: sqlite)
mariadb.enabledboolfalseEnable MariaDB deployment (will disable external database settings)
mariadb.settings.arguments[0]string"--character-set-server=utf8mb4"Enable MariaDB UTF8MB4 character set
mariadb.settings.arguments[1]string"--collation-server=utf8mb4_unicode_ci"Enable UTF8MB4 unicode
mariadb.settings.rootPasswordstringnilMariaDB root user password
mariadb.storagestringnilMariaDB storage settings
mariadb.userDatabase.namestringnilMariaDB nextcloud database name
mariadb.userDatabase.passwordstringnilMariaDB nextcloud database user
mariadb.userDatabase.userstringnilMariaDB nextcloud database

Deploy nextcloud with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has nextcloud on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartnextcloud is pinned at v0.22.10 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply