Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
* Env variable `OWNCLOUD_LOGIN_POLICY_GROUP_FORBID_MAP` for the
`loginPolicy.groupLoginPolicy.forbidMap` config key
[#493](https://github.com/owncloud-docker/base/issues/493)
* Env variable `OWNCLOUD_MEMCACHED_SERVERS` to define multiple memcached
servers (and optional per-server weights)
[#489](https://github.com/owncloud-docker/base/issues/489)

## 2026-07-06

Expand Down
2 changes: 2 additions & 0 deletions ENVIRONMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,8 @@
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_SERVERS=` \
Define multiple memcached servers as a JSON-encoded list of `[host, port]` or `[host, port, weight]` tuples, e.g. `[["mem1",11211,33],["mem2",11211]]`. Overrides the single-server `OWNCLOUD_MEMCACHED_HOST`/`OWNCLOUD_MEMCACHED_PORT` pair when set (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}` \
Expand Down
2 changes: 1 addition & 1 deletion v24.04/overlay/etc/owncloud.d/15-database.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ case ${OWNCLOUD_DB_TYPE} in
;;
esac

if [[ ${OWNCLOUD_MEMCACHED_ENABLED} == "true" ]]; then
if [[ ${OWNCLOUD_MEMCACHED_ENABLED} == "true" ]] && [[ ${OWNCLOUD_MEMCACHED_SERVERS} == "" ]]; then
echo "Waiting for Memcached..."
wait_error=false
wait-for-it -t "${OWNCLOUD_MEMCACHED_STARTUP_TIMEOUT}" "${OWNCLOUD_MEMCACHED_HOST}":"${OWNCLOUD_MEMCACHED_PORT}" || wait_error=true
Expand Down
26 changes: 20 additions & 6 deletions v24.04/overlay/etc/templates/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -906,16 +906,30 @@ function getConfigFromEnv() {

break;
case getenv('OWNCLOUD_MEMCACHED_ENABLED') && getenv('OWNCLOUD_MEMCACHED_ENABLED') === 'true':
// 'memcached_servers' is a list of [host, port] or [host, port, weight]
// tuples. The flat env-var idioms cannot express multiple servers or a
// weight, so multiple servers are passed as a JSON-encoded array, e.g.:
// OWNCLOUD_MEMCACHED_SERVERS='[["mem1",11211,33],["mem2",11211]]'
// When unset, fall back to the single OWNCLOUD_MEMCACHED_HOST/_PORT pair.
$memcachedServers = [
[
getenv('OWNCLOUD_MEMCACHED_HOST'),
getenv('OWNCLOUD_MEMCACHED_PORT'),
],
];

if (getenv('OWNCLOUD_MEMCACHED_SERVERS') != '') {
$servers = json_decode(getenv('OWNCLOUD_MEMCACHED_SERVERS'), true);
if (is_array($servers)) {
$memcachedServers = $servers;
}
}

$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'),
],
],
'memcached_servers' => $memcachedServers,
]);

if (getenv('OWNCLOUD_MEMCACHED_OPTIONS') != '') {
Expand Down