Skip to content
Open
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
24 changes: 23 additions & 1 deletion .config/redis.config.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
<?php
if (getenv('REDIS_HOST')) {
if (getenv('REDIS_CLUSTER_SEEDS')) {
$redisClusterSeeds = array_values(
array_filter(
array_map('trim', explode(',', getenv('REDIS_CLUSTER_SEEDS'))),
function ($seed) {
return $seed !== '';
}
)
);

$CONFIG = array(
'memcache.distributed' => '\OC\Memcache\Redis',
'memcache.locking' => '\OC\Memcache\Redis',
'redis.cluster' => array(
'seeds' => $redisClusterSeeds,
'password' => getenv('REDIS_HOST_PASSWORD_FILE') ? trim(file_get_contents(getenv('REDIS_HOST_PASSWORD_FILE'))) : (string) getenv('REDIS_HOST_PASSWORD'),
),
);

if (getenv('REDIS_HOST_USER') !== false) {
$CONFIG['redis.cluster']['user'] = (string) getenv('REDIS_HOST_USER');
}
} elseif (getenv('REDIS_HOST')) {
$CONFIG = array(
'memcache.distributed' => '\OC\Memcache\Redis',
'memcache.locking' => '\OC\Memcache\Redis',
Expand Down
24 changes: 23 additions & 1 deletion 32/apache/config/redis.config.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
<?php
if (getenv('REDIS_HOST')) {
if (getenv('REDIS_CLUSTER_SEEDS')) {
$redisClusterSeeds = array_values(
array_filter(
array_map('trim', explode(',', getenv('REDIS_CLUSTER_SEEDS'))),
function ($seed) {
return $seed !== '';
}
)
);

$CONFIG = array(
'memcache.distributed' => '\OC\Memcache\Redis',
'memcache.locking' => '\OC\Memcache\Redis',
'redis.cluster' => array(
'seeds' => $redisClusterSeeds,
'password' => getenv('REDIS_HOST_PASSWORD_FILE') ? trim(file_get_contents(getenv('REDIS_HOST_PASSWORD_FILE'))) : (string) getenv('REDIS_HOST_PASSWORD'),
),
);

if (getenv('REDIS_HOST_USER') !== false) {
$CONFIG['redis.cluster']['user'] = (string) getenv('REDIS_HOST_USER');
}
} elseif (getenv('REDIS_HOST')) {
$CONFIG = array(
'memcache.distributed' => '\OC\Memcache\Redis',
'memcache.locking' => '\OC\Memcache\Redis',
Expand Down
24 changes: 23 additions & 1 deletion 32/fpm-alpine/config/redis.config.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
<?php
if (getenv('REDIS_HOST')) {
if (getenv('REDIS_CLUSTER_SEEDS')) {
$redisClusterSeeds = array_values(
array_filter(
array_map('trim', explode(',', getenv('REDIS_CLUSTER_SEEDS'))),
function ($seed) {
return $seed !== '';
}
)
);

$CONFIG = array(
'memcache.distributed' => '\OC\Memcache\Redis',
'memcache.locking' => '\OC\Memcache\Redis',
'redis.cluster' => array(
'seeds' => $redisClusterSeeds,
'password' => getenv('REDIS_HOST_PASSWORD_FILE') ? trim(file_get_contents(getenv('REDIS_HOST_PASSWORD_FILE'))) : (string) getenv('REDIS_HOST_PASSWORD'),
),
);

if (getenv('REDIS_HOST_USER') !== false) {
$CONFIG['redis.cluster']['user'] = (string) getenv('REDIS_HOST_USER');
}
} elseif (getenv('REDIS_HOST')) {
$CONFIG = array(
'memcache.distributed' => '\OC\Memcache\Redis',
'memcache.locking' => '\OC\Memcache\Redis',
Expand Down
24 changes: 23 additions & 1 deletion 32/fpm/config/redis.config.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
<?php
if (getenv('REDIS_HOST')) {
if (getenv('REDIS_CLUSTER_SEEDS')) {
$redisClusterSeeds = array_values(
array_filter(
array_map('trim', explode(',', getenv('REDIS_CLUSTER_SEEDS'))),
function ($seed) {
return $seed !== '';
}
)
);

$CONFIG = array(
'memcache.distributed' => '\OC\Memcache\Redis',
'memcache.locking' => '\OC\Memcache\Redis',
'redis.cluster' => array(
'seeds' => $redisClusterSeeds,
'password' => getenv('REDIS_HOST_PASSWORD_FILE') ? trim(file_get_contents(getenv('REDIS_HOST_PASSWORD_FILE'))) : (string) getenv('REDIS_HOST_PASSWORD'),
),
);

if (getenv('REDIS_HOST_USER') !== false) {
$CONFIG['redis.cluster']['user'] = (string) getenv('REDIS_HOST_USER');
}
} elseif (getenv('REDIS_HOST')) {
$CONFIG = array(
'memcache.distributed' => '\OC\Memcache\Redis',
'memcache.locking' => '\OC\Memcache\Redis',
Expand Down
24 changes: 23 additions & 1 deletion 33/apache/config/redis.config.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
<?php
if (getenv('REDIS_HOST')) {
if (getenv('REDIS_CLUSTER_SEEDS')) {
$redisClusterSeeds = array_values(
array_filter(
array_map('trim', explode(',', getenv('REDIS_CLUSTER_SEEDS'))),
function ($seed) {
return $seed !== '';
}
)
);

$CONFIG = array(
'memcache.distributed' => '\OC\Memcache\Redis',
'memcache.locking' => '\OC\Memcache\Redis',
'redis.cluster' => array(
'seeds' => $redisClusterSeeds,
'password' => getenv('REDIS_HOST_PASSWORD_FILE') ? trim(file_get_contents(getenv('REDIS_HOST_PASSWORD_FILE'))) : (string) getenv('REDIS_HOST_PASSWORD'),
),
);

if (getenv('REDIS_HOST_USER') !== false) {
$CONFIG['redis.cluster']['user'] = (string) getenv('REDIS_HOST_USER');
}
} elseif (getenv('REDIS_HOST')) {
$CONFIG = array(
'memcache.distributed' => '\OC\Memcache\Redis',
'memcache.locking' => '\OC\Memcache\Redis',
Expand Down
24 changes: 23 additions & 1 deletion 33/fpm-alpine/config/redis.config.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
<?php
if (getenv('REDIS_HOST')) {
if (getenv('REDIS_CLUSTER_SEEDS')) {
$redisClusterSeeds = array_values(
array_filter(
array_map('trim', explode(',', getenv('REDIS_CLUSTER_SEEDS'))),
function ($seed) {
return $seed !== '';
}
)
);

$CONFIG = array(
'memcache.distributed' => '\OC\Memcache\Redis',
'memcache.locking' => '\OC\Memcache\Redis',
'redis.cluster' => array(
'seeds' => $redisClusterSeeds,
'password' => getenv('REDIS_HOST_PASSWORD_FILE') ? trim(file_get_contents(getenv('REDIS_HOST_PASSWORD_FILE'))) : (string) getenv('REDIS_HOST_PASSWORD'),
),
);

if (getenv('REDIS_HOST_USER') !== false) {
$CONFIG['redis.cluster']['user'] = (string) getenv('REDIS_HOST_USER');
}
} elseif (getenv('REDIS_HOST')) {
$CONFIG = array(
'memcache.distributed' => '\OC\Memcache\Redis',
'memcache.locking' => '\OC\Memcache\Redis',
Expand Down
24 changes: 23 additions & 1 deletion 33/fpm/config/redis.config.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
<?php
if (getenv('REDIS_HOST')) {
if (getenv('REDIS_CLUSTER_SEEDS')) {
$redisClusterSeeds = array_values(
array_filter(
array_map('trim', explode(',', getenv('REDIS_CLUSTER_SEEDS'))),
function ($seed) {
return $seed !== '';
}
)
);

$CONFIG = array(
'memcache.distributed' => '\OC\Memcache\Redis',
'memcache.locking' => '\OC\Memcache\Redis',
'redis.cluster' => array(
'seeds' => $redisClusterSeeds,
'password' => getenv('REDIS_HOST_PASSWORD_FILE') ? trim(file_get_contents(getenv('REDIS_HOST_PASSWORD_FILE'))) : (string) getenv('REDIS_HOST_PASSWORD'),
),
);

if (getenv('REDIS_HOST_USER') !== false) {
$CONFIG['redis.cluster']['user'] = (string) getenv('REDIS_HOST_USER');
}
} elseif (getenv('REDIS_HOST')) {
$CONFIG = array(
'memcache.distributed' => '\OC\Memcache\Redis',
'memcache.locking' => '\OC\Memcache\Redis',
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,10 @@ To use Redis for memory caching as well as PHP session storage, specify the foll
- `REDIS_HOST_USER` (not set by default) Optional username for Redis, only use for external Redis servers that require a user.
- `REDIS_HOST_PASSWORD` (not set by default) Redis password

For Redis Cluster, set the seed list as a comma-separated list of host:port pairs. When `REDIS_CLUSTER_SEEDS` is set, Redis Cluster config is used instead of `REDIS_HOST`.

- `REDIS_CLUSTER_SEEDS` (not set by default) Comma-separated list of cluster seeds, e.g. `redis-1:6379,redis-2:6379,redis-3:6379`

Check the [Nextcloud documentation](https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/caching_configuration.html) for more information.

### E-mail (SMTP) Configuration
Expand Down