nextcloud / nextcloud/helm

Fresh installation default config.php and additional configs don't work as expected together

Open
#449 16 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go Template
Stars
534
Forks
314
Avg merge
42m
Merged PRs (30d)
1

Description

Describe your Issue

I try to install a new Nextcloud instance by using this helm chart and what I want to achieve is to use the default installation behaviour with autoconfig so that I don't have to create my own config.php. For that I thought I can just add my "custom" or "additional" configurations to the configs part of the helm chart.

Expected State

ls /var/www/html/config

  • config.php -> Exists in the folder with the default value
  • custom.config.php -> Exists besides all the other default configs AND config.php to.
Current State

ls /var/www/html/config

  • config.php -> Does not exist anymore
  • custom.config.php -> Exists besides all the other default configs but config.php is gone
image

The thing is when
The problem is I just try to customise a few additional parameters at initial startup. To avoid these warnings and wrong configured alerts in the administration panel:
image

I also already tried to just create my own config.php and mount that to with the configs setting of the helm chart. But when I do this then the config.php is not writable which makes sense but that has to be writable because of a few parameters that has to be updated from Nextcloud during installation and later during upgrades:

<?php
$CONFIG = array (
  'passwordsalt' => 'SUPERSALT',
  'secret' => 'SUPERSECRET',
  'trusted_domains' => 
  array (
    0 => 'localhost',
    1 => 'nextcloud.domain',
  ),
  'datadirectory' => '/var/www/html/data',
  'trusted_proxies' => 'trusted_proxies' => ['10.43.0.0/16'],
  'default_phone_region' => 'CH',
  'version' => '27.0.2.1', // Has to be writable for Nextcloud
  'overwrite.cli.url' => 'http://localhost',
  'dbtableprefix' => 'oc_',
  'installed' => false, // Has to be writable for Nextcloud and must persist
  'instanceid' => '12345',
);

So this is also not the way to go. I also already tried by mounting my own additional volumes and volume mounts and mount my custom config from a ConfigMap. But then the whole /var/www/html/config will stay empty.

So now my question is this really an expected behaviour if yes how can you just easily add some additional Nextcloud settings into this folder without destroying the whole auto install mechanism of this Nextcloud Helm Chart?

Environment

  • Kubernetes distribution: rke2

  • Helm Version (or App that manages helm): helm version 3.11.1

  • Helm Chart Version: 4.3.1

  • values.yaml:

# Define the EXACT nextcloud image
image:
  repository: nextcloud
  tag: 27.0.2-fpm
  pullPolicy: IfNotPresent

# Number of replicas to be deployed
replicaCount: 1

# Cronjob fix: https://github.com/nextcloud/helm/issues/55
lifecycle:
  postStartCommand:
    - "sh"
    - "-c"
    - "apt-get update && apt-get install -y openrc && start-stop-daemon --start --background --pidfile /cron.pid --exec /cron.sh"

# Resources to be allocated to a single pod
resources:
  requests:
    cpu: 2
    memory: 1Gi # 4Gi
  limits:
    cpu: 4
    memory: 2Gi # 4Gi

# Enable persistence using PVC
persistence:
  enabled: true
  size: 16Gi
  nextcloudData:
    enabled: true
    size: 32Gi # Can be extended later

# Main nextcloud configuration
nextcloud:
  host: "<INSTANCE-HOST>"
  username: admin
  password: "<INSTANCE-ADMIN-PASSWORD>"
  phpConfigs:
    www.conf: |-
      [www]
      user = www-data
      group = www-data
      listen = 127.0.0.1:9000
      pm = dynamic
      pm.max_children = 128
      pm.start_servers = 32
      pm.min_spare_servers = 32
      pm.max_spare_servers = 96
# HERE IS THE ISSUE WITH THESE CUSTOM OR ADDITIONAL CONFIGS
  configs:
    custom.config.php: |-
      <?php
      $CONFIG = array (
        'default_phone_region' => 'CH',
        'trusted_proxies' => ['10.43.0.0/16'],
      );
  strategy:
    type: Recreate

# Deactivate internal sqlite database
internalDatabase:
  enabled: false

# Use external postgresql database
externalDatabase:
  enabled: true
  type: postgresql
  host: postgresql
  user: nextcloud
  password: "<POSTGRESQL-USER-PASSWORD>"
  database: nextcloud

# Configure nginx sidecar for FPM
nginx:
  enabled: true
  image:
    repository: nginx
    tag: alpine
    pullPolicy: IfNotPresent
  resources:
    requests:
      cpu: 0.375
      memory: 256Mi
    limits:
      cpu: 1
      memory: 256Mi
  updateStrategy:
    type: Recreate

## PostgreSQL chart configuration
## for more options see https://github.com/bitnami/charts/tree/main/bitnami/postgresql
postgresql:
  enabled: true
  image:
    tag: 15.4.0-debian-11-r45
  auth:
    postgresPassword: "<POSTGRESQL-ROOT-PASSWORD>"
    username: nextcloud
    password: "<POSTGRESQL-USER-PASSWORD>"
    database: nextcloud
  primary:
    persistence:
      enabled: true
      size: 16Gi
    resources:
      requests:
        cpu: 2
        memory: 1Gi # 4Gi
      limits:
        cpu: 4
        memory: 2Gi # 4Gi

## Redis chart configuration
## for more options see https://github.com/bitnami/charts/tree/main/bitnami/redis
redis:
  enabled: true
  architecture: "standalone"
  commonConfiguration: |-
    # Disable appendonly
    appendonly no
  auth:
    enabled: true
    password: "<REDIS-PASSWORD>"
  master:
    persistence:
      enabled: false
    resources:
      requests:
        cpu: 1
        memory: 512Mi # 2Gi
      limits:
        cpu: 2
        memory: 1Gi # 2Gi

## Prometheus Exporter / Metrics
metrics:
  enabled: true
  serviceMonitor:
    enabled: true
  resources:
    requests:
      cpu: 0.25
      memory: 256Mi
    limits:
      cpu: 0.5
      memory: 256Mi

# Ingress Configuration
ingress:
  enabled: true
  annotations:
    kubernetes.io/tls-acme: "true"
    nginx.ingress.kubernetes.io/server-snippet: |-
      server_tokens off;
      proxy_hide_header X-Powered-By;
      rewrite ^/.well-known/webfinger /index.php/.well-known/webfinger last;
      rewrite ^/.well-known/nodeinfo /index.php/.well-known/nodeinfo last;
      rewrite ^/.well-known/host-meta /public.php?service=host-meta last;
      rewrite ^/.well-known/host-meta.json /public.php?service=host-meta-json;
      location = /.well-known/webfinger {
        return 301 $scheme://$host/index.php/.well-known/webfinger;
      }
      location = /.well-known/nodeinfo {
        return 301 $scheme://$host/index.php/.well-known/nodeinfo;
      }
      location = /.well-known/carddav {
        return 301 $scheme://$host/remote.php/dav;
      }
      location = /.well-known/caldav {
        return 301 $scheme://$host/remote.php/dav;
      }
      location = /robots.txt {
        allow all;
        log_not_found off;
        access_log off;
      }
      location ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)/ {
        deny all;
      }
      location ~ ^/(?:autotest|occ|issue|indie|db_|console) {
        deny all;
      }
  tls:
    - secretName: "<INGRESS-SECRET-NAME>"
      hosts:
        - "<INSTANCE-HOST>"

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the provided values.yaml, especially nextcloud.configs, and compare how config.php and custom.config.php appear under /var/www/html/config during a fresh installation. Reproduce the autoconfig setup with the shown Helm values, then trace the chart's config handling. Done means the default config.php persists, custom.config.php is available alongside it, and Nextcloud can still update the required settings.

Written by the indexing model from the issue text.

Assessment

Tech stack
helm, kubernetes, php, postgresql, redis, yaml
Domain
devops, infrastructure
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.