Merge pull request #600 from marceljd/redis-env-vars

Set Redis through environment variables
This commit is contained in:
Tilo Spannagel 2019-02-07 12:20:53 +01:00 committed by GitHub
commit b9ae3256ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 129 additions and 32 deletions

12
.config/redis.config.php Normal file
View File

@ -0,0 +1,12 @@
<?php
if (getenv('REDIS_HOST')) {
$CONFIG = array (
'memcache.distributed' => '\OC\Memcache\Redis',
'memcache.locking' => '\OC\Memcache\Redis',
'redis' => array(
'host' => getenv('REDIS_HOST'),
'port' => getenv('REDIS_HOST_PORT') ?: 6379,
),
);
}

View File

@ -1,8 +0,0 @@
<?php
$CONFIG = array (
'memcache.locking' => '\OC\Memcache\Redis',
'redis' => array(
'host' => 'redis',
'port' => 6379,
),
);

View File

@ -25,6 +25,7 @@ services:
- nextcloud:/var/www/html - nextcloud:/var/www/html
environment: environment:
- MYSQL_HOST=db - MYSQL_HOST=db
- REDIS_HOST=redis
env_file: env_file:
- db.env - db.env
depends_on: depends_on:

View File

@ -1,8 +0,0 @@
<?php
$CONFIG = array (
'memcache.locking' => '\OC\Memcache\Redis',
'redis' => array(
'host' => 'redis',
'port' => 6379,
),
);

View File

@ -23,6 +23,7 @@ services:
- nextcloud:/var/www/html - nextcloud:/var/www/html
environment: environment:
- MYSQL_HOST=db - MYSQL_HOST=db
- REDIS_HOST=redis
env_file: env_file:
- db.env - db.env
depends_on: depends_on:

View File

@ -1,8 +0,0 @@
<?php
$CONFIG = array (
'memcache.locking' => '\OC\Memcache\Redis',
'redis' => array(
'host' => 'redis',
'port' => 6379,
),
);

View File

@ -26,6 +26,7 @@ services:
- LETSENCRYPT_HOST= - LETSENCRYPT_HOST=
- LETSENCRYPT_EMAIL= - LETSENCRYPT_EMAIL=
- MYSQL_HOST=db - MYSQL_HOST=db
- REDIS_HOST=redis
env_file: env_file:
- db.env - db.env
depends_on: depends_on:

View File

@ -1,8 +0,0 @@
<?php
$CONFIG = array (
'memcache.locking' => '\OC\Memcache\Redis',
'redis' => array(
'host' => 'redis',
'port' => 6379,
),
);

View File

@ -23,6 +23,7 @@ services:
- nextcloud:/var/www/html - nextcloud:/var/www/html
environment: environment:
- MYSQL_HOST=db - MYSQL_HOST=db
- REDIS_HOST=redis
env_file: env_file:
- db.env - db.env
depends_on: depends_on:

View File

@ -0,0 +1,12 @@
<?php
if (getenv('REDIS_HOST')) {
$CONFIG = array (
'memcache.distributed' => '\OC\Memcache\Redis',
'memcache.locking' => '\OC\Memcache\Redis',
'redis' => array(
'host' => getenv('REDIS_HOST'),
'port' => getenv('REDIS_HOST_PORT') ?: 6379,
),
);
}

View File

@ -0,0 +1,12 @@
<?php
if (getenv('REDIS_HOST')) {
$CONFIG = array (
'memcache.distributed' => '\OC\Memcache\Redis',
'memcache.locking' => '\OC\Memcache\Redis',
'redis' => array(
'host' => getenv('REDIS_HOST'),
'port' => getenv('REDIS_HOST_PORT') ?: 6379,
),
);
}

View File

@ -0,0 +1,12 @@
<?php
if (getenv('REDIS_HOST')) {
$CONFIG = array (
'memcache.distributed' => '\OC\Memcache\Redis',
'memcache.locking' => '\OC\Memcache\Redis',
'redis' => array(
'host' => getenv('REDIS_HOST'),
'port' => getenv('REDIS_HOST_PORT') ?: 6379,
),
);
}

View File

@ -0,0 +1,12 @@
<?php
if (getenv('REDIS_HOST')) {
$CONFIG = array (
'memcache.distributed' => '\OC\Memcache\Redis',
'memcache.locking' => '\OC\Memcache\Redis',
'redis' => array(
'host' => getenv('REDIS_HOST'),
'port' => getenv('REDIS_HOST_PORT') ?: 6379,
),
);
}

View File

@ -0,0 +1,12 @@
<?php
if (getenv('REDIS_HOST')) {
$CONFIG = array (
'memcache.distributed' => '\OC\Memcache\Redis',
'memcache.locking' => '\OC\Memcache\Redis',
'redis' => array(
'host' => getenv('REDIS_HOST'),
'port' => getenv('REDIS_HOST_PORT') ?: 6379,
),
);
}

View File

@ -0,0 +1,12 @@
<?php
if (getenv('REDIS_HOST')) {
$CONFIG = array (
'memcache.distributed' => '\OC\Memcache\Redis',
'memcache.locking' => '\OC\Memcache\Redis',
'redis' => array(
'host' => getenv('REDIS_HOST'),
'port' => getenv('REDIS_HOST_PORT') ?: 6379,
),
);
}

View File

@ -0,0 +1,12 @@
<?php
if (getenv('REDIS_HOST')) {
$CONFIG = array (
'memcache.distributed' => '\OC\Memcache\Redis',
'memcache.locking' => '\OC\Memcache\Redis',
'redis' => array(
'host' => getenv('REDIS_HOST'),
'port' => getenv('REDIS_HOST_PORT') ?: 6379,
),
);
}

View File

@ -0,0 +1,12 @@
<?php
if (getenv('REDIS_HOST')) {
$CONFIG = array (
'memcache.distributed' => '\OC\Memcache\Redis',
'memcache.locking' => '\OC\Memcache\Redis',
'redis' => array(
'host' => getenv('REDIS_HOST'),
'port' => getenv('REDIS_HOST_PORT') ?: 6379,
),
);
}

View File

@ -0,0 +1,12 @@
<?php
if (getenv('REDIS_HOST')) {
$CONFIG = array (
'memcache.distributed' => '\OC\Memcache\Redis',
'memcache.locking' => '\OC\Memcache\Redis',
'redis' => array(
'host' => getenv('REDIS_HOST'),
'port' => getenv('REDIS_HOST_PORT') ?: 6379,
),
);
}

View File

@ -130,7 +130,12 @@ The install and update script is only triggered when a default command is used (
- `NEXTCLOUD_UPDATE` (default: _0_) - `NEXTCLOUD_UPDATE` (default: _0_)
If you want to use Redis you have to create a seperate [Redis](https://hub.docker.com/_/redis/) container in your setup / in your docker-compose file. To inform Nextcloud about the Redis container add:
- `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.
The use of Redis is recommended to prevent file locking problems. See the examples for further instructions.
# Running this image with docker-compose # Running this image with docker-compose
The easiest way to get a fully featured and functional setup is using a `docker-compose` file. There are too many different possibilities to setup your system, so here are only some examples what you have to look for. The easiest way to get a fully featured and functional setup is using a `docker-compose` file. There are too many different possibilities to setup your system, so here are only some examples what you have to look for.