Overview
This template provides a production‑ready Redis instance as a Monk runnable. You can:- Run it directly to get a managed Redis container with sensible defaults
- Inherit it in your own runnable to seamlessly add an in-memory data store to your stack
What this template manages
- Redis container (
redisimage, configurable tag) - Network service on port 6379
- Persistent volumes for data storage
- Optional password authentication
- Multiple data structures support
Quick start (run directly)
- Load templates
- Run Redis with defaults
- Customize credentials (recommended via inheritance)
variables. Secrets added with monk secrets add will not affect this runnable unless you inherit it and reference those secrets.
- Preferred: inherit and replace variables with
secret("...")as shown below. - Alternative: fork/clone and edit the
variablesinredis/redis.yml, thenmonk load MANIFESTand run.
localhost:6379 (or the runnable hostname inside Monk networks) using any Redis client.
Configuration
Key variables you can customize in this template:${monk-volume-path}/redis on the host.
Use by inheritance (recommended for apps)
Inherit the Redis runnable in your application and declare a connection. Example:Ports and connectivity
- Service:
redison TCP port6379 - From other runnables in the same process group, use
connection-hostname("\<connection-name>")to resolve the Redis host.
Persistence and configuration
- Data path:
${monk-volume-path}/redis:/data - Redis can persist data using RDB snapshots or AOF (Append Only File)
- Configure persistence options in the template variables
Features
- In-memory key-value store
- Multiple data structures (strings, hashes, lists, sets, sorted sets)
- Pub/Sub messaging
- Transactions
- Persistence options (RDB, AOF)
- Lua scripting
- Replication and clustering
Related templates
- High‑availability setup: see the
redis-cluster-sentinel/template in this repository for a Redis Sentinel configuration. - Distributed setup: check
redis-cluster-sentinel-haproxy/for Redis Cluster with HAProxy load balancing. - Combine with databases for caching layer (MySQL, PostgreSQL, MongoDB).
Troubleshooting
- If you changed
redis-passwordbut the container has existing data, authentication may fail. Either reset the data volume or update the password configuration. - Ensure the host volumes are writable by the container user if persistence is enabled.
- Test connection with redis-cli:
- Check logs:
- If memory issues occur, adjust
redis-maxmemoryvariable.