Skip to content

Commit edebed5

Browse files
authored
Add optional persistence to Redis by using named volume (#19)
1 parent eb58276 commit edebed5

File tree

4 files changed

+13
-1
lines changed

4 files changed

+13
-1
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ This repository allows you to quickly install Redis into a [DDEV](https://ddev.r
1313

1414
This Redis recipe for [DDEV](https://ddev.readthedocs.io) installs a [`.ddev/docker-compose.redis.yaml`](docker-compose.redis.yaml) using the `redis` Docker image.
1515

16+
Persistence is disabled by default (see [redis.conf](./redis/redis.conf)), follow the config instructions to enable it, or switch to https://github.com/ddev/ddev-redis-7 where it is enabled by default.
17+
1618
## Interacting with Redis
1719

1820
* The Redis instance will listen on TCP port 6379 (the Redis default).

commands/redis/redis-cli

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
#ddev-generated
33
## Description: Run redis-cli inside the redis container
44
## Usage: redis-cli [flags] [args]
5-
## Example: "redis-cli KEYS *" or "ddev redis-cli INFO" or "ddev redis-cli --version"
5+
## Example: "ddev redis-cli KEYS *" or "ddev redis-cli INFO" or "ddev redis-cli --version"
66

77
redis-cli -p 6379 -h redis $@

docker-compose.redis.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,8 @@ services:
1010
volumes:
1111
- ".:/mnt/ddev_config"
1212
- "./redis:/usr/local/etc/redis"
13+
- "redis:/data"
1314
command: ["redis-server", "/usr/local/etc/redis/redis.conf"]
15+
16+
volumes:
17+
redis:

redis/redis.conf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,9 @@
66

77
maxmemory 2048mb
88
maxmemory-policy allkeys-lfu
9+
10+
# If you want to enable Redis persistence,
11+
# remove ddev-generated from this file,
12+
# and comment the two lines below:
13+
appendonly no
14+
save ""

0 commit comments

Comments
 (0)