diff --git a/28/apache/config/redis.config.php b/28/apache/config/redis.config.php index a5b13da6f..f90499245 100644 --- a/28/apache/config/redis.config.php +++ b/28/apache/config/redis.config.php @@ -4,7 +4,7 @@ 'memcache.distributed' => '\OC\Memcache\Redis', 'memcache.locking' => '\OC\Memcache\Redis', 'redis' => array( - 'host' => getenv('REDIS_HOST'), + 'host' => ($_ENV['REDIS_PROTOCOL'] ?? 'tcp') . "://" . getenv('REDIS_HOST'), 'password' => getenv('REDIS_HOST_PASSWORD_FILE') ? trim(file_get_contents(getenv('REDIS_HOST_PASSWORD_FILE'))) : (string) getenv('REDIS_HOST_PASSWORD'), ), ); diff --git a/28/apache/entrypoint.sh b/28/apache/entrypoint.sh index 8e178f2ec..ab4e94889 100755 --- a/28/apache/entrypoint.sh +++ b/28/apache/entrypoint.sh @@ -120,9 +120,9 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP fi # check if redis password has been set elif [ -n "${REDIS_HOST_PASSWORD+x}" ]; then - echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth=${REDIS_HOST_PASSWORD}\"" + echo "session.save_path = \"${REDIS_PROTOCOL:=tcp}://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth=${REDIS_HOST_PASSWORD}\"" else - echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\"" + echo "session.save_path = \"${REDIS_PROTOCOL:=tcp}://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\"" fi echo "redis.session.locking_enabled = 1" echo "redis.session.lock_retries = -1" diff --git a/28/fpm-alpine/config/redis.config.php b/28/fpm-alpine/config/redis.config.php index a5b13da6f..f90499245 100644 --- a/28/fpm-alpine/config/redis.config.php +++ b/28/fpm-alpine/config/redis.config.php @@ -4,7 +4,7 @@ 'memcache.distributed' => '\OC\Memcache\Redis', 'memcache.locking' => '\OC\Memcache\Redis', 'redis' => array( - 'host' => getenv('REDIS_HOST'), + 'host' => ($_ENV['REDIS_PROTOCOL'] ?? 'tcp') . "://" . getenv('REDIS_HOST'), 'password' => getenv('REDIS_HOST_PASSWORD_FILE') ? trim(file_get_contents(getenv('REDIS_HOST_PASSWORD_FILE'))) : (string) getenv('REDIS_HOST_PASSWORD'), ), ); diff --git a/28/fpm-alpine/entrypoint.sh b/28/fpm-alpine/entrypoint.sh index 8e178f2ec..ab4e94889 100755 --- a/28/fpm-alpine/entrypoint.sh +++ b/28/fpm-alpine/entrypoint.sh @@ -120,9 +120,9 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP fi # check if redis password has been set elif [ -n "${REDIS_HOST_PASSWORD+x}" ]; then - echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth=${REDIS_HOST_PASSWORD}\"" + echo "session.save_path = \"${REDIS_PROTOCOL:=tcp}://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth=${REDIS_HOST_PASSWORD}\"" else - echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\"" + echo "session.save_path = \"${REDIS_PROTOCOL:=tcp}://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\"" fi echo "redis.session.locking_enabled = 1" echo "redis.session.lock_retries = -1" diff --git a/28/fpm/config/redis.config.php b/28/fpm/config/redis.config.php index a5b13da6f..f90499245 100644 --- a/28/fpm/config/redis.config.php +++ b/28/fpm/config/redis.config.php @@ -4,7 +4,7 @@ 'memcache.distributed' => '\OC\Memcache\Redis', 'memcache.locking' => '\OC\Memcache\Redis', 'redis' => array( - 'host' => getenv('REDIS_HOST'), + 'host' => ($_ENV['REDIS_PROTOCOL'] ?? 'tcp') . "://" . getenv('REDIS_HOST'), 'password' => getenv('REDIS_HOST_PASSWORD_FILE') ? trim(file_get_contents(getenv('REDIS_HOST_PASSWORD_FILE'))) : (string) getenv('REDIS_HOST_PASSWORD'), ), ); diff --git a/28/fpm/entrypoint.sh b/28/fpm/entrypoint.sh index 8e178f2ec..ab4e94889 100755 --- a/28/fpm/entrypoint.sh +++ b/28/fpm/entrypoint.sh @@ -120,9 +120,9 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP fi # check if redis password has been set elif [ -n "${REDIS_HOST_PASSWORD+x}" ]; then - echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth=${REDIS_HOST_PASSWORD}\"" + echo "session.save_path = \"${REDIS_PROTOCOL:=tcp}://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth=${REDIS_HOST_PASSWORD}\"" else - echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\"" + echo "session.save_path = \"${REDIS_PROTOCOL:=tcp}://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\"" fi echo "redis.session.locking_enabled = 1" echo "redis.session.lock_retries = -1" diff --git a/29/apache/config/redis.config.php b/29/apache/config/redis.config.php index a5b13da6f..f90499245 100644 --- a/29/apache/config/redis.config.php +++ b/29/apache/config/redis.config.php @@ -4,7 +4,7 @@ 'memcache.distributed' => '\OC\Memcache\Redis', 'memcache.locking' => '\OC\Memcache\Redis', 'redis' => array( - 'host' => getenv('REDIS_HOST'), + 'host' => ($_ENV['REDIS_PROTOCOL'] ?? 'tcp') . "://" . getenv('REDIS_HOST'), 'password' => getenv('REDIS_HOST_PASSWORD_FILE') ? trim(file_get_contents(getenv('REDIS_HOST_PASSWORD_FILE'))) : (string) getenv('REDIS_HOST_PASSWORD'), ), ); diff --git a/29/apache/entrypoint.sh b/29/apache/entrypoint.sh index 8e178f2ec..ab4e94889 100755 --- a/29/apache/entrypoint.sh +++ b/29/apache/entrypoint.sh @@ -120,9 +120,9 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP fi # check if redis password has been set elif [ -n "${REDIS_HOST_PASSWORD+x}" ]; then - echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth=${REDIS_HOST_PASSWORD}\"" + echo "session.save_path = \"${REDIS_PROTOCOL:=tcp}://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth=${REDIS_HOST_PASSWORD}\"" else - echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\"" + echo "session.save_path = \"${REDIS_PROTOCOL:=tcp}://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\"" fi echo "redis.session.locking_enabled = 1" echo "redis.session.lock_retries = -1" diff --git a/29/fpm-alpine/config/redis.config.php b/29/fpm-alpine/config/redis.config.php index a5b13da6f..f90499245 100644 --- a/29/fpm-alpine/config/redis.config.php +++ b/29/fpm-alpine/config/redis.config.php @@ -4,7 +4,7 @@ 'memcache.distributed' => '\OC\Memcache\Redis', 'memcache.locking' => '\OC\Memcache\Redis', 'redis' => array( - 'host' => getenv('REDIS_HOST'), + 'host' => ($_ENV['REDIS_PROTOCOL'] ?? 'tcp') . "://" . getenv('REDIS_HOST'), 'password' => getenv('REDIS_HOST_PASSWORD_FILE') ? trim(file_get_contents(getenv('REDIS_HOST_PASSWORD_FILE'))) : (string) getenv('REDIS_HOST_PASSWORD'), ), ); diff --git a/29/fpm-alpine/entrypoint.sh b/29/fpm-alpine/entrypoint.sh index 8e178f2ec..ab4e94889 100755 --- a/29/fpm-alpine/entrypoint.sh +++ b/29/fpm-alpine/entrypoint.sh @@ -120,9 +120,9 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP fi # check if redis password has been set elif [ -n "${REDIS_HOST_PASSWORD+x}" ]; then - echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth=${REDIS_HOST_PASSWORD}\"" + echo "session.save_path = \"${REDIS_PROTOCOL:=tcp}://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth=${REDIS_HOST_PASSWORD}\"" else - echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\"" + echo "session.save_path = \"${REDIS_PROTOCOL:=tcp}://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\"" fi echo "redis.session.locking_enabled = 1" echo "redis.session.lock_retries = -1" diff --git a/29/fpm/config/redis.config.php b/29/fpm/config/redis.config.php index a5b13da6f..f90499245 100644 --- a/29/fpm/config/redis.config.php +++ b/29/fpm/config/redis.config.php @@ -4,7 +4,7 @@ 'memcache.distributed' => '\OC\Memcache\Redis', 'memcache.locking' => '\OC\Memcache\Redis', 'redis' => array( - 'host' => getenv('REDIS_HOST'), + 'host' => ($_ENV['REDIS_PROTOCOL'] ?? 'tcp') . "://" . getenv('REDIS_HOST'), 'password' => getenv('REDIS_HOST_PASSWORD_FILE') ? trim(file_get_contents(getenv('REDIS_HOST_PASSWORD_FILE'))) : (string) getenv('REDIS_HOST_PASSWORD'), ), ); diff --git a/29/fpm/entrypoint.sh b/29/fpm/entrypoint.sh index 8e178f2ec..ab4e94889 100755 --- a/29/fpm/entrypoint.sh +++ b/29/fpm/entrypoint.sh @@ -120,9 +120,9 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP fi # check if redis password has been set elif [ -n "${REDIS_HOST_PASSWORD+x}" ]; then - echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth=${REDIS_HOST_PASSWORD}\"" + echo "session.save_path = \"${REDIS_PROTOCOL:=tcp}://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth=${REDIS_HOST_PASSWORD}\"" else - echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\"" + echo "session.save_path = \"${REDIS_PROTOCOL:=tcp}://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\"" fi echo "redis.session.locking_enabled = 1" echo "redis.session.lock_retries = -1" diff --git a/30/apache/config/redis.config.php b/30/apache/config/redis.config.php index a5b13da6f..f90499245 100644 --- a/30/apache/config/redis.config.php +++ b/30/apache/config/redis.config.php @@ -4,7 +4,7 @@ 'memcache.distributed' => '\OC\Memcache\Redis', 'memcache.locking' => '\OC\Memcache\Redis', 'redis' => array( - 'host' => getenv('REDIS_HOST'), + 'host' => ($_ENV['REDIS_PROTOCOL'] ?? 'tcp') . "://" . getenv('REDIS_HOST'), 'password' => getenv('REDIS_HOST_PASSWORD_FILE') ? trim(file_get_contents(getenv('REDIS_HOST_PASSWORD_FILE'))) : (string) getenv('REDIS_HOST_PASSWORD'), ), ); diff --git a/30/apache/entrypoint.sh b/30/apache/entrypoint.sh index 8e178f2ec..ab4e94889 100755 --- a/30/apache/entrypoint.sh +++ b/30/apache/entrypoint.sh @@ -120,9 +120,9 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP fi # check if redis password has been set elif [ -n "${REDIS_HOST_PASSWORD+x}" ]; then - echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth=${REDIS_HOST_PASSWORD}\"" + echo "session.save_path = \"${REDIS_PROTOCOL:=tcp}://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth=${REDIS_HOST_PASSWORD}\"" else - echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\"" + echo "session.save_path = \"${REDIS_PROTOCOL:=tcp}://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\"" fi echo "redis.session.locking_enabled = 1" echo "redis.session.lock_retries = -1" diff --git a/30/fpm-alpine/config/redis.config.php b/30/fpm-alpine/config/redis.config.php index a5b13da6f..f90499245 100644 --- a/30/fpm-alpine/config/redis.config.php +++ b/30/fpm-alpine/config/redis.config.php @@ -4,7 +4,7 @@ 'memcache.distributed' => '\OC\Memcache\Redis', 'memcache.locking' => '\OC\Memcache\Redis', 'redis' => array( - 'host' => getenv('REDIS_HOST'), + 'host' => ($_ENV['REDIS_PROTOCOL'] ?? 'tcp') . "://" . getenv('REDIS_HOST'), 'password' => getenv('REDIS_HOST_PASSWORD_FILE') ? trim(file_get_contents(getenv('REDIS_HOST_PASSWORD_FILE'))) : (string) getenv('REDIS_HOST_PASSWORD'), ), ); diff --git a/30/fpm-alpine/entrypoint.sh b/30/fpm-alpine/entrypoint.sh index 8e178f2ec..ab4e94889 100755 --- a/30/fpm-alpine/entrypoint.sh +++ b/30/fpm-alpine/entrypoint.sh @@ -120,9 +120,9 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP fi # check if redis password has been set elif [ -n "${REDIS_HOST_PASSWORD+x}" ]; then - echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth=${REDIS_HOST_PASSWORD}\"" + echo "session.save_path = \"${REDIS_PROTOCOL:=tcp}://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth=${REDIS_HOST_PASSWORD}\"" else - echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\"" + echo "session.save_path = \"${REDIS_PROTOCOL:=tcp}://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\"" fi echo "redis.session.locking_enabled = 1" echo "redis.session.lock_retries = -1" diff --git a/30/fpm/config/redis.config.php b/30/fpm/config/redis.config.php index a5b13da6f..f90499245 100644 --- a/30/fpm/config/redis.config.php +++ b/30/fpm/config/redis.config.php @@ -4,7 +4,7 @@ 'memcache.distributed' => '\OC\Memcache\Redis', 'memcache.locking' => '\OC\Memcache\Redis', 'redis' => array( - 'host' => getenv('REDIS_HOST'), + 'host' => ($_ENV['REDIS_PROTOCOL'] ?? 'tcp') . "://" . getenv('REDIS_HOST'), 'password' => getenv('REDIS_HOST_PASSWORD_FILE') ? trim(file_get_contents(getenv('REDIS_HOST_PASSWORD_FILE'))) : (string) getenv('REDIS_HOST_PASSWORD'), ), ); diff --git a/30/fpm/entrypoint.sh b/30/fpm/entrypoint.sh index 8e178f2ec..ab4e94889 100755 --- a/30/fpm/entrypoint.sh +++ b/30/fpm/entrypoint.sh @@ -120,9 +120,9 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP fi # check if redis password has been set elif [ -n "${REDIS_HOST_PASSWORD+x}" ]; then - echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth=${REDIS_HOST_PASSWORD}\"" + echo "session.save_path = \"${REDIS_PROTOCOL:=tcp}://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth=${REDIS_HOST_PASSWORD}\"" else - echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\"" + echo "session.save_path = \"${REDIS_PROTOCOL:=tcp}://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\"" fi echo "redis.session.locking_enabled = 1" echo "redis.session.lock_retries = -1" diff --git a/README.md b/README.md index f2def1aab..31c667819 100644 --- a/README.md +++ b/README.md @@ -237,6 +237,7 @@ To use Redis for memory caching as well as PHP session storage, specify the foll - `REDIS_HOST` (not set by default) Name of Redis container - `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_PROTOCOL` (default: `tcp`) Set to `tls` to use TLS when connecting to Redis server Check the [Nextcloud documentation](https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/caching_configuration.html) for more information. diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 8e178f2ec..ab4e94889 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -120,9 +120,9 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP fi # check if redis password has been set elif [ -n "${REDIS_HOST_PASSWORD+x}" ]; then - echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth=${REDIS_HOST_PASSWORD}\"" + echo "session.save_path = \"${REDIS_PROTOCOL:=tcp}://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth=${REDIS_HOST_PASSWORD}\"" else - echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\"" + echo "session.save_path = \"${REDIS_PROTOCOL:=tcp}://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\"" fi echo "redis.session.locking_enabled = 1" echo "redis.session.lock_retries = -1"