feat(config): support multiple memcached servers via OWNCLOUD_MEMCACHED_SERVERS#517
Merged
Merged
Conversation
…ED_SERVERS The memcached config block hard-coded a single [host, port] pair built from OWNCLOUD_MEMCACHED_HOST / OWNCLOUD_MEMCACHED_PORT, with no way to define multiple servers or per-server weights that core's 'memcached_servers' supports. Add OWNCLOUD_MEMCACHED_SERVERS, a JSON-encoded list of [host, port] or [host, port, weight] tuples, reusing the json_decode pattern already used for OWNCLOUD_LOG_CONDITIONS. It overrides the single-server pair when set and falls back to it when unset or when the JSON is invalid, so existing deployments are unaffected. Added to v24.04 only, matching the convention that v20.04/v22.04 are frozen. The container startup readiness probe (wait-for-it in 15-database.sh) still targets HOST:PORT only and is intentionally left unchanged. Closes #489 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: Thomas Müller <1005065+DeepDiver1975@users.noreply.github.com>
976d3f3 to
4ae86e4
Compare
jvillafanez
reviewed
Jul 9, 2026
The startup wait in 15-database.sh probed OWNCLOUD_MEMCACHED_HOST:PORT
whenever memcached was enabled and exited on timeout. With
OWNCLOUD_MEMCACHED_SERVERS set (and HOST left at its default), the
container could fail to start even though the configured servers are
reachable.
Guard the wait with `&& [[ ${OWNCLOUD_MEMCACHED_SERVERS} == "" ]]`,
mirroring how the redis wait is skipped when OWNCLOUD_REDIS_SEEDS is set.
Also drop the now-inaccurate ENVIRONMENT.md note that described the old
probing behaviour as a caveat of the new variable.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Thomas Müller <1005065+DeepDiver1975@users.noreply.github.com>
jvillafanez
approved these changes
Jul 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements Option A from the discussion on #489: adds a single JSON-encoded env var to define multiple memcached servers (with optional per-server weights).
Previously the memcached block in
v24.04/overlay/etc/templates/config.phphard-coded exactly one[host, port]pair fromOWNCLOUD_MEMCACHED_HOST/OWNCLOUD_MEMCACHED_PORT, while ownCloud core'smemcached_serversaccepts a list of[host, port]or[host, port, weight]tuples.Details
OWNCLOUD_MEMCACHED_SERVERS— a JSON-encoded array of tuples, decoded withjson_decode(...)guarded byis_array(the same pattern asOWNCLOUD_LOG_CONDITIONS):[HOST, PORT]pair. Existing single-server deployments are completely unaffected (var is unset by default).v20.04/v22.04templates are frozen and only22.04/24.04are built by CI.wait-for-itin15-database.sh) is skipped whenOWNCLOUD_MEMCACHED_SERVERSis set, mirroring how the redis wait is skipped whenOWNCLOUD_REDIS_SEEDSis set. This avoids the container failing to start by probing the default singleHOST:PORTwhen the real cache is defined via the multi-server list.Verification
php -lpasses;bash -n 15-database.shpasses.php -rdumping$CONFIG['memcached_servers']:['memcached','11211']fallback;memcache.distributed/memcache.lockingstill\OC\Memcache\Memcached.wait-for-it):ENABLED=true+SERVERSunset → waits;ENABLED=true+SERVERSset → skipped;ENABLED=false→ skipped.Closes #489
🤖 Generated with Claude Code