Skip to content

Commit 82a1d95

Browse files
committed
feat: enhance Docker Compose with comprehensive redisctl examples
- Add second database creation with different parameters (cache vs persistent) - Add license information service - Add module listing service - Add detailed node information with JMESPath filtering - Add user listing service - Add cluster policy and alerts monitoring - Add comprehensive cluster info with key fields - Fix database persistence field (use data_persistence not persistence) - Fix Docker workflow version extraction to use Cargo.toml when running from branch - Expose port 12002 for second database - Remove --wait flags (not available in current version)
1 parent c6d1e31 commit 82a1d95

File tree

2 files changed

+348
-4
lines changed

2 files changed

+348
-4
lines changed

.github/workflows/docker.yml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,27 @@ jobs:
2828
id: version
2929
run: |
3030
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
31-
# For manual dispatch, use the current ref name or latest tag
31+
# For manual dispatch, use the current ref name or extract from Cargo.toml
3232
if [[ "${{ github.ref }}" == refs/tags/v* ]]; then
33+
# Running from a tag
3334
VERSION=${GITHUB_REF#refs/tags/v}
3435
else
35-
VERSION=$(git describe --tags --abbrev=0 2>/dev/null | sed 's/^v//' || echo "0.0.0")
36+
# Running from a branch - extract version from Cargo.toml
37+
VERSION=$(grep '^version = ' crates/redisctl/Cargo.toml | head -1 | sed 's/version = "\(.*\)"/\1/')
38+
echo "Extracted version from Cargo.toml: $VERSION"
3639
fi
3740
else
41+
# Tag push event
3842
VERSION=${GITHUB_REF#refs/tags/v}
3943
fi
40-
echo "Extracted version: $VERSION"
44+
45+
# Validate version format
46+
if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
47+
echo "Warning: Invalid version format: $VERSION"
48+
VERSION="0.0.0"
49+
fi
50+
51+
echo "Final version: $VERSION"
4152
echo "version=$VERSION" >> $GITHUB_OUTPUT
4253
echo "major=$(echo $VERSION | cut -d. -f1)" >> $GITHUB_OUTPUT
4354
echo "minor=$(echo $VERSION | cut -d. -f1-2)" >> $GITHUB_OUTPUT

docker-compose.yml

Lines changed: 334 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ services:
99
ports:
1010
- "12000:12000"
1111
- "12001:12001"
12+
- "12002:12002"
1213
- "9443:9443"
1314
- "8443:8443"
1415
networks:
@@ -22,7 +23,7 @@ services:
2223

2324
# Auto-initialize Redis Enterprise cluster using our workflow
2425
redis-enterprise-init:
25-
image: joshrotenberg/redisctl:0.5.1
26+
image: joshrotenberg/redisctl:latest
2627
container_name: redis-enterprise-init
2728
depends_on:
2829
redis-enterprise:
@@ -45,6 +46,338 @@ services:
4546
"Redis123!",
4647
]
4748

49+
# Create first test database - basic ephemeral cache
50+
redis-enterprise-create-db1:
51+
image: joshrotenberg/redisctl:latest
52+
container_name: redis-enterprise-create-db1
53+
depends_on:
54+
redis-enterprise-init:
55+
condition: service_completed_successfully
56+
networks:
57+
- redisctl-network
58+
environment:
59+
REDIS_ENTERPRISE_URL: "https://redis-enterprise:9443"
60+
REDIS_ENTERPRISE_USER: "[email protected]"
61+
REDIS_ENTERPRISE_PASSWORD: "Redis123!"
62+
REDIS_ENTERPRISE_INSECURE: "true"
63+
command:
64+
[
65+
"enterprise",
66+
"database",
67+
"create",
68+
"--data",
69+
'{"name": "cache-db", "memory_size": 104857600, "port": 12001, "replication": false, "data_persistence": "disabled", "eviction_policy": "allkeys-lru"}',
70+
]
71+
72+
# Create second test database - persistent with AOF
73+
redis-enterprise-create-db2:
74+
image: joshrotenberg/redisctl:latest
75+
container_name: redis-enterprise-create-db2
76+
depends_on:
77+
redis-enterprise-init:
78+
condition: service_completed_successfully
79+
networks:
80+
- redisctl-network
81+
environment:
82+
REDIS_ENTERPRISE_URL: "https://redis-enterprise:9443"
83+
REDIS_ENTERPRISE_USER: "[email protected]"
84+
REDIS_ENTERPRISE_PASSWORD: "Redis123!"
85+
REDIS_ENTERPRISE_INSECURE: "true"
86+
command:
87+
[
88+
"enterprise",
89+
"database",
90+
"create",
91+
"--data",
92+
'{"name": "persistent-db", "memory_size": 209715200, "port": 12002, "replication": false, "data_persistence": "aof", "aof_policy": "appendfsync-every-sec"}',
93+
]
94+
95+
# List all databases to verify creation
96+
redis-enterprise-list-dbs:
97+
image: joshrotenberg/redisctl:latest
98+
container_name: redis-enterprise-list-dbs
99+
depends_on:
100+
redis-enterprise-create-db1:
101+
condition: service_completed_successfully
102+
redis-enterprise-create-db2:
103+
condition: service_completed_successfully
104+
networks:
105+
- redisctl-network
106+
environment:
107+
REDIS_ENTERPRISE_URL: "https://redis-enterprise:9443"
108+
REDIS_ENTERPRISE_USER: "[email protected]"
109+
REDIS_ENTERPRISE_PASSWORD: "Redis123!"
110+
REDIS_ENTERPRISE_INSECURE: "true"
111+
command: ["enterprise", "database", "list", "-o", "table"]
112+
113+
# Get cache database details
114+
redis-enterprise-get-cache-db:
115+
image: joshrotenberg/redisctl:latest
116+
container_name: redis-enterprise-get-cache-db
117+
depends_on:
118+
redis-enterprise-create-db1:
119+
condition: service_completed_successfully
120+
networks:
121+
- redisctl-network
122+
environment:
123+
REDIS_ENTERPRISE_URL: "https://redis-enterprise:9443"
124+
REDIS_ENTERPRISE_USER: "[email protected]"
125+
REDIS_ENTERPRISE_PASSWORD: "Redis123!"
126+
REDIS_ENTERPRISE_INSECURE: "true"
127+
command: [
128+
"enterprise",
129+
"database",
130+
"get",
131+
"2", # Assuming cache-db gets ID 2 (default-db from init is 1)
132+
"-o",
133+
"json",
134+
"-q",
135+
"{name: name, status: status, port: port, memory: memory_size, eviction: eviction_policy, persistence: data_persistence}",
136+
]
137+
138+
# Get persistent database details
139+
redis-enterprise-get-persistent-db:
140+
image: joshrotenberg/redisctl:latest
141+
container_name: redis-enterprise-get-persistent-db
142+
depends_on:
143+
redis-enterprise-create-db2:
144+
condition: service_completed_successfully
145+
networks:
146+
- redisctl-network
147+
environment:
148+
REDIS_ENTERPRISE_URL: "https://redis-enterprise:9443"
149+
REDIS_ENTERPRISE_USER: "[email protected]"
150+
REDIS_ENTERPRISE_PASSWORD: "Redis123!"
151+
REDIS_ENTERPRISE_INSECURE: "true"
152+
command: [
153+
"enterprise",
154+
"database",
155+
"get",
156+
"3", # Assuming persistent-db gets ID 3
157+
"-o",
158+
"json",
159+
"-q",
160+
"{name: name, status: status, port: port, memory: memory_size, persistence: data_persistence, replication: replication}",
161+
]
162+
163+
# Check cluster information
164+
redis-enterprise-cluster-info:
165+
image: joshrotenberg/redisctl:latest
166+
container_name: redis-enterprise-cluster-info
167+
depends_on:
168+
redis-enterprise-init:
169+
condition: service_completed_successfully
170+
networks:
171+
- redisctl-network
172+
environment:
173+
REDIS_ENTERPRISE_URL: "https://redis-enterprise:9443"
174+
REDIS_ENTERPRISE_USER: "[email protected]"
175+
REDIS_ENTERPRISE_PASSWORD: "Redis123!"
176+
REDIS_ENTERPRISE_INSECURE: "true"
177+
command: ["enterprise", "cluster", "get", "-o", "table"]
178+
179+
# List nodes in the cluster
180+
redis-enterprise-list-nodes:
181+
image: joshrotenberg/redisctl:latest
182+
container_name: redis-enterprise-list-nodes
183+
depends_on:
184+
redis-enterprise-init:
185+
condition: service_completed_successfully
186+
networks:
187+
- redisctl-network
188+
environment:
189+
REDIS_ENTERPRISE_URL: "https://redis-enterprise:9443"
190+
REDIS_ENTERPRISE_USER: "[email protected]"
191+
REDIS_ENTERPRISE_PASSWORD: "Redis123!"
192+
REDIS_ENTERPRISE_INSECURE: "true"
193+
command: ["enterprise", "node", "list", "-o", "table"]
194+
195+
# Check cluster stats
196+
redis-enterprise-stats:
197+
image: joshrotenberg/redisctl:latest
198+
container_name: redis-enterprise-stats
199+
depends_on:
200+
redis-enterprise-create-db1:
201+
condition: service_completed_successfully
202+
redis-enterprise-create-db2:
203+
condition: service_completed_successfully
204+
networks:
205+
- redisctl-network
206+
environment:
207+
REDIS_ENTERPRISE_URL: "https://redis-enterprise:9443"
208+
REDIS_ENTERPRISE_USER: "[email protected]"
209+
REDIS_ENTERPRISE_PASSWORD: "Redis123!"
210+
REDIS_ENTERPRISE_INSECURE: "true"
211+
command:
212+
[
213+
"enterprise",
214+
"cluster",
215+
"stats",
216+
"-o",
217+
"json",
218+
"-q",
219+
"{cpu: cpu_usage, memory: memory_usage, databases: total_databases, nodes: total_nodes}",
220+
]
221+
222+
# Get license information
223+
redis-enterprise-license:
224+
image: joshrotenberg/redisctl:latest
225+
container_name: redis-enterprise-license
226+
depends_on:
227+
redis-enterprise-init:
228+
condition: service_completed_successfully
229+
networks:
230+
- redisctl-network
231+
environment:
232+
REDIS_ENTERPRISE_URL: "https://redis-enterprise:9443"
233+
REDIS_ENTERPRISE_USER: "[email protected]"
234+
REDIS_ENTERPRISE_PASSWORD: "Redis123!"
235+
REDIS_ENTERPRISE_INSECURE: "true"
236+
command: ["enterprise", "license", "get", "-o", "json"]
237+
238+
# List available modules
239+
redis-enterprise-modules:
240+
image: joshrotenberg/redisctl:latest
241+
container_name: redis-enterprise-modules
242+
depends_on:
243+
redis-enterprise-init:
244+
condition: service_completed_successfully
245+
networks:
246+
- redisctl-network
247+
environment:
248+
REDIS_ENTERPRISE_URL: "https://redis-enterprise:9443"
249+
REDIS_ENTERPRISE_USER: "[email protected]"
250+
REDIS_ENTERPRISE_PASSWORD: "Redis123!"
251+
REDIS_ENTERPRISE_INSECURE: "true"
252+
command: ["enterprise", "module", "list", "-o", "table"]
253+
254+
# Get detailed node information
255+
redis-enterprise-node-details:
256+
image: joshrotenberg/redisctl:latest
257+
container_name: redis-enterprise-node-details
258+
depends_on:
259+
redis-enterprise-init:
260+
condition: service_completed_successfully
261+
networks:
262+
- redisctl-network
263+
environment:
264+
REDIS_ENTERPRISE_URL: "https://redis-enterprise:9443"
265+
REDIS_ENTERPRISE_USER: "[email protected]"
266+
REDIS_ENTERPRISE_PASSWORD: "Redis123!"
267+
REDIS_ENTERPRISE_INSECURE: "true"
268+
command:
269+
[
270+
"enterprise",
271+
"node",
272+
"get",
273+
"1",
274+
"-o",
275+
"json",
276+
"-q",
277+
"{address: addr, status: status, cores: cores, memory: total_memory, version: software_version, shards: shard_count}",
278+
]
279+
280+
# List all users
281+
redis-enterprise-users:
282+
image: joshrotenberg/redisctl:latest
283+
container_name: redis-enterprise-users
284+
depends_on:
285+
redis-enterprise-init:
286+
condition: service_completed_successfully
287+
networks:
288+
- redisctl-network
289+
environment:
290+
REDIS_ENTERPRISE_URL: "https://redis-enterprise:9443"
291+
REDIS_ENTERPRISE_USER: "[email protected]"
292+
REDIS_ENTERPRISE_PASSWORD: "Redis123!"
293+
REDIS_ENTERPRISE_INSECURE: "true"
294+
command: ["enterprise", "user", "list", "-o", "table"]
295+
296+
# Get cluster policy
297+
redis-enterprise-policy:
298+
image: joshrotenberg/redisctl:latest
299+
container_name: redis-enterprise-policy
300+
depends_on:
301+
redis-enterprise-init:
302+
condition: service_completed_successfully
303+
networks:
304+
- redisctl-network
305+
environment:
306+
REDIS_ENTERPRISE_URL: "https://redis-enterprise:9443"
307+
REDIS_ENTERPRISE_USER: "[email protected]"
308+
REDIS_ENTERPRISE_PASSWORD: "Redis123!"
309+
REDIS_ENTERPRISE_INSECURE: "true"
310+
command:
311+
[
312+
"api",
313+
"enterprise",
314+
"get",
315+
"/v1/cluster/policy",
316+
"-o",
317+
"json",
318+
"-q",
319+
"{default_db_config: default_non_sharded_proxy_policy, rack_aware: rack_aware, redis_upgrade: redis_upgrade_policy}",
320+
]
321+
322+
# Check for any cluster alerts
323+
redis-enterprise-alerts:
324+
image: joshrotenberg/redisctl:latest
325+
container_name: redis-enterprise-alerts
326+
depends_on:
327+
redis-enterprise-init:
328+
condition: service_completed_successfully
329+
networks:
330+
- redisctl-network
331+
environment:
332+
REDIS_ENTERPRISE_URL: "https://redis-enterprise:9443"
333+
REDIS_ENTERPRISE_USER: "[email protected]"
334+
REDIS_ENTERPRISE_PASSWORD: "Redis123!"
335+
REDIS_ENTERPRISE_INSECURE: "true"
336+
command: ["api", "enterprise", "get", "/v1/cluster/alerts", "-o", "json"]
337+
338+
# Get comprehensive cluster information
339+
redis-enterprise-cluster-full:
340+
image: joshrotenberg/redisctl:latest
341+
container_name: redis-enterprise-cluster-full
342+
depends_on:
343+
redis-enterprise-init:
344+
condition: service_completed_successfully
345+
networks:
346+
- redisctl-network
347+
environment:
348+
REDIS_ENTERPRISE_URL: "https://redis-enterprise:9443"
349+
REDIS_ENTERPRISE_USER: "[email protected]"
350+
REDIS_ENTERPRISE_PASSWORD: "Redis123!"
351+
REDIS_ENTERPRISE_INSECURE: "true"
352+
command:
353+
[
354+
"enterprise",
355+
"cluster",
356+
"get",
357+
"-o",
358+
"json",
359+
"-q",
360+
"{name: name, license: license_expired, nodes: nodes, databases: databases, version: software_version, created: created_time}",
361+
]
362+
363+
# Test database connectivity
364+
redis-enterprise-test-connectivity:
365+
image: redis:7-alpine
366+
container_name: redis-enterprise-test-connectivity
367+
depends_on:
368+
redis-enterprise-create-db1:
369+
condition: service_completed_successfully
370+
redis-enterprise-create-db2:
371+
condition: service_completed_successfully
372+
networks:
373+
- redisctl-network
374+
command:
375+
[
376+
"sh",
377+
"-c",
378+
"echo 'Testing cache-db on port 12001...' && redis-cli -h redis-enterprise -p 12001 ping && echo 'Testing persistent-db on port 12002...' && redis-cli -h redis-enterprise -p 12002 ping && echo 'All databases responding!'",
379+
]
380+
48381
networks:
49382
redisctl-network:
50383
driver: bridge

0 commit comments

Comments
 (0)