From fef85c8bcc593fed642efbbba68c03536d6d9482 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= <1005065+DeepDiver1975@users.noreply.github.com> Date: Fri, 12 Jun 2026 13:53:44 +0200 Subject: [PATCH] feat(config): restore memcached env vars in v24.04 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR #475 added missing env vars to v24.04 but as a side effect partially removed the memcached configuration that v20.04 and v22.04 still ship, leaving v24.04 in an inconsistent state: OWNCLOUD_MEMCACHE_LOCAL survived while the OWNCLOUD_MEMCACHED_* connection vars, the OWNCLOUD_MEMCACHE_LOCKING var, and the whole memcached distributed-cache switch case were gone -- yet owncloud.d/15-database.sh still kept a "Waiting for Memcached..." block referencing the now-undeclared vars. Restore full parity with v20.04/v22.04: - 20-memcached.sh: the 5 OWNCLOUD_MEMCACHED_* declarations - 85-others.sh: OWNCLOUD_MEMCACHE_LOCKING declaration - config.php: memcache.locking block and the OWNCLOUD_MEMCACHED_ENABLED distributed-cache switch case - ENVIRONMENT.md: the corresponding documentation entries Note: the php-memcached extension must be added to all owncloud-docker/php images for this config to be functional at runtime; tracked separately. Co-Authored-By: Claude Opus 4.8 Signed-off-by: Thomas Müller <1005065+DeepDiver1975@users.noreply.github.com> --- ENVIRONMENT.md | 12 +++++++++ .../overlay/etc/entrypoint.d/20-memcached.sh | 15 +++++++++++ v24.04/overlay/etc/entrypoint.d/85-others.sh | 3 +++ v24.04/overlay/etc/templates/config.php | 26 +++++++++++++++++++ 4 files changed, 56 insertions(+) diff --git a/ENVIRONMENT.md b/ENVIRONMENT.md index 0fc108c..64cea02 100644 --- a/ENVIRONMENT.md +++ b/ENVIRONMENT.md @@ -209,8 +209,20 @@ Developer option to connect to Marketplace testing instances. - `OWNCLOUD_MARKETPLACE_KEY=${OWNCLOUD_MARKETPLACE_APIKEY}` \ Developer option to get access to unreleased Apps in your Marketplace account. +- `OWNCLOUD_MEMCACHED_ENABLED=false` \ + Enabled memory caching via memcached (see [documentation](https://doc.owncloud.com/server/latest/admin_manual/configuration/server/config_sample_php_parameters.html#memory-caching-backend-for-distributed-data)). +- `OWNCLOUD_MEMCACHED_HOST=memcached` \ + Defines the hosts for memcached (see [documentation](https://doc.owncloud.com/server/latest/admin_manual/configuration/server/config_sample_php_parameters.html#define-server-details-for-memcached-servers-to-use-for-memory-caching)). +- `OWNCLOUD_MEMCACHED_OPTIONS=` \ + Define connection options for memcached (see [documentation](https://doc.owncloud.com/server/latest/admin_manual/configuration/server/config_sample_php_parameters.html#define-connection-options-for-memcached)). +- `OWNCLOUD_MEMCACHED_PORT=11211` \ + Defines the ports for memcached (see [documentation](https://doc.owncloud.com/server/latest/admin_manual/configuration/server/config_sample_php_parameters.html#define-server-details-for-memcached-servers-to-use-for-memory-caching)). +- `OWNCLOUD_MEMCACHED_STARTUP_TIMEOUT=180` \ + Time to wait for a successful connection to the memcached service on container startup. - `OWNCLOUD_MEMCACHE_LOCAL=${OWNCLOUD_CACHING_CLASS:-\\OC\\Memcache\\APCu}` \ Memory caching backend for locally stored data (see [documentation](https://doc.owncloud.com/server/latest/admin_manual/configuration/server/config_sample_php_parameters.html#memory-caching-backend-for-locally-stored-data)). +- `OWNCLOUD_MEMCACHE_LOCKING=` \ + Define the memory caching backend for file locking (see [documentation](https://doc.owncloud.com/server/latest/admin_manual/configuration/server/config_sample_php_parameters.html#define-the-memory-caching-backend-for-file-locking)). - `OWNCLOUD_METRICS_SHARED_SECRET=` \ Secret required to access the Metrics dashboard (Enterprise only) (see [documentation](https://doc.owncloud.com/server/latest/admin_manual/configuration/server/config_apps_sample_php_parameters.html#app-metrics)). - `OWNCLOUD_MAX_EXECUTION_TIME=3600` \ diff --git a/v24.04/overlay/etc/entrypoint.d/20-memcached.sh b/v24.04/overlay/etc/entrypoint.d/20-memcached.sh index 007807b..83cf171 100755 --- a/v24.04/overlay/etc/entrypoint.d/20-memcached.sh +++ b/v24.04/overlay/etc/entrypoint.d/20-memcached.sh @@ -1,3 +1,18 @@ #!/usr/bin/env bash +declare -x OWNCLOUD_MEMCACHED_ENABLED +[[ -z "${OWNCLOUD_MEMCACHED_ENABLED}" ]] && OWNCLOUD_MEMCACHED_ENABLED="false" + +declare -x OWNCLOUD_MEMCACHED_HOST +[[ -z "${OWNCLOUD_MEMCACHED_HOST}" ]] && OWNCLOUD_MEMCACHED_HOST="memcached" + +declare -x OWNCLOUD_MEMCACHED_PORT +[[ -z "${OWNCLOUD_MEMCACHED_PORT}" ]] && OWNCLOUD_MEMCACHED_PORT="11211" + +declare -x OWNCLOUD_MEMCACHED_OPTIONS +[[ -z "${OWNCLOUD_MEMCACHED_OPTIONS}" ]] && OWNCLOUD_MEMCACHED_OPTIONS="" + +declare -x OWNCLOUD_MEMCACHED_STARTUP_TIMEOUT +[[ -z "${OWNCLOUD_MEMCACHED_STARTUP_TIMEOUT}" ]] && OWNCLOUD_MEMCACHED_STARTUP_TIMEOUT="180" + true diff --git a/v24.04/overlay/etc/entrypoint.d/85-others.sh b/v24.04/overlay/etc/entrypoint.d/85-others.sh index 1ea2097..b735c56 100755 --- a/v24.04/overlay/etc/entrypoint.d/85-others.sh +++ b/v24.04/overlay/etc/entrypoint.d/85-others.sh @@ -231,6 +231,9 @@ declare -x OWNCLOUD_MAX_FILESIZE_ANIMATED_GIFS_PUBLIC_SHARING declare -x OWNCLOUD_FILELOCKING_TTL [[ -z "${OWNCLOUD_FILELOCKING_TTL}" ]] && OWNCLOUD_FILELOCKING_TTL="" +declare -x OWNCLOUD_MEMCACHE_LOCKING +[[ -z "${OWNCLOUD_MEMCACHE_LOCKING}" ]] && OWNCLOUD_MEMCACHE_LOCKING="" + declare -x OWNCLOUD_UPGRADE_AUTOMATIC_APP_UPDATES [[ -z "${OWNCLOUD_UPGRADE_AUTOMATIC_APP_UPDATES}" ]] && OWNCLOUD_UPGRADE_AUTOMATIC_APP_UPDATES="" diff --git a/v24.04/overlay/etc/templates/config.php b/v24.04/overlay/etc/templates/config.php index 927f976..803ddbe 100644 --- a/v24.04/overlay/etc/templates/config.php +++ b/v24.04/overlay/etc/templates/config.php @@ -486,6 +486,10 @@ function getConfigFromEnv() { $config['filelocking.ttl'] = (int) getenv('OWNCLOUD_FILELOCKING_TTL'); } + if (getenv('OWNCLOUD_MEMCACHE_LOCKING') != '') { + $config['memcache.locking'] = getenv('OWNCLOUD_MEMCACHE_LOCKING'); + } + if (getenv('OWNCLOUD_UPGRADE_AUTOMATIC_APP_UPDATES') != '') { $config['upgrade.automatic-app-update'] = getenv('OWNCLOUD_UPGRADE_AUTOMATIC_APP_UPDATES') === 'true'; } @@ -798,6 +802,28 @@ function getConfigFromEnv() { } } + break; + case getenv('OWNCLOUD_MEMCACHED_ENABLED') && getenv('OWNCLOUD_MEMCACHED_ENABLED') === 'true': + $config = array_merge_recursive($config, [ + 'memcache.distributed' => '\OC\Memcache\Memcached', + 'memcache.locking' => '\OC\Memcache\Memcached', + + 'memcached_servers' => [ + [ + getenv('OWNCLOUD_MEMCACHED_HOST'), + getenv('OWNCLOUD_MEMCACHED_PORT'), + ], + ], + ]); + + if (getenv('OWNCLOUD_MEMCACHED_OPTIONS') != '') { + parse_str(getenv('OWNCLOUD_MEMCACHED_OPTIONS'), $opts); + + foreach($opts as $key => $value) { + $config['memcached_options'][constant($key)] = $value; + } + } + break; }