Files
oam/knowledge base/nextcloud.md
2024-07-20 13:53:22 +02:00

4.9 KiB

NextCloud

Redis is recommended to prevent file locking problems.

Table of contents

  1. TL;DR
  2. Containerized
    1. Official helm chart
  3. Snappy
  4. Further readings
    1. Sources

TL;DR

Setup
Helm
helm repo add 'nextcloud' 'https://nextcloud.github.io/helm/'
helm repo update
helm inspect values 'nextcloud/nextcloud' > 'values.yaml'
helm upgrade -in 'nextcloud' --create-namespace --atomic 'nextcloud' 'nextcloud/nextcloud' -f 'values.yaml'
Real world use cases
docker compose exec -ti -u 33 app /var/www/html/occ db:add-missing-indices
docker compose exec -ti -u 33 app /var/www/html/occ maintenance:repair --include-expensive

Containerized

Use environment variables to inform Nextcloud about internal configuration:

Name Default Description
NEXTCLOUD_ADMIN_USER (not set) Name of the Nextcloud admin user
NEXTCLOUD_ADMIN_PASSWORD (not set) Password for the Nextcloud admin user
NEXTCLOUD_TRUSTED_DOMAINS (not set) Optional space-separated list of domains
REDIS_HOST (not set) Name of the Redis container, or FQDN of the Redis service
REDIS_HOST_PORT 6379 Port for Redis services that run on non-standard ports

Official helm chart

Installation:

  1. add the repository to helm

    helm repo add nextcloud https://nextcloud.github.io/helm/
    helm repo update
    
  2. get the default values from the updated chart

    helm inspect values nextcloud/nextcloud > "$(git rev-parse --show-toplevel)/kubernetes/helm/nextcloud/values.yaml"
    
  3. edit the values to your heart's content

  4. install the server

    helm install --namespace nextcloud nextcloud nextcloud/nextcloud --values kubernetes/helm/nextcloud/values.dev.yaml
    helm install --atomic --create-namespace --namespace nextcloud nextcloud nextcloud/nextcloud --values kubernetes/helm/nextcloud/values.dev.yaml
    

Update the release after changes are made to the values:

helm upgrade --atomic --namespace nextcloud nextcloud nextcloud/nextcloud --values kubernetes/helm/nextcloud/values.dev.yaml

Connect to the server (install with default values):

export POD_NAME=$(kubectl get pods --namespace nextcloud -l "app.kubernetes.io/name=nextcloud,app.kubernetes.io/instance=nextcloud" -o jsonpath="{.items[0].metadata.name}")
kubectl --namespace nextcloud port-forward "${POD_NAME}" 8080:80

default admin user: admin default admin password: changeme

Update the external database connection parameters (install with default values):

export APP_HOST=127.0.0.1
export APP_PASSWORD=$(kubectl get secret --namespace nextcloud nextcloud -o jsonpath="{.data.nextcloud-password}" | base64 --decode)
helm upgrade nextcloud nextcloud/nextcloud \
  --set nextcloud.password=$APP_PASSWORD,nextcloud.host=$APP_HOST,service.type=ClusterIP,mariadb.enabled=false,externalDatabase.user=nextcloud,externalDatabase.database=nextcloud,externalDatabase.host=YOUR_EXTERNAL_DATABASE_HOST

Delete everything:

helm delete --namespace nextcloud nextcloud
kubectl delete namespace --ignore-not-found nextcloud

Snappy

To configure Nextcloud from snap:

  • use nextcloud.occ
  • edit /var/snap/nextcloud/current/nextcloud/config/config.php
  • use the extra configuration options via the snap set command

Further readings

Providers:

Sources