0
0
Fork 0
mirror of https://github.com/nextcloud/docker.git synced 2024-12-25 02:26:13 +01:00

Set redis password (#856)

This commit is contained in:
algakzru 2019-09-10 08:31:16 +08:00 committed by J0WI
parent 892ac14791
commit 73ff5c860d
27 changed files with 92 additions and 13 deletions

View file

@ -6,6 +6,7 @@ if (getenv('REDIS_HOST')) {
'redis' => array( 'redis' => array(
'host' => getenv('REDIS_HOST'), 'host' => getenv('REDIS_HOST'),
'port' => getenv('REDIS_HOST_PORT') ?: 6379, 'port' => getenv('REDIS_HOST_PORT') ?: 6379,
'password' => getenv('REDIS_HOST_PASSWORD'),
), ),
); );
} }

View file

@ -6,6 +6,7 @@ if (getenv('REDIS_HOST')) {
'redis' => array( 'redis' => array(
'host' => getenv('REDIS_HOST'), 'host' => getenv('REDIS_HOST'),
'port' => getenv('REDIS_HOST_PORT') ?: 6379, 'port' => getenv('REDIS_HOST_PORT') ?: 6379,
'password' => getenv('REDIS_HOST_PASSWORD'),
), ),
); );
} }

View file

@ -25,7 +25,12 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
echo "Configuring Redis as session handler" echo "Configuring Redis as session handler"
{ {
echo 'session.save_handler = redis' echo 'session.save_handler = redis'
echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\"" # check if redis password has been set
if [ -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}\""
fi
} > /usr/local/etc/php/conf.d/redis-session.ini } > /usr/local/etc/php/conf.d/redis-session.ini
fi fi

View file

@ -6,6 +6,7 @@ if (getenv('REDIS_HOST')) {
'redis' => array( 'redis' => array(
'host' => getenv('REDIS_HOST'), 'host' => getenv('REDIS_HOST'),
'port' => getenv('REDIS_HOST_PORT') ?: 6379, 'port' => getenv('REDIS_HOST_PORT') ?: 6379,
'password' => getenv('REDIS_HOST_PASSWORD'),
), ),
); );
} }

View file

@ -25,7 +25,12 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
echo "Configuring Redis as session handler" echo "Configuring Redis as session handler"
{ {
echo 'session.save_handler = redis' echo 'session.save_handler = redis'
echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\"" # check if redis password has been set
if [ -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}\""
fi
} > /usr/local/etc/php/conf.d/redis-session.ini } > /usr/local/etc/php/conf.d/redis-session.ini
fi fi

View file

@ -6,6 +6,7 @@ if (getenv('REDIS_HOST')) {
'redis' => array( 'redis' => array(
'host' => getenv('REDIS_HOST'), 'host' => getenv('REDIS_HOST'),
'port' => getenv('REDIS_HOST_PORT') ?: 6379, 'port' => getenv('REDIS_HOST_PORT') ?: 6379,
'password' => getenv('REDIS_HOST_PASSWORD'),
), ),
); );
} }

View file

@ -25,7 +25,12 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
echo "Configuring Redis as session handler" echo "Configuring Redis as session handler"
{ {
echo 'session.save_handler = redis' echo 'session.save_handler = redis'
echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\"" # check if redis password has been set
if [ -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}\""
fi
} > /usr/local/etc/php/conf.d/redis-session.ini } > /usr/local/etc/php/conf.d/redis-session.ini
fi fi

View file

@ -6,6 +6,7 @@ if (getenv('REDIS_HOST')) {
'redis' => array( 'redis' => array(
'host' => getenv('REDIS_HOST'), 'host' => getenv('REDIS_HOST'),
'port' => getenv('REDIS_HOST_PORT') ?: 6379, 'port' => getenv('REDIS_HOST_PORT') ?: 6379,
'password' => getenv('REDIS_HOST_PASSWORD'),
), ),
); );
} }

View file

@ -25,7 +25,12 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
echo "Configuring Redis as session handler" echo "Configuring Redis as session handler"
{ {
echo 'session.save_handler = redis' echo 'session.save_handler = redis'
echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\"" # check if redis password has been set
if [ -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}\""
fi
} > /usr/local/etc/php/conf.d/redis-session.ini } > /usr/local/etc/php/conf.d/redis-session.ini
fi fi

View file

@ -6,6 +6,7 @@ if (getenv('REDIS_HOST')) {
'redis' => array( 'redis' => array(
'host' => getenv('REDIS_HOST'), 'host' => getenv('REDIS_HOST'),
'port' => getenv('REDIS_HOST_PORT') ?: 6379, 'port' => getenv('REDIS_HOST_PORT') ?: 6379,
'password' => getenv('REDIS_HOST_PASSWORD'),
), ),
); );
} }

View file

@ -25,7 +25,12 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
echo "Configuring Redis as session handler" echo "Configuring Redis as session handler"
{ {
echo 'session.save_handler = redis' echo 'session.save_handler = redis'
echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\"" # check if redis password has been set
if [ -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}\""
fi
} > /usr/local/etc/php/conf.d/redis-session.ini } > /usr/local/etc/php/conf.d/redis-session.ini
fi fi

View file

@ -6,6 +6,7 @@ if (getenv('REDIS_HOST')) {
'redis' => array( 'redis' => array(
'host' => getenv('REDIS_HOST'), 'host' => getenv('REDIS_HOST'),
'port' => getenv('REDIS_HOST_PORT') ?: 6379, 'port' => getenv('REDIS_HOST_PORT') ?: 6379,
'password' => getenv('REDIS_HOST_PASSWORD'),
), ),
); );
} }

View file

@ -25,7 +25,12 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
echo "Configuring Redis as session handler" echo "Configuring Redis as session handler"
{ {
echo 'session.save_handler = redis' echo 'session.save_handler = redis'
echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\"" # check if redis password has been set
if [ -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}\""
fi
} > /usr/local/etc/php/conf.d/redis-session.ini } > /usr/local/etc/php/conf.d/redis-session.ini
fi fi

View file

@ -6,6 +6,7 @@ if (getenv('REDIS_HOST')) {
'redis' => array( 'redis' => array(
'host' => getenv('REDIS_HOST'), 'host' => getenv('REDIS_HOST'),
'port' => getenv('REDIS_HOST_PORT') ?: 6379, 'port' => getenv('REDIS_HOST_PORT') ?: 6379,
'password' => getenv('REDIS_HOST_PASSWORD'),
), ),
); );
} }

View file

@ -25,7 +25,12 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
echo "Configuring Redis as session handler" echo "Configuring Redis as session handler"
{ {
echo 'session.save_handler = redis' echo 'session.save_handler = redis'
echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\"" # check if redis password has been set
if [ -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}\""
fi
} > /usr/local/etc/php/conf.d/redis-session.ini } > /usr/local/etc/php/conf.d/redis-session.ini
fi fi

View file

@ -6,6 +6,7 @@ if (getenv('REDIS_HOST')) {
'redis' => array( 'redis' => array(
'host' => getenv('REDIS_HOST'), 'host' => getenv('REDIS_HOST'),
'port' => getenv('REDIS_HOST_PORT') ?: 6379, 'port' => getenv('REDIS_HOST_PORT') ?: 6379,
'password' => getenv('REDIS_HOST_PASSWORD'),
), ),
); );
} }

View file

@ -25,7 +25,12 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
echo "Configuring Redis as session handler" echo "Configuring Redis as session handler"
{ {
echo 'session.save_handler = redis' echo 'session.save_handler = redis'
echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\"" # check if redis password has been set
if [ -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}\""
fi
} > /usr/local/etc/php/conf.d/redis-session.ini } > /usr/local/etc/php/conf.d/redis-session.ini
fi fi

View file

@ -6,6 +6,7 @@ if (getenv('REDIS_HOST')) {
'redis' => array( 'redis' => array(
'host' => getenv('REDIS_HOST'), 'host' => getenv('REDIS_HOST'),
'port' => getenv('REDIS_HOST_PORT') ?: 6379, 'port' => getenv('REDIS_HOST_PORT') ?: 6379,
'password' => getenv('REDIS_HOST_PASSWORD'),
), ),
); );
} }

View file

@ -25,7 +25,12 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
echo "Configuring Redis as session handler" echo "Configuring Redis as session handler"
{ {
echo 'session.save_handler = redis' echo 'session.save_handler = redis'
echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\"" # check if redis password has been set
if [ -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}\""
fi
} > /usr/local/etc/php/conf.d/redis-session.ini } > /usr/local/etc/php/conf.d/redis-session.ini
fi fi

View file

@ -6,6 +6,7 @@ if (getenv('REDIS_HOST')) {
'redis' => array( 'redis' => array(
'host' => getenv('REDIS_HOST'), 'host' => getenv('REDIS_HOST'),
'port' => getenv('REDIS_HOST_PORT') ?: 6379, 'port' => getenv('REDIS_HOST_PORT') ?: 6379,
'password' => getenv('REDIS_HOST_PASSWORD'),
), ),
); );
} }

View file

@ -25,7 +25,12 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
echo "Configuring Redis as session handler" echo "Configuring Redis as session handler"
{ {
echo 'session.save_handler = redis' echo 'session.save_handler = redis'
echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\"" # check if redis password has been set
if [ -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}\""
fi
} > /usr/local/etc/php/conf.d/redis-session.ini } > /usr/local/etc/php/conf.d/redis-session.ini
fi fi

View file

@ -6,6 +6,7 @@ if (getenv('REDIS_HOST')) {
'redis' => array( 'redis' => array(
'host' => getenv('REDIS_HOST'), 'host' => getenv('REDIS_HOST'),
'port' => getenv('REDIS_HOST_PORT') ?: 6379, 'port' => getenv('REDIS_HOST_PORT') ?: 6379,
'password' => getenv('REDIS_HOST_PASSWORD'),
), ),
); );
} }

View file

@ -25,7 +25,12 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
echo "Configuring Redis as session handler" echo "Configuring Redis as session handler"
{ {
echo 'session.save_handler = redis' echo 'session.save_handler = redis'
echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\"" # check if redis password has been set
if [ -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}\""
fi
} > /usr/local/etc/php/conf.d/redis-session.ini } > /usr/local/etc/php/conf.d/redis-session.ini
fi fi

View file

@ -6,6 +6,7 @@ if (getenv('REDIS_HOST')) {
'redis' => array( 'redis' => array(
'host' => getenv('REDIS_HOST'), 'host' => getenv('REDIS_HOST'),
'port' => getenv('REDIS_HOST_PORT') ?: 6379, 'port' => getenv('REDIS_HOST_PORT') ?: 6379,
'password' => getenv('REDIS_HOST_PASSWORD'),
), ),
); );
} }

View file

@ -25,7 +25,12 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
echo "Configuring Redis as session handler" echo "Configuring Redis as session handler"
{ {
echo 'session.save_handler = redis' echo 'session.save_handler = redis'
echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\"" # check if redis password has been set
if [ -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}\""
fi
} > /usr/local/etc/php/conf.d/redis-session.ini } > /usr/local/etc/php/conf.d/redis-session.ini
fi fi

View file

@ -141,6 +141,7 @@ If you want to use Redis you have to create a separate [Redis](https://hub.docke
- `REDIS_HOST` (not set by default) Name of Redis container - `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_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
The use of Redis is recommended to prevent file locking problems. See the examples for further instructions. The use of Redis is recommended to prevent file locking problems. See the examples for further instructions.

View file

@ -25,7 +25,12 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
echo "Configuring Redis as session handler" echo "Configuring Redis as session handler"
{ {
echo 'session.save_handler = redis' echo 'session.save_handler = redis'
echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\"" # check if redis password has been set
if [ -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}\""
fi
} > /usr/local/etc/php/conf.d/redis-session.ini } > /usr/local/etc/php/conf.d/redis-session.ini
fi fi