redis

Deploy Redis in-memory data store - supports Docker, Kubernetes, package manager, or source build

Recipaie - utrullingsoppskrift

Malen som beskriver hvordan denne tjenesten rulles ut.

Rå JSON
{
  "$schema": "https://recipaie.com/schemas/recipaie.schema.json",
  "name": "redis",
  "version": "1.0.0",
  "description": "Deploy Redis in-memory data store - supports Docker, Kubernetes, package manager, or source build",
  "prerequisites": [
    "One of: Docker, Kubernetes cluster, Linux package manager (apt/yum), or build tools for source compilation",
    "Sufficient memory for your dataset (Redis keeps data in RAM)",
    "Persistent storage if data durability is required"
  ],
  "steps": [
    {
      "order": 1,
      "what": "Choose Redis variant and deployment method",
      "why": "Redis comes in multiple flavors with different features",
      "when": "Before installation",
      "how": "Decide: (1) Standard Redis - basic key-value, (2) Redis Stack - includes RediSearch, RedisJSON, RedisGraph, (3) Redis Cluster - for horizontal scaling. Then choose deployment: Docker, K8s, package manager, or source build",
      "verify": "Variant and method documented",
      "comments": [
        "Redis Stack recommended if you need search or JSON support",
        "Standard Redis is lighter (~5MB) vs Redis Stack (~50MB)",
        "For production: always configure persistence (RDB/AOF)"
      ]
    },
    {
      "order": 2,
      "what": "Create data directory for persistence",
      "why": "Redis can persist data to disk for durability",
      "when": "If data persistence is required",
      "skip_if": "Using ephemeral/cache-only Redis, or directory already exists",
      "how": "Create directory with appropriate permissions: mkdir -p /var/lib/redis && chown redis:redis /var/lib/redis (Linux), or use named volume (Docker), or PersistentVolumeClaim (K8s)",
      "verify": "Directory exists and is writable by Redis process",
      "comments": [
        "Path varies by environment - /var/lib/redis is Linux convention",
        "Docker: use named volumes for persistence across container restarts",
        "K8s: use PVC with appropriate storage class"
      ]
    },
    {
      "order": 3,
      "what": "Install or deploy Redis",
      "why": "Get Redis running in your environment",
      "when": "After prerequisites are ready",
      "skip_if": "Redis already installed and running at target version",
      "how": "Choose method: (Docker) docker run -d --name redis -p 6379:6379 redis:7-alpine, (Docker Stack) redis:7-alpine with volume mounts, (K8s) use Bitnami Redis Helm chart, (Ubuntu/Debian) apt install redis-server, (RHEL/CentOS) dnf install redis, (macOS) brew install redis, (Source) download from redis.io and make install",
      "verify": "redis-cli ping returns PONG",
      "comments": [
        "Use redis:7-alpine for minimal image size (~30MB)",
        "For Redis Stack: redis/redis-stack:latest or redis/redis-stack-server:latest",
        "Production: always set maxmemory and eviction policy"
      ]
    },
    {
      "order": 4,
      "what": "Configure Redis settings",
      "why": "Default settings are for development - production needs tuning",
      "when": "Before exposing to production traffic",
      "skip_if": "Using Redis only for development/testing",
      "how": "Edit redis.conf or pass config via command line: Set maxmemory (e.g., 2gb), maxmemory-policy (e.g., allkeys-lru), save intervals for RDB, appendonly yes for AOF, requirepass for authentication",
      "verify": "redis-cli CONFIG GET maxmemory shows expected value",
      "comments": [
        "Docker: mount custom redis.conf or use --redis-server args",
        "K8s: use ConfigMap for redis.conf",
        "Critical settings: maxmemory, persistence, authentication"
      ]
    },
    {
      "order": 5,
      "what": "Enable authentication",
      "why": "Protect Redis from unauthorized access",
      "when": "If Redis is network-accessible (not just localhost)",
      "skip_if": "Redis bound to localhost only and not exposed externally",
      "how": "Set password: redis-cli CONFIG SET requirepass 'your-secure-password', or in redis.conf: requirepass your-secure-password",
      "verify": "redis-cli AUTH your-secure-password returns OK, unauthenticated commands fail with NOAUTH",
      "comments": [
        "Redis 6+ supports ACLs for fine-grained permissions",
        "Never expose Redis to public internet without authentication",
        "Use strong passwords - Redis is fast at trying passwords too"
      ]
    },
    {
      "order": 6,
      "what": "Verify Redis is operational",
      "why": "Confirm the deployment is working correctly",
      "when": "After deployment and configuration",
      "how": "Test basic operations: SET testkey testvalue, GET testkey, DEL testkey. Check memory: INFO memory. Check persistence: LASTSAVE",
      "verify": "All operations succeed, memory usage within limits"
    }
  ],
  "step_count": 6
}
Versjon: 1.0.0
Steg: 6

Forutsetning

Steg

1 Choose Redis variant and deployment method
Hvorfor
Redis comes in multiple flavors with different features
Når
Before installation
Hvordan
Decide: (1) Standard Redis - basic key-value, (2) Redis Stack - includes RediSearch, RedisJSON, RedisGraph, (3) Redis Cluster - for horizontal scaling. Then choose deployment: Docker, K8s, package manager, or source build
Verifiser
Variant and method documented
Kommentarer
  • Redis Stack recommended if you need search or JSON support
  • Standard Redis is lighter (~5MB) vs Redis Stack (~50MB)
  • For production: always configure persistence (RDB/AOF)
2 Create data directory for persistence
Hvorfor
Redis can persist data to disk for durability
Når
If data persistence is required
Hopp over hvis
Using ephemeral/cache-only Redis, or directory already exists
Hvordan
Create directory with appropriate permissions: mkdir -p /var/lib/redis && chown redis:redis /var/lib/redis (Linux), or use named volume (Docker), or PersistentVolumeClaim (K8s)
Verifiser
Directory exists and is writable by Redis process
Kommentarer
  • Path varies by environment - /var/lib/redis is Linux convention
  • Docker: use named volumes for persistence across container restarts
  • K8s: use PVC with appropriate storage class
3 Install or deploy Redis
Hvorfor
Get Redis running in your environment
Når
After prerequisites are ready
Hopp over hvis
Redis already installed and running at target version
Hvordan
Choose method: (Docker) docker run -d --name redis -p 6379:6379 redis:7-alpine, (Docker Stack) redis:7-alpine with volume mounts, (K8s) use Bitnami Redis Helm chart, (Ubuntu/Debian) apt install redis-server, (RHEL/CentOS) dnf install redis, (macOS) brew install redis, (Source) download from redis.io and make install
Verifiser
redis-cli ping returns PONG
Kommentarer
  • Use redis:7-alpine for minimal image size (~30MB)
  • For Redis Stack: redis/redis-stack:latest or redis/redis-stack-server:latest
  • Production: always set maxmemory and eviction policy
4 Configure Redis settings
Hvorfor
Default settings are for development - production needs tuning
Når
Before exposing to production traffic
Hopp over hvis
Using Redis only for development/testing
Hvordan
Edit redis.conf or pass config via command line: Set maxmemory (e.g., 2gb), maxmemory-policy (e.g., allkeys-lru), save intervals for RDB, appendonly yes for AOF, requirepass for authentication
Verifiser
redis-cli CONFIG GET maxmemory shows expected value
Kommentarer
  • Docker: mount custom redis.conf or use --redis-server args
  • K8s: use ConfigMap for redis.conf
  • Critical settings: maxmemory, persistence, authentication
5 Enable authentication
Hvorfor
Protect Redis from unauthorized access
Når
If Redis is network-accessible (not just localhost)
Hopp over hvis
Redis bound to localhost only and not exposed externally
Hvordan
Set password: redis-cli CONFIG SET requirepass 'your-secure-password', or in redis.conf: requirepass your-secure-password
Verifiser
redis-cli AUTH your-secure-password returns OK, unauthenticated commands fail with NOAUTH
Kommentarer
  • Redis 6+ supports ACLs for fine-grained permissions
  • Never expose Redis to public internet without authentication
  • Use strong passwords - Redis is fast at trying passwords too
6 Verify Redis is operational
Hvorfor
Confirm the deployment is working correctly
Når
After deployment and configuration
Hvordan
Test basic operations: SET testkey testvalue, GET testkey, DEL testkey. Check memory: INFO memory. Check persistence: LASTSAVE
Verifiser
All operations succeed, memory usage within limits

Prodaie - utførelsesrapport

Hva som skjedde da en KI kjørte denne oppskriften i ulike miljøer.

Viktig forskjell: Hvert steg legger til

success

(bool) og

details

(string)-felter for å registrere hva som faktisk skjedde.

Rå JSON
{
  "$schema": "https://recipaie.com/schemas/prodaie.schema.json",
  "name": "redis",
  "description": "Deployment record showing Redis in different environments: Docker, Kubernetes, and package manager",
  "locations": [
    {
      "path": "dev-laptop (Docker)",
      "description": "Local development using Docker",
      "status": "complete",
      "step_count": 6,
      "steps": [
        {
          "order": 1,
          "what": "Choose Redis variant and deployment method",
          "why": "Redis comes in multiple flavors with different features",
          "when": "Before installation",
          "how": "Decide variant and deployment method",
          "verify": "Variant and method documented",
          "success": true,
          "details": "chose Redis Stack for RediSearch support, Docker for isolation"
        },
        {
          "order": 2,
          "what": "Create data directory for persistence",
          "why": "Redis can persist data to disk for durability",
          "when": "If data persistence is required",
          "skip_if": "Using ephemeral Redis",
          "how": "Create named Docker volume",
          "verify": "Volume exists",
          "success": true,
          "details": "created volume: docker volume create redis-dev-data"
        },
        {
          "order": 3,
          "what": "Install or deploy Redis",
          "why": "Get Redis running in your environment",
          "when": "After prerequisites are ready",
          "skip_if": "Redis already running at target version",
          "how": "docker run with Redis Stack image",
          "verify": "redis-cli ping returns PONG",
          "success": true,
          "details": "docker run -d --name redis-dev -p 6379:6379 -v redis-dev-data:/data redis/redis-stack:latest"
        },
        {
          "order": 4,
          "what": "Configure Redis settings",
          "why": "Default settings are for development",
          "when": "Before exposing to production traffic",
          "skip_if": "Using Redis only for development",
          "how": "Set maxmemory and persistence",
          "verify": "CONFIG GET maxmemory shows value",
          "success": true,
          "details": "development use only, defaults are fine"
        },
        {
          "order": 5,
          "what": "Enable authentication",
          "why": "Protect Redis from unauthorized access",
          "when": "If Redis is network-accessible",
          "skip_if": "Redis bound to localhost only",
          "how": "Set requirepass",
          "verify": "Unauthenticated commands fail",
          "success": true,
          "details": "bound to localhost only via -p 127.0.0.1:6379:6379"
        },
        {
          "order": 6,
          "what": "Verify Redis is operational",
          "why": "Confirm the deployment is working correctly",
          "when": "After deployment and configuration",
          "how": "Test basic operations",
          "verify": "All operations succeed",
          "success": true,
          "details": "SET/GET/DEL working, FT._LIST confirms RediSearch loaded"
        }
      ]
    },
    {
      "path": "prod-cluster (Kubernetes)",
      "description": "Production Kubernetes cluster with HA",
      "status": "complete",
      "step_count": 6,
      "steps": [
        {
          "order": 1,
          "what": "Choose Redis variant and deployment method",
          "why": "Redis comes in multiple flavors",
          "when": "Before installation",
          "how": "Decide variant and deployment",
          "verify": "Variant and method documented",
          "success": true,
          "details": "chose standard Redis 7 with Sentinel for HA, Bitnami Helm chart"
        },
        {
          "order": 2,
          "what": "Create data directory for persistence",
          "why": "Redis can persist data to disk",
          "when": "If data persistence required",
          "skip_if": "Using PVC in Helm chart",
          "how": "Create PersistentVolumeClaim",
          "verify": "PVC bound",
          "success": true,
          "details": "Bitnami chart creates PVCs automatically"
        },
        {
          "order": 3,
          "what": "Install or deploy Redis",
          "why": "Get Redis running",
          "when": "After prerequisites ready",
          "skip_if": "Redis already running at target version",
          "how": "helm install redis bitnami/redis --set replica.replicaCount=3",
          "verify": "kubectl get pods shows all replicas Running",
          "success": true,
          "details": "1 master + 3 replicas deployed in redis namespace"
        },
        {
          "order": 4,
          "what": "Configure Redis settings",
          "why": "Production needs tuning",
          "when": "Before production traffic",
          "skip_if": "Using Helm values for config",
          "how": "Configure via Helm values",
          "verify": "CONFIG GET maxmemory shows expected",
          "success": true,
          "details": "set maxmemory=4gb, maxmemory-policy=allkeys-lru via values.yaml"
        },
        {
          "order": 5,
          "what": "Enable authentication",
          "why": "Protect Redis from unauthorized access",
          "when": "If network-accessible",
          "skip_if": "Password set via Helm",
          "how": "Helm chart creates Secret with password",
          "verify": "AUTH required to connect",
          "success": true,
          "details": "password in k8s secret redis-password, injected via REDIS_PASSWORD env"
        },
        {
          "order": 6,
          "what": "Verify Redis is operational",
          "why": "Confirm deployment works",
          "when": "After configuration",
          "how": "Port-forward and test",
          "verify": "All operations succeed",
          "success": true,
          "details": "kubectl port-forward svc/redis-master 6379:6379, all tests passed"
        }
      ]
    },
    {
      "path": "legacy-server (Ubuntu package)",
      "description": "Legacy Ubuntu server using apt package",
      "status": "complete",
      "step_count": 6,
      "steps": [
        {
          "order": 1,
          "what": "Choose Redis variant and deployment method",
          "why": "Redis comes in multiple flavors",
          "when": "Before installation",
          "how": "Decide variant and deployment",
          "verify": "Method documented",
          "success": true,
          "details": "chose standard Redis from Ubuntu repos, systemd for management"
        },
        {
          "order": 2,
          "what": "Create data directory for persistence",
          "why": "Redis needs persistent storage",
          "when": "If data persistence required",
          "skip_if": "Using default /var/lib/redis",
          "how": "Use default package paths",
          "verify": "Directory exists",
          "success": true,
          "details": "apt creates /var/lib/redis automatically"
        },
        {
          "order": 3,
          "what": "Install or deploy Redis",
          "why": "Get Redis running",
          "when": "After prerequisites ready",
          "skip_if": "Redis already at target version",
          "how": "apt install redis-server",
          "verify": "redis-cli ping returns PONG",
          "success": true,
          "details": "apt update && apt install -y redis-server, version 7.0.15"
        },
        {
          "order": 4,
          "what": "Configure Redis settings",
          "why": "Production needs tuning",
          "when": "Before production traffic",
          "skip_if": "Development only",
          "how": "Edit /etc/redis/redis.conf",
          "verify": "CONFIG GET maxmemory shows value",
          "success": true,
          "details": "set maxmemory 2gb, appendonly yes in /etc/redis/redis.conf"
        },
        {
          "order": 5,
          "what": "Enable authentication",
          "why": "Protect Redis",
          "when": "If network-accessible",
          "skip_if": "Localhost only",
          "how": "Set requirepass in config",
          "verify": "AUTH required",
          "success": true,
          "details": "added requirepass to /etc/redis/redis.conf, restarted service"
        },
        {
          "order": 6,
          "what": "Verify Redis is operational",
          "why": "Confirm deployment",
          "when": "After configuration",
          "how": "Test with redis-cli",
          "verify": "All operations succeed",
          "success": true,
          "details": "systemctl status redis-server shows active, SET/GET working"
        }
      ]
    }
  ]
}
Steder: 3

Steder

dev-laptop (Docker) complete

Local development using Docker

Steg: 6
1 Choose Redis variant and deployment method
Hvorfor
Redis comes in multiple flavors with different features
Når
Before installation
Hvordan
Decide variant and deployment method
Verifiser
Variant and method documented
Resultat
chose Redis Stack for RediSearch support, Docker for isolation
2 Create data directory for persistence
Hvorfor
Redis can persist data to disk for durability
Når
If data persistence is required
Hopp over hvis
Using ephemeral Redis
Hvordan
Create named Docker volume
Verifiser
Volume exists
Resultat
created volume: docker volume create redis-dev-data
3 Install or deploy Redis
Hvorfor
Get Redis running in your environment
Når
After prerequisites are ready
Hopp over hvis
Redis already running at target version
Hvordan
docker run with Redis Stack image
Verifiser
redis-cli ping returns PONG
Resultat
docker run -d --name redis-dev -p 6379:6379 -v redis-dev-data:/data redis/redis-stack:latest
4 Configure Redis settings
Hvorfor
Default settings are for development
Når
Before exposing to production traffic
Hopp over hvis
Using Redis only for development
Hvordan
Set maxmemory and persistence
Verifiser
CONFIG GET maxmemory shows value
Resultat
development use only, defaults are fine
5 Enable authentication
Hvorfor
Protect Redis from unauthorized access
Når
If Redis is network-accessible
Hopp over hvis
Redis bound to localhost only
Hvordan
Set requirepass
Verifiser
Unauthenticated commands fail
Resultat
bound to localhost only via -p 127.0.0.1:6379:6379
6 Verify Redis is operational
Hvorfor
Confirm the deployment is working correctly
Når
After deployment and configuration
Hvordan
Test basic operations
Verifiser
All operations succeed
Resultat
SET/GET/DEL working, FT._LIST confirms RediSearch loaded
prod-cluster (Kubernetes) complete

Production Kubernetes cluster with HA

Steg: 6
1 Choose Redis variant and deployment method
Hvorfor
Redis comes in multiple flavors
Når
Before installation
Hvordan
Decide variant and deployment
Verifiser
Variant and method documented
Resultat
chose standard Redis 7 with Sentinel for HA, Bitnami Helm chart
2 Create data directory for persistence
Hvorfor
Redis can persist data to disk
Når
If data persistence required
Hopp over hvis
Using PVC in Helm chart
Hvordan
Create PersistentVolumeClaim
Verifiser
PVC bound
Resultat
Bitnami chart creates PVCs automatically
3 Install or deploy Redis
Hvorfor
Get Redis running
Når
After prerequisites ready
Hopp over hvis
Redis already running at target version
Hvordan
helm install redis bitnami/redis --set replica.replicaCount=3
Verifiser
kubectl get pods shows all replicas Running
Resultat
1 master + 3 replicas deployed in redis namespace
4 Configure Redis settings
Hvorfor
Production needs tuning
Når
Before production traffic
Hopp over hvis
Using Helm values for config
Hvordan
Configure via Helm values
Verifiser
CONFIG GET maxmemory shows expected
Resultat
set maxmemory=4gb, maxmemory-policy=allkeys-lru via values.yaml
5 Enable authentication
Hvorfor
Protect Redis from unauthorized access
Når
If network-accessible
Hopp over hvis
Password set via Helm
Hvordan
Helm chart creates Secret with password
Verifiser
AUTH required to connect
Resultat
password in k8s secret redis-password, injected via REDIS_PASSWORD env
6 Verify Redis is operational
Hvorfor
Confirm deployment works
Når
After configuration
Hvordan
Port-forward and test
Verifiser
All operations succeed
Resultat
kubectl port-forward svc/redis-master 6379:6379, all tests passed
legacy-server (Ubuntu package) complete

Legacy Ubuntu server using apt package

Steg: 6
1 Choose Redis variant and deployment method
Hvorfor
Redis comes in multiple flavors
Når
Before installation
Hvordan
Decide variant and deployment
Verifiser
Method documented
Resultat
chose standard Redis from Ubuntu repos, systemd for management
2 Create data directory for persistence
Hvorfor
Redis needs persistent storage
Når
If data persistence required
Hopp over hvis
Using default /var/lib/redis
Hvordan
Use default package paths
Verifiser
Directory exists
Resultat
apt creates /var/lib/redis automatically
3 Install or deploy Redis
Hvorfor
Get Redis running
Når
After prerequisites ready
Hopp over hvis
Redis already at target version
Hvordan
apt install redis-server
Verifiser
redis-cli ping returns PONG
Resultat
apt update && apt install -y redis-server, version 7.0.15
4 Configure Redis settings
Hvorfor
Production needs tuning
Når
Before production traffic
Hopp over hvis
Development only
Hvordan
Edit /etc/redis/redis.conf
Verifiser
CONFIG GET maxmemory shows value
Resultat
set maxmemory 2gb, appendonly yes in /etc/redis/redis.conf
5 Enable authentication
Hvorfor
Protect Redis
Når
If network-accessible
Hopp over hvis
Localhost only
Hvordan
Set requirepass in config
Verifiser
AUTH required
Resultat
added requirepass to /etc/redis/redis.conf, restarted service
6 Verify Redis is operational
Hvorfor
Confirm deployment
Når
After configuration
Hvordan
Test with redis-cli
Verifiser
All operations succeed
Resultat
systemctl status redis-server shows active, SET/GET working