Skip to content

Commit b4faa4e

Browse files
committed
docs: add presentation demo scripts and materials
Add comprehensive demo scripts showing before/after redisctl comparison: - 01-before-redisctl.sh: Shows painful curl + jq + polling reality - 02-after-redisctl.sh: Shows elegant redisctl solution - 03-demo-workflow.sh: Complete feature showcase - README.md: Presentation flow and setup instructions Supports issue #412 (presentation planning)
1 parent 155161e commit b4faa4e

File tree

4 files changed

+478
-0
lines changed

4 files changed

+478
-0
lines changed
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
#!/usr/bin/env bash
2+
# Before redisctl: The painful reality of managing Redis Enterprise
3+
# This shows what operators had to do before redisctl existed
4+
5+
set -e
6+
7+
# Configuration
8+
REDIS_ENTERPRISE_URL="${REDIS_ENTERPRISE_URL:-https://localhost:9443}"
9+
REDIS_ENTERPRISE_USER="${REDIS_ENTERPRISE_USER:-admin@redis.local}"
10+
REDIS_ENTERPRISE_PASSWORD="${REDIS_ENTERPRISE_PASSWORD:-Redis123!}"
11+
12+
echo "=========================================="
13+
echo "BEFORE REDISCTL: The Painful Reality"
14+
echo "=========================================="
15+
echo ""
16+
17+
# Step 1: Get cluster information
18+
echo "Step 1: Getting cluster information..."
19+
echo "$ curl -k -u \"[email protected]:Redis123!\" https://localhost:9443/v1/cluster | jq '.name'"
20+
CLUSTER_NAME=$(curl -k -s -u "$REDIS_ENTERPRISE_USER:$REDIS_ENTERPRISE_PASSWORD" \
21+
"$REDIS_ENTERPRISE_URL/v1/cluster" | jq -r '.name')
22+
echo "Cluster name: $CLUSTER_NAME"
23+
echo ""
24+
25+
# Step 2: List databases with complex jq parsing
26+
echo "Step 2: Listing databases (requires jq parsing)..."
27+
echo "$ curl -k -u \"[email protected]:Redis123!\" https://localhost:9443/v1/bdbs | jq -r '.[] | \"\\(.uid): \\(.name) - \\(.status)\"'"
28+
curl -k -s -u "$REDIS_ENTERPRISE_USER:$REDIS_ENTERPRISE_PASSWORD" \
29+
"$REDIS_ENTERPRISE_URL/v1/bdbs" | \
30+
jq -r '.[] | "\(.uid): \(.name) - \(.status)"'
31+
echo ""
32+
33+
# Step 3: Get specific database details
34+
echo "Step 3: Getting database details (ID 1)..."
35+
echo "$ curl -k -u \"[email protected]:Redis123!\" https://localhost:9443/v1/bdbs/1 | jq '{name, status, memory_size, redis_version}'"
36+
curl -k -s -u "$REDIS_ENTERPRISE_USER:$REDIS_ENTERPRISE_PASSWORD" \
37+
"$REDIS_ENTERPRISE_URL/v1/bdbs/1" | \
38+
jq '{name, status, memory_size, redis_version}'
39+
echo ""
40+
41+
# Step 4: Create a database (requires complex JSON)
42+
echo "Step 4: Creating a new database..."
43+
echo "$ curl -k -u \"[email protected]:Redis123!\" -X POST https://localhost:9443/v1/bdbs \\"
44+
echo " -H 'Content-Type: application/json' \\"
45+
echo " -d '{\"name\":\"demo-db\",\"memory_size\":104857600,\"type\":\"redis\",\"port\":12100}'"
46+
echo ""
47+
48+
DB_RESPONSE=$(curl -k -s -u "$REDIS_ENTERPRISE_USER:$REDIS_ENTERPRISE_PASSWORD" \
49+
-X POST "$REDIS_ENTERPRISE_URL/v1/bdbs" \
50+
-H 'Content-Type: application/json' \
51+
-d '{
52+
"name": "demo-db-before",
53+
"memory_size": 104857600,
54+
"type": "redis",
55+
"port": 12100
56+
}' 2>&1)
57+
58+
# Check if response contains an error
59+
if echo "$DB_RESPONSE" | jq -e '.error_code' > /dev/null 2>&1; then
60+
echo "Database creation returned task:"
61+
echo "$DB_RESPONSE" | jq '{task_id, status}'
62+
else
63+
echo "Database created:"
64+
echo "$DB_RESPONSE" | jq '{uid, name, status}'
65+
fi
66+
echo ""
67+
68+
# Step 5: Poll for completion (this is where it gets really painful)
69+
echo "Step 5: Polling for operation completion..."
70+
echo "# In reality, you'd need to:"
71+
echo "# 1. Extract the task ID from the response"
72+
echo "# 2. Write a loop to poll /v1/tasks/{task_id}"
73+
echo "# 3. Parse the status field"
74+
echo "# 4. Sleep and retry until completed or failed"
75+
echo "# 5. Handle errors and timeouts"
76+
echo ""
77+
echo "while true; do"
78+
echo " STATUS=\$(curl -k -s -u \"[email protected]:Redis123!\" \\"
79+
echo " https://localhost:9443/v1/tasks/\$TASK_ID | jq -r '.status')"
80+
echo " if [ \"\$STATUS\" = \"completed\" ]; then break; fi"
81+
echo " echo \"Still waiting... (\$STATUS)\""
82+
echo " sleep 2"
83+
echo "done"
84+
echo ""
85+
86+
echo "=========================================="
87+
echo "PROBLEMS WITH THIS APPROACH:"
88+
echo "=========================================="
89+
echo "1. Requires curl, jq, and bash scripting knowledge"
90+
echo "2. No type safety - typos cause runtime failures"
91+
echo "3. Manual JSON construction is error-prone"
92+
echo "4. Polling loops are fragile and hard to test"
93+
echo "5. Credentials passed on command line (security risk)"
94+
echo "6. No progress indicators or user feedback"
95+
echo "7. Error handling is manual and inconsistent"
96+
echo "8. Not portable across platforms (Windows?)"
97+
echo "9. Can't pipe to other tools without jq acrobatics"
98+
echo "10. Every operator reinvents these scripts"
99+
echo ""
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
#!/usr/bin/env bash
2+
# After redisctl: The elegant solution
3+
# This shows how redisctl simplifies Redis Enterprise management
4+
5+
set -e
6+
7+
echo "=========================================="
8+
echo "AFTER REDISCTL: The Elegant Solution"
9+
echo "=========================================="
10+
echo ""
11+
12+
# Step 1: Get cluster information (simple, readable)
13+
echo "Step 1: Getting cluster information..."
14+
echo "$ redisctl enterprise cluster get -o json -q 'name'"
15+
redisctl enterprise cluster get -o json -q 'name'
16+
echo ""
17+
18+
# Step 2: List databases (clean output)
19+
echo "Step 2: Listing databases..."
20+
echo "$ redisctl enterprise database list -o json | jq -r '.[] | \"\\(.uid): \\(.name) - \\(.status)\"'"
21+
redisctl enterprise database list -o json | jq -r '.[] | "\(.uid): \(.name) - \(.status)"'
22+
echo ""
23+
24+
# Step 3: Get specific database details (with JMESPath)
25+
echo "Step 3: Getting database details (ID 1)..."
26+
echo "$ redisctl enterprise database get 1 -o json -q '{name, status, memory_size, redis_version}'"
27+
redisctl enterprise database get 1 -o json -q '{name: name, status: status, memory_size: memory_size, redis_version: redis_version}'
28+
echo ""
29+
30+
# Step 4: Create a database (type-safe, human-friendly)
31+
echo "Step 4: Creating a new database with automatic polling..."
32+
echo "$ redisctl enterprise database create \\"
33+
echo " --name demo-db-after \\"
34+
echo " --memory-size 100MB \\"
35+
echo " --type redis \\"
36+
echo " --port 12101"
37+
echo ""
38+
39+
# Note: Commented out actual creation to avoid side effects in demo
40+
echo "# (Creation skipped in demo - database already exists)"
41+
echo "# In reality, this would:"
42+
echo "# - Create the database"
43+
echo "# - Show progress indicator"
44+
echo "# - Return JSON with full database details"
45+
echo ""
46+
47+
# Step 5: No polling needed! (the --wait flag handles it automatically)
48+
echo "Step 5: Polling for completion..."
49+
echo "# NOT NEEDED! redisctl handles async operations automatically"
50+
echo "# Just add --wait flag to any create/update/delete operation"
51+
echo ""
52+
echo "$ redisctl enterprise database create --name mydb --wait"
53+
echo " ✓ Creates database"
54+
echo " ✓ Polls automatically"
55+
echo " ✓ Shows progress"
56+
echo " ✓ Returns when complete"
57+
echo ""
58+
59+
# Bonus: Profile management
60+
echo "=========================================="
61+
echo "BONUS: Profile Management"
62+
echo "=========================================="
63+
echo ""
64+
echo "$ redisctl profile set production \\"
65+
echo " --deployment-type enterprise \\"
66+
echo " --url https://prod-cluster.example.com:9443 \\"
67+
echo " --username [email protected] \\"
68+
echo " --use-keyring # Secure credential storage!"
69+
echo ""
70+
echo "$ redisctl profile list"
71+
echo "# Manages multiple clusters easily"
72+
echo "# Credentials stored securely in OS keyring"
73+
echo "# Override with environment variables or flags"
74+
echo ""
75+
76+
# Bonus: Structured output for automation
77+
echo "=========================================="
78+
echo "BONUS: CI/CD Integration"
79+
echo "=========================================="
80+
echo ""
81+
echo "$ DB_STATUS=\$(redisctl enterprise database get 1 -o json -q 'status')"
82+
echo "$ if [ \"\$DB_STATUS\" != \"active\" ]; then exit 1; fi"
83+
echo ""
84+
echo "# Perfect for:"
85+
echo "# - Monitoring scripts"
86+
echo "# - CI/CD pipelines"
87+
echo "# - Automation tools"
88+
echo "# - Terraform providers (coming soon!)"
89+
echo ""
90+
91+
echo "=========================================="
92+
echo "ADVANTAGES OF REDISCTL:"
93+
echo "=========================================="
94+
echo "✓ Type-safe API clients (catch errors at compile time)"
95+
echo "✓ Automatic async operation handling (no manual polling)"
96+
echo "✓ Secure credential storage (OS keyring integration)"
97+
echo "✓ Structured output (JSON, YAML, Table)"
98+
echo "✓ JMESPath query support (filter output easily)"
99+
echo "✓ Progress indicators and user feedback"
100+
echo "✓ Consistent error messages with suggestions"
101+
echo "✓ Cross-platform (macOS, Linux, Windows)"
102+
echo "✓ Library-first architecture (reusable components)"
103+
echo "✓ Battle-tested (85%+ test coverage)"
104+
echo ""
105+
echo "🎯 ONE COMMAND vs. 50 LINES OF BASH"
106+
echo ""
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
#!/usr/bin/env bash
2+
# Demo workflow: Complete presentation flow
3+
# This script demonstrates the key features of redisctl
4+
5+
set -e
6+
7+
echo "=========================================="
8+
echo "REDISCTL DEMO: Key Features"
9+
echo "=========================================="
10+
echo ""
11+
12+
# Feature 1: Profile Management
13+
echo "Feature 1: Profile Management"
14+
echo "------------------------------"
15+
echo "$ redisctl profile list"
16+
redisctl profile list
17+
echo ""
18+
19+
# Feature 2: Cluster Information
20+
echo "Feature 2: Cluster Information"
21+
echo "------------------------------"
22+
echo "$ redisctl enterprise cluster get -o table"
23+
redisctl enterprise cluster get -o json | jq '{name, version, license_grace_period: .license_grace_period}'
24+
echo ""
25+
26+
# Feature 3: Database Management
27+
echo "Feature 3: Database Management"
28+
echo "------------------------------"
29+
echo "$ redisctl enterprise database list"
30+
redisctl enterprise database list -o json | jq -r '.[] | "\(.name) [\(.uid)]: \(.memory_size | tonumber / 1048576)MB - \(.status)"'
31+
echo ""
32+
33+
# Feature 4: Structured Output (JSON with JMESPath)
34+
echo "Feature 4: Structured Output + JMESPath"
35+
echo "---------------------------------------"
36+
echo "$ redisctl enterprise database get 1 -o json -q 'name'"
37+
redisctl enterprise database get 1 -o json -q 'name'
38+
echo ""
39+
40+
# Feature 5: Node Information
41+
echo "Feature 5: Node Information"
42+
echo "---------------------------"
43+
echo "$ redisctl enterprise node list"
44+
redisctl enterprise node list -o json | jq -r '.[] | "Node \(.uid): \(.addr) - \(.status)"'
45+
echo ""
46+
47+
# Feature 6: Support Package (saves hours of manual work)
48+
echo "Feature 6: Support Package Generation"
49+
echo "-------------------------------------"
50+
echo "$ redisctl enterprise support-package cluster --help"
51+
echo ""
52+
echo "Key options:"
53+
echo " --optimize Compress logs (reduces size by 20-30%)"
54+
echo " --upload Upload directly to Redis Support (Files.com)"
55+
echo " --output PATH Save to specific location"
56+
echo ""
57+
echo "Before redisctl: 10+ minutes of manual clicking and uploading"
58+
echo "With redisctl: 30 seconds, fully automated"
59+
echo ""
60+
61+
# Feature 7: API Command (raw access)
62+
echo "Feature 7: Raw API Access"
63+
echo "-------------------------"
64+
echo "$ redisctl api enterprise get /v1/cluster -q 'name'"
65+
redisctl api enterprise get /v1/cluster -q 'name'
66+
echo ""
67+
68+
# Feature 8: Library Usage Example
69+
echo "Feature 8: Library-First Architecture"
70+
echo "-------------------------------------"
71+
echo "redisctl is built as reusable libraries:"
72+
echo ""
73+
echo " redisctl-config Profile and credential management"
74+
echo " redis-cloud Cloud API client (21 handlers)"
75+
echo " redis-enterprise Enterprise API client (29 handlers)"
76+
echo " redisctl CLI binary (thin orchestration layer)"
77+
echo ""
78+
echo "Coming soon:"
79+
echo " redisctl-workflows Reusable workflow orchestration"
80+
echo " redisctl-output Consistent output formatting"
81+
echo ""
82+
echo "This enables:"
83+
echo " - Terraform providers"
84+
echo " - Backup/migration tools"
85+
echo " - Monitoring dashboards"
86+
echo " - Custom automation scripts"
87+
echo ""
88+
89+
echo "=========================================="
90+
echo "DEMO COMPLETE"
91+
echo "=========================================="
92+
echo ""
93+
echo "Key Takeaways:"
94+
echo " 1. FIRST CLI tool for Redis Cloud and Enterprise"
95+
echo " 2. Eliminates fragile bash + curl + jq scripts"
96+
echo " 3. Type-safe, tested, production-ready"
97+
echo " 4. Library-first enables ecosystem growth"
98+
echo " 5. Cross-platform, secure, user-friendly"
99+
echo ""
100+
echo "Questions?"
101+
echo ""

0 commit comments

Comments
 (0)