nextcloud / nextcloud/helm

config folder permission

Open
#114 7 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Describe the bug
When I configure configs for the first start in my values.yaml file the permissions of the config folder are set to root:root

Version of Helm and Kubernetes:

$ kubectl version
Client Version: version.Info{Major:"1", Minor:"21", GitVersion:"v1.21.0", GitCommit:"cb303e613a121a29364f75cc67d3d580833a7479", GitTreeState:"clean", BuildDate:"2021-04-08T16:31:21Z", GoVersion:"go1.16.1", Compiler:"gc", Platform:"linux/arm64"}
Server Version: version.Info{Major:"1", Minor:"21", GitVersion:"v1.21.0", GitCommit:"cb303e613a121a29364f75cc67d3d580833a7479", GitTreeState:"clean", BuildDate:"2021-04-08T16:25:06Z", GoVersion:"go1.16.1", Compiler:"gc", Platform:"linux/arm64"}

$ helm version
version.BuildInfo{Version:"v3.5.3", GitCommit:"041ce5a2c17a58be0fcd5f5e16fb3e7e95fea622", GitTreeState:"dirty", GoVersion:"go1.15.8"}

Which chart:
nextcloud:2.6.1

What happened:
I wanted to set overwritehost and overwriteprotocol via an extra config file created in /var/www/html/config/.

What you expected to happen:
nextcloud starts with config.php and custom.config.php

How to reproduce it (as minimally and precisely as possible):
Put the following lines of code into the values.yaml file:

  configs:
    custom.config.php: |-
      <?php
      $CONFIG = array (
         'overwritehost' => '***.duckdns.org',
         'overwriteprotocol' => 'https',
      );

Anything else we need to know:
The following error is seen in logs:

$ kubectl logs -n nextcloud nextcloud-dcc4678d9-gk9pd -f
Initializing nextcloud 19.0.3.1 ...
Initializing finished
New nextcloud instance
Installing with PostgreSQL database
starting nextcloud installation
Cannot write into "config" directory!
This can usually be fixed by giving the webserver write access to the config directory

Or, if you prefer to keep config.php file read only, set the option "config_is_read_only" to true in it.
See https://docs.nextcloud.com/server/19/go.php?to=admin-config
setting trusted domains…
Cannot write into "config" directory!
This can usually be fixed by giving the webserver write access to the config directory

Or, if you prefer to keep config.php file read only, set the option "config_is_read_only" to true in it.
See https://docs.nextcloud.com/server/19/go.php?to=admin-config

After applying the configuration the file/folder permissions looks like:

$ ls -la /ext/persistent/nextcloud/server/
total 36
drwxr-xr-x 9     1000 1000 4096 May  1 22:03 .
drwxr-xr-x 5     1000 1000 4096 May  1 20:11 ..
drwxr-xr-x 2 root     root 4096 May  1 22:03 config
drwxr-xr-x 2 root     root 4096 May  1 22:03 custom_apps
drwxr-xr-x 2 root     root 4096 May  1 22:03 data
drwxr-xr-x 8 www-data root 4096 May  1 22:03 html
drwxr-xr-x 4 root     root 4096 May  1 22:03 root
drwxr-xr-x 2 root     root 4096 May  1 22:03 themes
drwxr-xr-x 2 root     root 4096 May  1 22:03 tmp

$ ls -la /ext/persistent/nextcloud/server/config/
total 8
drwxr-xr-x 2 root root 4096 May  1 22:03 .
drwxr-xr-x 9 1000 1000 4096 May  1 22:03 ..
-rwx------ 1 root root    0 May  1 22:03 .htaccess
-rwx------ 1 root root    0 May  1 22:03 apache-pretty-urls.config.php
-rwx------ 1 root root    0 May  1 22:03 apcu.config.php
-rwx------ 1 root root    0 May  1 22:03 apps.config.php
-rwx------ 1 root root    0 May  1 22:03 autoconfig.php
-rwx------ 1 root root    0 May  1 22:03 custom.config.php
-rwx------ 1 root root    0 May  1 22:03 redis.config.php
-rwx------ 1 root root    0 May  1 22:03 smtp.config.php

As a workaroung I can set the values via extraEnv:

  extraEnv:
    - name: OVERWRITEHOST
      value: "***.duckdns.org"
    - name: OVERWRITEPROTOCOL
      value: https

But this is not how I expect that it should work like.

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 values.yaml and the Helm chart's handling of the configs setting, then reproduce the installation using the issue's example custom.config.php. Trace how the config directory and files are created and compare their ownership with the webserver's required access. Done means the configured files are present and Nextcloud starts without the config-directory permission errors.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.