Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add optional persistence to Redis by using named volume #19

Merged
merged 1 commit into from
Nov 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 ""