Skip to main content

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
It exposes Redis on port 6379, persists data to a host volume, and supports optional password authentication. Redis is an open-source, in-memory data structure store used as a database, cache, message broker, and streaming engine. It supports various data structures such as strings, hashes, lists, sets, sorted sets, and more.

What this template manages

  • Redis container (redis image, configurable tag)
  • Network service on port 6379
  • Persistent volumes for data storage
  • Optional password authentication
  • Multiple data structures support

Quick start (run directly)

  1. Load templates
  1. Run Redis with defaults
  1. Customize credentials (recommended via inheritance)
Running directly uses the defaults defined in this template’s 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 variables in redis/redis.yml, then monk load MANIFEST and run.
Once started, connect to localhost:6379 (or the runnable hostname inside Monk networks) using any Redis client.

Configuration

Key variables you can customize in this template:
Data is persisted under ${monk-volume-path}/redis on the host. Inherit the Redis runnable in your application and declare a connection. Example:
Then set the secrets once and run your app:

Ports and connectivity

  • Service: redis-svc on TCP port 6379
  • 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
  • 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-password but 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-maxmemory variable.