summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTortue Torche <tortuetorche@users.noreply.github.com>2020-01-11 00:38:38 +0100
committerJ0WI <J0WI@users.noreply.github.com>2020-01-10 23:38:38 +0000
commitd9ab30a96982c4c86e65aa4ae0637c3d37f87bf5 (patch)
treec67095c8b616fd7293a5f5fe0ab08912ab6a8c1d
parentb3f71af495124432776515f86da6719ade0df3b3 (diff)
Fix Redis Unix socket support (#944)
* Fix Redis Unix socket support Rebase and rewrite the @epma01 pull request, based on last Nextcloud Docker changes See: https://github.com/nextcloud/docker/pull/735 Signed-off-by: Tortue Torche <tortuetorche@users.noreply.github.com> * Fix CI tests with update.sh script Signed-off-by: Tortue Torche <tortuetorche@users.noreply.github.com>
-rw-r--r--.config/redis.config.php8
-rw-r--r--15.0/apache/config/redis.config.php8
-rwxr-xr-x15.0/apache/entrypoint.sh9
-rw-r--r--15.0/fpm-alpine/config/redis.config.php8
-rwxr-xr-x15.0/fpm-alpine/entrypoint.sh9
-rw-r--r--15.0/fpm/config/redis.config.php8
-rwxr-xr-x15.0/fpm/entrypoint.sh9
-rw-r--r--16.0/apache/config/redis.config.php8
-rwxr-xr-x16.0/apache/entrypoint.sh9
-rw-r--r--16.0/fpm-alpine/config/redis.config.php8
-rwxr-xr-x16.0/fpm-alpine/entrypoint.sh9
-rw-r--r--16.0/fpm/config/redis.config.php8
-rwxr-xr-x16.0/fpm/entrypoint.sh9
-rw-r--r--17.0/apache/config/redis.config.php8
-rwxr-xr-x17.0/apache/entrypoint.sh9
-rw-r--r--17.0/fpm-alpine/config/redis.config.php8
-rwxr-xr-x17.0/fpm-alpine/entrypoint.sh9
-rw-r--r--17.0/fpm/config/redis.config.php8
-rwxr-xr-x17.0/fpm/entrypoint.sh9
-rw-r--r--18.0-rc/apache/config/redis.config.php8
-rwxr-xr-x18.0-rc/apache/entrypoint.sh9
-rw-r--r--18.0-rc/fpm-alpine/config/redis.config.php8
-rwxr-xr-x18.0-rc/fpm-alpine/entrypoint.sh9
-rw-r--r--18.0-rc/fpm/config/redis.config.php8
-rwxr-xr-x18.0-rc/fpm/entrypoint.sh9
-rwxr-xr-xdocker-entrypoint.sh9
26 files changed, 182 insertions, 39 deletions
diff --git a/.config/redis.config.php b/.config/redis.config.php
index 19676160..9429c901 100644
--- a/.config/redis.config.php
+++ b/.config/redis.config.php
@@ -5,9 +5,13 @@ if (getenv('REDIS_HOST')) {
'memcache.locking' => '\OC\Memcache\Redis',
'redis' => array(
'host' => getenv('REDIS_HOST'),
- 'port' => getenv('REDIS_HOST_PORT') ?: 6379,
'password' => getenv('REDIS_HOST_PASSWORD'),
),
);
-}
+ if (getenv('REDIS_HOST_PORT') !== false) {
+ $CONFIG['redis']['port'] = (int) getenv('REDIS_HOST_PORT');
+ } elseif (getenv('REDIS_HOST')[0] != '/') {
+ $CONFIG['redis']['port'] = 6379;
+ }
+}
diff --git a/15.0/apache/config/redis.config.php b/15.0/apache/config/redis.config.php
index 19676160..9429c901 100644
--- a/15.0/apache/config/redis.config.php
+++ b/15.0/apache/config/redis.config.php
@@ -5,9 +5,13 @@ if (getenv('REDIS_HOST')) {
'memcache.locking' => '\OC\Memcache\Redis',
'redis' => array(
'host' => getenv('REDIS_HOST'),
- 'port' => getenv('REDIS_HOST_PORT') ?: 6379,
'password' => getenv('REDIS_HOST_PASSWORD'),
),
);
-}
+ if (getenv('REDIS_HOST_PORT') !== false) {
+ $CONFIG['redis']['port'] = (int) getenv('REDIS_HOST_PORT');
+ } elseif (getenv('REDIS_HOST')[0] != '/') {
+ $CONFIG['redis']['port'] = 6379;
+ }
+}
diff --git a/15.0/apache/entrypoint.sh b/15.0/apache/entrypoint.sh
index 9514d881..0104bab6 100755
--- a/15.0/apache/entrypoint.sh
+++ b/15.0/apache/entrypoint.sh
@@ -25,8 +25,15 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
echo "Configuring Redis as session handler"
{
echo 'session.save_handler = redis'
+ # check if redis host is an unix socket path
+ if [ "$(echo "$REDIS_HOST" | cut -c1-1)" = "/" ]; then
+ if [ -n "${REDIS_HOST_PASSWORD+x}" ]; then
+ echo "session.save_path = \"unix://${REDIS_HOST}?auth=${REDIS_HOST_PASSWORD}\""
+ else
+ echo "session.save_path = \"unix://${REDIS_HOST}\""
+ fi
# check if redis password has been set
- if [ -n "${REDIS_HOST_PASSWORD+x}" ]; then
+ elif [ -n "${REDIS_HOST_PASSWORD+x}" ]; then
echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth=${REDIS_HOST_PASSWORD}\""
else
echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\""
diff --git a/15.0/fpm-alpine/config/redis.config.php b/15.0/fpm-alpine/config/redis.config.php
index 19676160..9429c901 100644
--- a/15.0/fpm-alpine/config/redis.config.php
+++ b/15.0/fpm-alpine/config/redis.config.php
@@ -5,9 +5,13 @@ if (getenv('REDIS_HOST')) {
'memcache.locking' => '\OC\Memcache\Redis',
'redis' => array(
'host' => getenv('REDIS_HOST'),
- 'port' => getenv('REDIS_HOST_PORT') ?: 6379,
'password' => getenv('REDIS_HOST_PASSWORD'),
),
);
-}
+ if (getenv('REDIS_HOST_PORT') !== false) {
+ $CONFIG['redis']['port'] = (int) getenv('REDIS_HOST_PORT');
+ } elseif (getenv('REDIS_HOST')[0] != '/') {
+ $CONFIG['redis']['port'] = 6379;
+ }
+}
diff --git a/15.0/fpm-alpine/entrypoint.sh b/15.0/fpm-alpine/entrypoint.sh
index 9514d881..0104bab6 100755
--- a/15.0/fpm-alpine/entrypoint.sh
+++ b/15.0/fpm-alpine/entrypoint.sh
@@ -25,8 +25,15 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
echo "Configuring Redis as session handler"
{
echo 'session.save_handler = redis'
+ # check if redis host is an unix socket path
+ if [ "$(echo "$REDIS_HOST" | cut -c1-1)" = "/" ]; then
+ if [ -n "${REDIS_HOST_PASSWORD+x}" ]; then
+ echo "session.save_path = \"unix://${REDIS_HOST}?auth=${REDIS_HOST_PASSWORD}\""
+ else
+ echo "session.save_path = \"unix://${REDIS_HOST}\""
+ fi
# check if redis password has been set
- if [ -n "${REDIS_HOST_PASSWORD+x}" ]; then
+ elif [ -n "${REDIS_HOST_PASSWORD+x}" ]; then
echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth=${REDIS_HOST_PASSWORD}\""
else
echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\""
diff --git a/15.0/fpm/config/redis.config.php b/15.0/fpm/config/redis.config.php
index 19676160..9429c901 100644
--- a/15.0/fpm/config/redis.config.php
+++ b/15.0/fpm/config/redis.config.php
@@ -5,9 +5,13 @@ if (getenv('REDIS_HOST')) {
'memcache.locking' => '\OC\Memcache\Redis',
'redis' => array(
'host' => getenv('REDIS_HOST'),
- 'port' => getenv('REDIS_HOST_PORT') ?: 6379,
'password' => getenv('REDIS_HOST_PASSWORD'),
),
);
-}
+ if (getenv('REDIS_HOST_PORT') !== false) {
+ $CONFIG['redis']['port'] = (int) getenv('REDIS_HOST_PORT');
+ } elseif (getenv('REDIS_HOST')[0] != '/') {
+ $CONFIG['redis']['port'] = 6379;
+ }
+}
diff --git a/15.0/fpm/entrypoint.sh b/15.0/fpm/entrypoint.sh
index 9514d881..0104bab6 100755
--- a/15.0/fpm/entrypoint.sh
+++ b/15.0/fpm/entrypoint.sh
@@ -25,8 +25,15 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
echo "Configuring Redis as session handler"
{
echo 'session.save_handler = redis'
+ # check if redis host is an unix socket path
+ if [ "$(echo "$REDIS_HOST" | cut -c1-1)" = "/" ]; then
+ if [ -n "${REDIS_HOST_PASSWORD+x}" ]; then
+ echo "session.save_path = \"unix://${REDIS_HOST}?auth=${REDIS_HOST_PASSWORD}\""
+ else
+ echo "session.save_path = \"unix://${REDIS_HOST}\""
+ fi
# check if redis password has been set
- if [ -n "${REDIS_HOST_PASSWORD+x}" ]; then
+ elif [ -n "${REDIS_HOST_PASSWORD+x}" ]; then
echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth=${REDIS_HOST_PASSWORD}\""
else
echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\""
diff --git a/16.0/apache/config/redis.config.php b/16.0/apache/config/redis.config.php
index 19676160..9429c901 100644
--- a/16.0/apache/config/redis.config.php
+++ b/16.0/apache/config/redis.config.php
@@ -5,9 +5,13 @@ if (getenv('REDIS_HOST')) {
'memcache.locking' => '\OC\Memcache\Redis',
'redis' => array(
'host' => getenv('REDIS_HOST'),
- 'port' => getenv('REDIS_HOST_PORT') ?: 6379,
'password' => getenv('REDIS_HOST_PASSWORD'),
),
);
-}
+ if (getenv('REDIS_HOST_PORT') !== false) {
+ $CONFIG['redis']['port'] = (int) getenv('REDIS_HOST_PORT');
+ } elseif (getenv('REDIS_HOST')[0] != '/') {
+ $CONFIG['redis']['port'] = 6379;
+ }
+}
diff --git a/16.0/apache/entrypoint.sh b/16.0/apache/entrypoint.sh
index 9514d881..0104bab6 100755
--- a/16.0/apache/entrypoint.sh
+++ b/16.0/apache/entrypoint.sh
@@ -25,8 +25,15 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
echo "Configuring Redis as session handler"
{
echo 'session.save_handler = redis'
+ # check if redis host is an unix socket path
+ if [ "$(echo "$REDIS_HOST" | cut -c1-1)" = "/" ]; then
+ if [ -n "${REDIS_HOST_PASSWORD+x}" ]; then
+ echo "session.save_path = \"unix://${REDIS_HOST}?auth=${REDIS_HOST_PASSWORD}\""
+ else
+ echo "session.save_path = \"unix://${REDIS_HOST}\""
+ fi
# check if redis password has been set
- if [ -n "${REDIS_HOST_PASSWORD+x}" ]; then
+ elif [ -n "${REDIS_HOST_PASSWORD+x}" ]; then
echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth=${REDIS_HOST_PASSWORD}\""
else
echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\""
diff --git a/16.0/fpm-alpine/config/redis.config.php b/16.0/fpm-alpine/config/redis.config.php
index 19676160..9429c901 100644
--- a/16.0/fpm-alpine/config/redis.config.php
+++ b/16.0/fpm-alpine/config/redis.config.php
@@ -5,9 +5,13 @@ if (getenv('REDIS_HOST')) {
'memcache.locking' => '\OC\Memcache\Redis',
'redis' => array(
'host' => getenv('REDIS_HOST'),
- 'port' => getenv('REDIS_HOST_PORT') ?: 6379,
'password' => getenv('REDIS_HOST_PASSWORD'),
),
);
-}
+ if (getenv('REDIS_HOST_PORT') !== false) {
+ $CONFIG['redis']['port'] = (int) getenv('REDIS_HOST_PORT');
+ } elseif (getenv('REDIS_HOST')[0] != '/') {
+ $CONFIG['redis']['port'] = 6379;
+ }
+}
diff --git a/16.0/fpm-alpine/entrypoint.sh b/16.0/fpm-alpine/entrypoint.sh
index 9514d881..0104bab6 100755
--- a/16.0/fpm-alpine/entrypoint.sh
+++ b/16.0/fpm-alpine/entrypoint.sh
@@ -25,8 +25,15 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
echo "Configuring Redis as session handler"
{
echo 'session.save_handler = redis'
+ # check if redis host is an unix socket path
+ if [ "$(echo "$REDIS_HOST" | cut -c1-1)" = "/" ]; then
+ if [ -n "${REDIS_HOST_PASSWORD+x}" ]; then
+ echo "session.save_path = \"unix://${REDIS_HOST}?auth=${REDIS_HOST_PASSWORD}\""
+ else
+ echo "session.save_path = \"unix://${REDIS_HOST}\""
+ fi
# check if redis password has been set
- if [ -n "${REDIS_HOST_PASSWORD+x}" ]; then
+ elif [ -n "${REDIS_HOST_PASSWORD+x}" ]; then
echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth=${REDIS_HOST_PASSWORD}\""
else
echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\""
diff --git a/16.0/fpm/config/redis.config.php b/16.0/fpm/config/redis.config.php
index 19676160..9429c901 100644
--- a/16.0/fpm/config/redis.config.php
+++ b/16.0/fpm/config/redis.config.php
@@ -5,9 +5,13 @@ if (getenv('REDIS_HOST')) {
'memcache.locking' => '\OC\Memcache\Redis',
'redis' => array(
'host' => getenv('REDIS_HOST'),
- 'port' => getenv('REDIS_HOST_PORT') ?: 6379,
'password' => getenv('REDIS_HOST_PASSWORD'),
),
);
-}
+ if (getenv('REDIS_HOST_PORT') !== false) {
+ $CONFIG['redis']['port'] = (int) getenv('REDIS_HOST_PORT');
+ } elseif (getenv('REDIS_HOST')[0] != '/') {
+ $CONFIG['redis']['port'] = 6379;
+ }
+}
diff --git a/16.0/fpm/entrypoint.sh b/16.0/fpm/entrypoint.sh
index 9514d881..0104bab6 100755
--- a/16.0/fpm/entrypoint.sh
+++ b/16.0/fpm/entrypoint.sh
@@ -25,8 +25,15 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
echo "Configuring Redis as session handler"
{
echo 'session.save_handler = redis'
+ # check if redis host is an unix socket path
+ if [ "$(echo "$REDIS_HOST" | cut -c1-1)" = "/" ]; then
+ if [ -n "${REDIS_HOST_PASSWORD+x}" ]; then
+ echo "session.save_path = \"unix://${REDIS_HOST}?auth=${REDIS_HOST_PASSWORD}\""
+ else
+ echo "session.save_path = \"unix://${REDIS_HOST}\""
+ fi
# check if redis password has been set
- if [ -n "${REDIS_HOST_PASSWORD+x}" ]; then
+ elif [ -n "${REDIS_HOST_PASSWORD+x}" ]; then
echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth=${REDIS_HOST_PASSWORD}\""
else
echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\""
diff --git a/17.0/apache/config/redis.config.php b/17.0/apache/config/redis.config.php
index 19676160..9429c901 100644
--- a/17.0/apache/config/redis.config.php
+++ b/17.0/apache/config/redis.config.php
@@ -5,9 +5,13 @@ if (getenv('REDIS_HOST')) {
'memcache.locking' => '\OC\Memcache\Redis',
'redis' => array(
'host' => getenv('REDIS_HOST'),
- 'port' => getenv('REDIS_HOST_PORT') ?: 6379,
'password' => getenv('REDIS_HOST_PASSWORD'),
),
);
-}
+ if (getenv('REDIS_HOST_PORT') !== false) {
+ $CONFIG['redis']['port'] = (int) getenv('REDIS_HOST_PORT');
+ } elseif (getenv('REDIS_HOST')[0] != '/') {
+ $CONFIG['redis']['port'] = 6379;
+ }
+}
diff --git a/17.0/apache/entrypoint.sh b/17.0/apache/entrypoint.sh
index 9514d881..0104bab6 100755
--- a/17.0/apache/entrypoint.sh
+++ b/17.0/apache/entrypoint.sh
@@ -25,8 +25,15 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
echo "Configuring Redis as session handler"
{
echo 'session.save_handler = redis'
+ # check if redis host is an unix socket path
+ if [ "$(echo "$REDIS_HOST" | cut -c1-1)" = "/" ]; then
+ if [ -n "${REDIS_HOST_PASSWORD+x}" ]; then
+ echo "session.save_path = \"unix://${REDIS_HOST}?auth=${REDIS_HOST_PASSWORD}\""
+ else
+ echo "session.save_path = \"unix://${REDIS_HOST}\""
+ fi
# check if redis password has been set
- if [ -n "${REDIS_HOST_PASSWORD+x}" ]; then
+ elif [ -n "${REDIS_HOST_PASSWORD+x}" ]; then
echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth=${REDIS_HOST_PASSWORD}\""
else
echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\""
diff --git a/17.0/fpm-alpine/config/redis.config.php b/17.0/fpm-alpine/config/redis.config.php
index 19676160..9429c901 100644
--- a/17.0/fpm-alpine/config/redis.config.php
+++ b/17.0/fpm-alpine/config/redis.config.php
@@ -5,9 +5,13 @@ if (getenv('REDIS_HOST')) {
'memcache.locking' => '\OC\Memcache\Redis',
'redis' => array(
'host' => getenv('REDIS_HOST'),
- 'port' => getenv('REDIS_HOST_PORT') ?: 6379,
'password' => getenv('REDIS_HOST_PASSWORD'),
),
);
-}
+ if (getenv('REDIS_HOST_PORT') !== false) {
+ $CONFIG['redis']['port'] = (int) getenv('REDIS_HOST_PORT');
+ } elseif (getenv('REDIS_HOST')[0] != '/') {
+ $CONFIG['redis']['port'] = 6379;
+ }
+}
diff --git a/17.0/fpm-alpine/entrypoint.sh b/17.0/fpm-alpine/entrypoint.sh
index 9514d881..0104bab6 100755
--- a/17.0/fpm-alpine/entrypoint.sh
+++ b/17.0/fpm-alpine/entrypoint.sh
@@ -25,8 +25,15 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
echo "Configuring Redis as session handler"
{
echo 'session.save_handler = redis'
+ # check if redis host is an unix socket path
+ if [ "$(echo "$REDIS_HOST" | cut -c1-1)" = "/" ]; then
+ if [ -n "${REDIS_HOST_PASSWORD+x}" ]; then
+ echo "session.save_path = \"unix://${REDIS_HOST}?auth=${REDIS_HOST_PASSWORD}\""
+ else
+ echo "session.save_path = \"unix://${REDIS_HOST}\""
+ fi
# check if redis password has been set
- if [ -n "${REDIS_HOST_PASSWORD+x}" ]; then
+ elif [ -n "${REDIS_HOST_PASSWORD+x}" ]; then
echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth=${REDIS_HOST_PASSWORD}\""
else
echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\""
diff --git a/17.0/fpm/config/redis.config.php b/17.0/fpm/config/redis.config.php
index 19676160..9429c901 100644
--- a/17.0/fpm/config/redis.config.php
+++ b/17.0/fpm/config/redis.config.php
@@ -5,9 +5,13 @@ if (getenv('REDIS_HOST')) {
'memcache.locking' => '\OC\Memcache\Redis',
'redis' => array(
'host' => getenv('REDIS_HOST'),
- 'port' => getenv('REDIS_HOST_PORT') ?: 6379,
'password' => getenv('REDIS_HOST_PASSWORD'),
),
);
-}
+ if (getenv('REDIS_HOST_PORT') !== false) {
+ $CONFIG['redis']['port'] = (int) getenv('REDIS_HOST_PORT');
+ } elseif (getenv('REDIS_HOST')[0] != '/') {
+ $CONFIG['redis']['port'] = 6379;
+ }
+}
diff --git a/17.0/fpm/entrypoint.sh b/17.0/fpm/entrypoint.sh
index 9514d881..0104bab6 100755
--- a/17.0/fpm/entrypoint.sh
+++ b/17.0/fpm/entrypoint.sh
@@ -25,8 +25,15 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
echo "Configuring Redis as session handler"
{
echo 'session.save_handler = redis'
+ # check if redis host is an unix socket path
+ if [ "$(echo "$REDIS_HOST" | cut -c1-1)" = "/" ]; then
+ if [ -n "${REDIS_HOST_PASSWORD+x}" ]; then
+ echo "session.save_path = \"unix://${REDIS_HOST}?auth=${REDIS_HOST_PASSWORD}\""
+ else
+ echo "session.save_path = \"unix://${REDIS_HOST}\""
+ fi
# check if redis password has been set
- if [ -n "${REDIS_HOST_PASSWORD+x}" ]; then
+ elif [ -n "${REDIS_HOST_PASSWORD+x}" ]; then
echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth=${REDIS_HOST_PASSWORD}\""
else
echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\""
diff --git a/18.0-rc/apache/config/redis.config.php b/18.0-rc/apache/config/redis.config.php
index 19676160..9429c901 100644
--- a/18.0-rc/apache/config/redis.config.php
+++ b/18.0-rc/apache/config/redis.config.php
@@ -5,9 +5,13 @@ if (getenv('REDIS_HOST')) {
'memcache.locking' => '\OC\Memcache\Redis',
'redis' => array(
'host' => getenv('REDIS_HOST'),
- 'port' => getenv('REDIS_HOST_PORT') ?: 6379,
'password' => getenv('REDIS_HOST_PASSWORD'),
),
);
-}
+ if (getenv('REDIS_HOST_PORT') !== false) {
+ $CONFIG['redis']['port'] = (int) getenv('REDIS_HOST_PORT');
+ } elseif (getenv('REDIS_HOST')[0] != '/') {
+ $CONFIG['redis']['port'] = 6379;
+ }
+}
diff --git a/18.0-rc/apache/entrypoint.sh b/18.0-rc/apache/entrypoint.sh
index 9514d881..0104bab6 100755
--- a/18.0-rc/apache/entrypoint.sh
+++ b/18.0-rc/apache/entrypoint.sh
@@ -25,8 +25,15 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
echo "Configuring Redis as session handler"
{
echo 'session.save_handler = redis'
+ # check if redis host is an unix socket path
+ if [ "$(echo "$REDIS_HOST" | cut -c1-1)" = "/" ]; then
+ if [ -n "${REDIS_HOST_PASSWORD+x}" ]; then
+ echo "session.save_path = \"unix://${REDIS_HOST}?auth=${REDIS_HOST_PASSWORD}\""
+ else
+ echo "session.save_path = \"unix://${REDIS_HOST}\""
+ fi
# check if redis password has been set
- if [ -n "${REDIS_HOST_PASSWORD+x}" ]; then
+ elif [ -n "${REDIS_HOST_PASSWORD+x}" ]; then
echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth=${REDIS_HOST_PASSWORD}\""
else
echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\""
diff --git a/18.0-rc/fpm-alpine/config/redis.config.php b/18.0-rc/fpm-alpine/config/redis.config.php
index 19676160..9429c901 100644
--- a/18.0-rc/fpm-alpine/config/redis.config.php
+++ b/18.0-rc/fpm-alpine/config/redis.config.php
@@ -5,9 +5,13 @@ if (getenv('REDIS_HOST')) {
'memcache.locking' => '\OC\Memcache\Redis',
'redis' => array(
'host' => getenv('REDIS_HOST'),
- 'port' => getenv('REDIS_HOST_PORT') ?: 6379,
'password' => getenv('REDIS_HOST_PASSWORD'),
),
);
-}
+ if (getenv('REDIS_HOST_PORT') !== false) {
+ $CONFIG['redis']['port'] = (int) getenv('REDIS_HOST_PORT');
+ } elseif (getenv('REDIS_HOST')[0] != '/') {
+ $CONFIG['redis']['port'] = 6379;
+ }
+}
diff --git a/18.0-rc/fpm-alpine/entrypoint.sh b/18.0-rc/fpm-alpine/entrypoint.sh
index 9514d881..0104bab6 100755
--- a/18.0-rc/fpm-alpine/entrypoint.sh
+++ b/18.0-rc/fpm-alpine/entrypoint.sh
@@ -25,8 +25,15 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
echo "Configuring Redis as session handler"
{
echo 'session.save_handler = redis'
+ # check if redis host is an unix socket path
+ if [ "$(echo "$REDIS_HOST" | cut -c1-1)" = "/" ]; then
+ if [ -n "${REDIS_HOST_PASSWORD+x}" ]; then
+ echo "session.save_path = \"unix://${REDIS_HOST}?auth=${REDIS_HOST_PASSWORD}\""
+ else
+ echo "session.save_path = \"unix://${REDIS_HOST}\""
+ fi
# check if redis password has been set
- if [ -n "${REDIS_HOST_PASSWORD+x}" ]; then
+ elif [ -n "${REDIS_HOST_PASSWORD+x}" ]; then
echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth=${REDIS_HOST_PASSWORD}\""
else
echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\""
diff --git a/18.0-rc/fpm/config/redis.config.php b/18.0-rc/fpm/config/redis.config.php
index 19676160..9429c901 100644
--- a/18.0-rc/fpm/config/redis.config.php
+++ b/18.0-rc/fpm/config/redis.config.php
@@ -5,9 +5,13 @@ if (getenv('REDIS_HOST')) {
'memcache.locking' => '\OC\Memcache\Redis',
'redis' => array(
'host' => getenv('REDIS_HOST'),
- 'port' => getenv('REDIS_HOST_PORT') ?: 6379,
'password' => getenv('REDIS_HOST_PASSWORD'),
),
);
-}
+ if (getenv('REDIS_HOST_PORT') !== false) {
+ $CONFIG['redis']['port'] = (int) getenv('REDIS_HOST_PORT');
+ } elseif (getenv('REDIS_HOST')[0] != '/') {
+ $CONFIG['redis']['port'] = 6379;
+ }
+}
diff --git a/18.0-rc/fpm/entrypoint.sh b/18.0-rc/fpm/entrypoint.sh
index 9514d881..0104bab6 100755
--- a/18.0-rc/fpm/entrypoint.sh
+++ b/18.0-rc/fpm/entrypoint.sh
@@ -25,8 +25,15 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
echo "Configuring Redis as session handler"
{
echo 'session.save_handler = redis'
+ # check if redis host is an unix socket path
+ if [ "$(echo "$REDIS_HOST" | cut -c1-1)" = "/" ]; then
+ if [ -n "${REDIS_HOST_PASSWORD+x}" ]; then
+ echo "session.save_path = \"unix://${REDIS_HOST}?auth=${REDIS_HOST_PASSWORD}\""
+ else
+ echo "session.save_path = \"unix://${REDIS_HOST}\""
+ fi
# check if redis password has been set
- if [ -n "${REDIS_HOST_PASSWORD+x}" ]; then
+ elif [ -n "${REDIS_HOST_PASSWORD+x}" ]; then
echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth=${REDIS_HOST_PASSWORD}\""
else
echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\""
diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh
index 9514d881..0104bab6 100755
--- a/docker-entrypoint.sh
+++ b/docker-entrypoint.sh
@@ -25,8 +25,15 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
echo "Configuring Redis as session handler"
{
echo 'session.save_handler = redis'
+ # check if redis host is an unix socket path
+ if [ "$(echo "$REDIS_HOST" | cut -c1-1)" = "/" ]; then
+ if [ -n "${REDIS_HOST_PASSWORD+x}" ]; then
+ echo "session.save_path = \"unix://${REDIS_HOST}?auth=${REDIS_HOST_PASSWORD}\""
+ else
+ echo "session.save_path = \"unix://${REDIS_HOST}\""
+ fi
# check if redis password has been set
- if [ -n "${REDIS_HOST_PASSWORD+x}" ]; then
+ elif [ -n "${REDIS_HOST_PASSWORD+x}" ]; then
echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth=${REDIS_HOST_PASSWORD}\""
else
echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\""