Skip to content

Commit

Permalink
Add optional persistence to Redis by using named volume (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
stasadev authored Nov 29, 2023
1 parent eb58276 commit edebed5
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ This repository allows you to quickly install Redis into a [DDEV](https://ddev.r

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.

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.

## Interacting with Redis

* The Redis instance will listen on TCP port 6379 (the Redis default).
Expand Down
2 changes: 1 addition & 1 deletion commands/redis/redis-cli
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
#ddev-generated
## Description: Run redis-cli inside the redis container
## Usage: redis-cli [flags] [args]
## Example: "redis-cli KEYS *" or "ddev redis-cli INFO" or "ddev redis-cli --version"
## Example: "ddev redis-cli KEYS *" or "ddev redis-cli INFO" or "ddev redis-cli --version"

redis-cli -p 6379 -h redis $@
4 changes: 4 additions & 0 deletions docker-compose.redis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,8 @@ services:
volumes:
- ".:/mnt/ddev_config"
- "./redis:/usr/local/etc/redis"
- "redis:/data"
command: ["redis-server", "/usr/local/etc/redis/redis.conf"]

volumes:
redis:
6 changes: 6 additions & 0 deletions redis/redis.conf
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,9 @@

maxmemory 2048mb
maxmemory-policy allkeys-lfu

# If you want to enable Redis persistence,
# remove ddev-generated from this file,
# and comment the two lines below:
appendonly no
save ""

0 comments on commit edebed5

Please sign in to comment.