Open Kaurin opened 6 months ago
Hoi!
Looks like redis host is templated here: https://github.com/nextcloud/helm/blob/1ae7421fd91a9e3b30f4f3fa27f60e2481dbbd63/charts/nextcloud/templates/_helpers.tpl#L215-L231
And the redis config is templated here if you're using default (which you're not): https://github.com/nextcloud/helm/blob/1ae7421fd91a9e3b30f4f3fa27f60e2481dbbd63/charts/nextcloud/templates/config.yaml#L32-L48
And your custom redis config would be templated here:
According to the above, it should allow your override, unless I'm missing something (which I could be).
Digging a bit further into this...
It looks like redis ssl support in nextcloud/server was added here 3 years ago: https://github.com/nextcloud/server/commit/ed10d85ff36f4fc72eb7c3ba62589105505a999e
but it doesn't look like the ssl_context
options were passed in to the configs above or the one in nextcloud/docker here.
The config.sample.php
for redis under the ssl section in the official nextcloud/server repo shows you may need an additional section. I've included the samples below for you to reference:
config.sample.php
redis sectionsPerhaps you need to try passing in those ssl_context optons to your custom config? Let us know if that helps. Anyone else in the community familiar with this, please feel free to chime in.
This config:
nextcloud:
defaultConfigs:
redis.config.php: false
configs:
redis.config.php: |-
<?php
$CONFIG = array (
'memcache.distributed' => '\OC\Memcache\Redis',
'memcache.locking' => '\OC\Memcache\Redis',
'redis' => array(
'host' => "tls://nextcloud-wrapper-redis-master.default.svc.cluster.local",
'port' => getenv('REDIS_HOST_PORT') ?: 6379,
'password' => getenv('REDIS_HOST_PASSWORD'),
'ssl_context' => [
'verify_peer_name' => false
'local_cert' => '/certs/redis.crt',
'local_pk' => '/certs/redis.key',
'cafile' => '/certs/ca.crt',
],
),
);
extraEnv:
- name: PHP_MEMORY_LIMIT
value: 4096M
- name: PHP_UPLOAD_LIMIT
value: 16G
###### Shelve for now - in case we want to try TLS again
- name: REDIS_HOST_PASSWORD
value: changeme!
redis:
architecture: standalone
enabled: true
auth:
enabled: false
password: changeme!
tls:
enabled: true
authClients: true
autoGenerated: true
Produces this on the webpage itself
Internal Server Error
The server encountered an internal error and was unable to complete your request.
Please contact the server administrator if this error reappears multiple times, please include the technical details below in your report.
More details can be found in the webserver log.
<br />
<b>Parse error</b>: syntax error, unexpected single-quoted string "local_cert", expecting "]" in <b>/var/www/html/config/redis.config.php</b> on line <b>11</b><br />
The good news is that the override is getting interpreted by nextcloud, but I guess it doesn't know what to do with local_cert
?
But due to the fact that redis php is configured also here: https://github.com/nextcloud/docker/blob/7a4823180dc0a8c7d92a5dfb20701b04770c5706/29/apache/entrypoint.sh#L123
and as you can see tcp://
is hardcoded ... not sure it could work no ?
Ah. So fixing this would require changing the docker repo for dockerhub as well as this helm repo. Not sure where to open a feature request for this, or whether just this github issue will suffice
Maybe we could add a way to override the entrypoint by mounting a ConfigMap ? When I read this comment it's not sure we will be able to change the way. The best proposal will be to not have this file managed by entrypoint but by a clean ConfigMap I think.
re: the PHP session handler... Yes, that's configured in the image entrypoint. It's independent of Nextcloud's config since it's a PHP config matter, but it does pull from the same auto-config environment variables.
IIRC though there may be some weirdness there... we'll need to research. tls
is supported by phpredis, but I seem to recall there being some weirdness/lack of TLS support for the session handler with standalone Redis nodes. But maybe that's changed - e.g. phpredis/phpredis#2265
If it's actually changed, their docs don't seem to reflect that:
If it is possible, we can make a change in the image entrypoint to adapt to it.
@Kaurin -
'ssl_context' => [
'verify_peer_name' => false
'local_cert' => '/certs/redis.crt',
'local_pk' => '/certs/redis.key',
'cafile' => '/certs/ca.crt',
],
You're missing a comma after false
.
Describe your Issue
In my example I want to use TLS with the builtin redis. Config overrides get provisioned, but environmnet variables take precedence not allowing my config to use the
tls://
prefix. Instead, the defaulttcp://
prefix is used.Housekeeping
Clean setup, PVCs deleted
Config
Error
Error from
/var/www/html/data/nextcloud.log
(removed "Trace" and "Previous" to save space)Notice
tcp://
instead oftls://
Provisioned configs
Configs look good (not sure why doubled, but OK)
Output:
Environment variables
Environment variables seem to have precedence over configs, rendering configs useless.
Output (notice
tcp://
)Probable culprit
First, the env variables are populated in the helpers file Then,
nextcloud.env
is used in nextcloud containersIf I am correct in saying that nextcloud favors env variables, then this helm chart approach probably has to be reworked so these customizations can actually take place.
Workaround
I thought I could just provision redis separately and just make sure to have the
REDIS_HOST_PASSWORD
inextraEnv
. Unfortunately, this doesn't work either (different error - Redis went away). The workaround might be possible, but I have given up on it for now and will just go without TLS for now.Conclusion
Would be nice if helm logic would allow us to override certain aspects of the redis config.
It would be even nicer if I'm completely wrong here and missing like one line of config :)