0
0
Fork 0
mirror of https://github.com/nextcloud/docker.git synced 2025-04-19 18:36:09 +02:00

Allow REDIS_CLUSTER environment variable to use Redis in cluster mode

Signed-off-by: Nick Martin <284356+n1mmy@users.noreply.github.com>
Signed-off-by: Nick Martin <nim@lock-the-door.lan>
This commit is contained in:
Nick Martin 2025-02-08 08:17:07 -08:00
parent 85eb58a828
commit f756178d10
2 changed files with 24 additions and 0 deletions

View file

@ -238,6 +238,10 @@ To use Redis for memory caching as well as PHP session storage, specify the foll
- `REDIS_HOST_PORT` (default: `6379`) Optional port for Redis, only use for external Redis servers that run on non-standard ports. - `REDIS_HOST_PORT` (default: `6379`) Optional port for Redis, only use for external Redis servers that run on non-standard ports.
- `REDIS_HOST_PASSWORD` (not set by default) Redis password - `REDIS_HOST_PASSWORD` (not set by default) Redis password
To use Redis in cluster mode, you can use
- `REDIS_CLUSTER` (not set by default) Name and port number of a redis host.
Check the [Nextcloud documentation](https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/caching_configuration.html) for more information. Check the [Nextcloud documentation](https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/caching_configuration.html) for more information.
### E-mail (SMTP) Configuration ### E-mail (SMTP) Configuration

View file

@ -132,6 +132,26 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
} > /usr/local/etc/php/conf.d/redis-session.ini } > /usr/local/etc/php/conf.d/redis-session.ini
fi fi
if [ -n "${REDIS_CLUSTER+x}" ]; then
echo "Configuring Rediscluster as session handler"
{
file_env REDIS_HOST_PASSWORD
echo 'session.save_handler = rediscluster'
# check if redis password has been set
if [ -n "${REDIS_HOST_PASSWORD+x}" ]; then
echo "session.save_path = \"seed[]=${REDIS_CLUSTER}&auth=${REDIS_HOST_PASSWORD}\""
else
echo "session.save_path = \"seed[]=${REDIS_CLUSTER}\""
fi
echo "redis.session.locking_enabled = 1"
echo "redis.session.lock_retries = -1"
# redis.session.lock_wait_time is specified in microseconds.
# Wait 10ms before retrying the lock rather than the default 2ms.
echo "redis.session.lock_wait_time = 10000"
} > /usr/local/etc/php/conf.d/redis-session.ini
fi
# If another process is syncing the html folder, wait for # If another process is syncing the html folder, wait for
# it to be done, then escape initalization. # it to be done, then escape initalization.
( (