Files
computer-playbook/roles/web-app-nextcloud/templates/config/memcache.config.php.j2
kevinveenbirkenbachandClaude Fable 5 b73706c022 fix(web-app-nextcloud): converge on swarm and run multi-node fpm safely
The fpm/cron occ-status healthcheck rendered a 30s start_period, far shorter
than the (image-serialized) first-boot init, so swarm killed every task with
exit 137 mid-init and the stack never converged. Give both healthchecks a 10m
start_period and raise swarm_stack_converge_retries to 600.

The nextcloud image already serializes first boot across replicas (its own
init lock), so unpin fpm from replicas: 1 and let it run on every node; keep
cron pinned as a genuine singleton. For correct multi-instance runtime, follow
the Nextcloud caching recommendation: memcache.local => APCu in both modes,
memcache.distributed and memcache.locking => Redis in swarm, backed by an
explicit redis connection array (which also fixes the RedisException at occ
upgrade, where OC\Memcache\Redis previously fell back to 127.0.0.1).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-06 21:05:16 +02:00

25 lines
829 B
Django/Jinja

<?php
{% if DEPLOYMENT_MODE == "compose" %}
return [
'memcache.local' => '\\OC\\Memcache\\APCu',
];
{% else %}
{% set _redis_user = lookup('engine', 'redis', application_id, 'username') %}
{% set _redis_password = lookup('engine', 'redis', application_id, 'password') %}
return [
'memcache.local' => '\\OC\\Memcache\\APCu',
'memcache.distributed' => '\\OC\\Memcache\\Redis',
'memcache.locking' => '\\OC\\Memcache\\Redis',
'redis' => [
'host' => '{{ lookup('engine', 'redis', application_id, 'host') }}',
'port' => {{ lookup('engine', 'redis', application_id, 'port') }},
{% if _redis_user | length > 0 %}
'user' => '{{ _redis_user }}',
{% endif %}
{% if _redis_password | length > 0 %}
'password' => '{{ _redis_password | replace("\\", "\\\\") | replace("'", "\\'") }}',
{% endif %}
],
];
{% endif %}