diff --git a/.github/workflows/docker-test.yml b/.github/workflows/docker-test.yml new file mode 100644 index 00000000..d76873c9 --- /dev/null +++ b/.github/workflows/docker-test.yml @@ -0,0 +1,47 @@ +name: Docker Test + +on: + push: + branches: [ main ] + paths: + - 'docker-compose.yml' + - 'Dockerfile' + - '.github/workflows/docker-test.yml' + - 'crates/**' + pull_request: + paths: + - 'docker-compose.yml' + - 'Dockerfile' + - '.github/workflows/docker-test.yml' + - 'crates/**' + +env: + CARGO_TERM_COLOR: always + +jobs: + docker-test: + name: Docker Compose Test + runs-on: ubuntu-latest + timeout-minutes: 15 + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Build Docker images + run: docker compose build + + - name: Run Docker Compose test cascade + run: | + docker compose up --abort-on-container-exit --exit-code-from test-redis + EXIT_CODE=$? + docker compose logs + docker compose down -v + exit $EXIT_CODE + + - name: Cleanup + if: always() + run: docker compose down -v \ No newline at end of file diff --git a/.gitignore b/.gitignore index 27e0d4e1..bcd0e79a 100644 --- a/.gitignore +++ b/.gitignore @@ -33,3 +33,4 @@ dump.rdb # Claude .claude/ +CLAUDE.md diff --git a/CLAUDE.md b/CLAUDE.md deleted file mode 100644 index d150f927..00000000 --- a/CLAUDE.md +++ /dev/null @@ -1,198 +0,0 @@ -# CLAUDE.md - -This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. - -## Project Overview - -**redisctl** is a unified CLI tool for managing both Redis Cloud and Redis Enterprise deployments through their REST APIs. A single binary that intelligently routes commands to the appropriate backend based on configuration profiles. - -## Architecture - -### Workspace Structure -``` -redisctl/ -├── crates/ -│ ├── redis-cloud/ # Cloud API client library -│ ├── redis-enterprise/ # Enterprise API client library -│ └── redisctl/ # Unified CLI application -├── tests/integration/ # Integration tests -├── docs/ # mdBook documentation -└── examples/ # Usage examples -``` - -### Key Components -- **redis-cloud**: Cloud API client with handlers for subscriptions, databases, users, backups, ACLs, peering (100% test coverage) -- **redis-enterprise**: Enterprise API client with handlers for clusters, bdbs, nodes, users, modules, stats (100% test coverage) -- **redisctl**: Main CLI with smart routing logic in `router.rs`, profile management, deployment detection - -### CLI Architecture (Three-Tier Design) - -1. **Raw API Access** (`api` command) - Direct REST API calls with auth handling - - `redisctl enterprise api GET /v1/bdbs` - - `redisctl cloud api POST /subscriptions/123/databases --data @db.json` - -2. **Human-Friendly Commands** - Single API call wrappers with nice output - - `redisctl cloud database list` - - `redisctl enterprise cluster info` - -3. **Workflow Commands** - Multi-step operations with orchestration (planned, see issues #82-85) - -## Development Commands - -### Building -```bash -# Build all binaries -cargo build --release - -# Build specific binary -cargo build --release --bin redisctl -cargo build --release --features cloud-only --bin redis-cloud -cargo build --release --features enterprise-only --bin redis-enterprise - -# Run in development -cargo run -- --help -``` - -### Testing & Linting -```bash -# Run all tests -cargo test --workspace --all-features - -# Run specific package tests -cargo test --package redis-cloud -cargo test --package redis-enterprise - -# Run single test -cargo test test_cloud_config_default - -# Linting (MUST pass before committing) -cargo fmt --all -- --check -cargo clippy --all-targets --all-features -- -D warnings - -# Pre-commit hooks (recommended) -./scripts/install-hooks.sh # one-time setup -pre-commit run --all-files # run manually -``` - -### Docker Development Environment -```bash -# Start Redis Enterprise cluster -make docker-up - -# Quick test against running cluster -make quick-test - -# Run CLI in Docker -make docker-cli - -# Run integration tests -make docker-test - -# Clean up -make docker-down -``` - -## Key Implementation Details - -### Command Routing Logic (router.rs) -- Smart commands (`database`, `user`, `cluster`, `account`) auto-detect deployment type from profile -- Explicit commands (`cloud`, `enterprise`) bypass detection -- Profile resolution: CLI flag > env var > default profile -- Router maps commands to either `commands/cloud.rs` or `commands/enterprise.rs` - -### API Authentication -#### Cloud API -- Headers: `x-api-key` and `x-api-secret-key` -- Base URL: `https://api.redislabs.com/v1` -- Database IDs: Format `subscription_id:database_id` - -#### Enterprise API -- Authentication: Basic auth with username/password -- Base URL: `https://cluster:9443` (configurable) -- Database IDs: Simple numeric IDs -- SSL: Option to skip verification with `--insecure` flag - -### Profile Management -- Storage locations: - - Linux: `~/.config/redisctl/config.toml` - - macOS: `~/Library/Application Support/com.redis.redisctl/config.toml` - - Windows: `%APPDATA%\redis\redisctl\config.toml` -- Environment variables override profile settings -- Default profile: `redisctl profile default ` - -### Error Handling Pattern -- Libraries (`redis-cloud`, `redis-enterprise`): Use `thiserror` for typed errors -- CLI (`redisctl`): Use `anyhow` for user-friendly error messages -- All handlers return `Result` for consistent JSON output - -### Output Formatting -- Formats: JSON (default), YAML, Table -- JMESPath queries: `-q` flag -- Table format: `comfy-table` for pretty printing -- All commands support `--output` or `-o` flag - -## Common Development Tasks - -### Adding a New Command -1. Define command struct in `crates/redisctl/src/cli.rs` -2. Add handler in appropriate module: - - Cloud: `crates/redisctl/src/commands/cloud.rs` - - Enterprise: `crates/redisctl/src/commands/enterprise.rs` -3. Update router in `crates/redisctl/src/router.rs` if it's a smart-routed command -4. Add API client method in library crate (`redis-cloud` or `redis-enterprise`) -5. Add tests in library's test module using wiremock for mocking - -### Adding a New API Endpoint -1. Define request/response types in library's `types.rs` -2. Implement client method in library's `client.rs` -3. Add handler module if needed (e.g., `handlers/databases.rs`) -4. Write tests with wiremock mocking the API response -5. Update CLI to expose the new functionality - -### Testing Strategy -- Unit tests: In library test modules (`tests/` directory) -- Integration tests: In `tests/integration/` directory -- API mocking: Use `wiremock` for HTTP response mocking -- Docker tests: Full E2E tests against real Enterprise cluster - -## Feature Flags -- `default = ["full"]`: Includes both cloud and enterprise -- `cloud-only`: Builds redis-cloud binary only (smaller size) -- `enterprise-only`: Builds redis-enterprise binary only (smaller size) - -## API Coverage Status - -### Redis Cloud API -- **Coverage**: 95%+ of REST API endpoints implemented -- **Handlers**: 21 total (Account, ACL, Backup, Database, Subscription, Peering, etc.) -- **Test Coverage**: 12/21 handlers have dedicated test files -- **Extended Features**: API Keys, Billing, CRDB/Active-Active, SSO/SAML - -### Redis Enterprise API -- **Coverage**: 100% of documented REST API endpoints implemented -- **Handlers**: 29 total (Actions, Alerts, BDB, Cluster, Nodes, Users, etc.) -- **Test Coverage**: 22/29 handlers have dedicated test files -- **Complete CRUD**: All major endpoint categories covered - -## Dependencies -- Core: `tokio`, `serde`, `reqwest`, `clap` -- Output: `comfy-table`, `serde_yaml`, `jmespath` -- Config: `config`, `toml`, `directories` -- Testing: `wiremock`, `mockall`, `serial_test` -- Auth: `rpassword` for password input - -## CI/CD -- GitHub Actions workflow in `.github/workflows/ci.yml` -- Tests run on: Ubuntu, macOS, Windows -- Required checks: formatting, clippy, all tests -- Release workflow creates platform-specific binaries -- Pre-commit hooks available (see `.pre-commit-config.yaml`) - -## Project Standards -- Rust 2024 edition -- Minimum 70% test coverage goal -- All public APIs must have doc comments -- Conventional commits: `feat:`, `fix:`, `docs:`, `test:`, `chore:`, etc. -- Feature branch workflow (never commit directly to main) -- No emoji in code, commits, or documentation -- always squash commits on a branch/pr \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 87f5ec6c..e233db6f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,19 +1,19 @@ -# Redis Enterprise CLI Docker Image +# Redis CLI Docker Image # Multi-stage build for optimal size -FROM rust:1.82 AS builder +FROM rust:1.89 AS builder WORKDIR /build # Copy workspace files -COPY Cargo.toml Cargo.lock ./ +COPY Cargo.toml ./ COPY crates/ ./crates/ # Build release binary -RUN cargo build --release --bin redis-enterprise +RUN cargo build --release --bin redisctl -# Runtime stage - minimal debian image -FROM debian:bookworm-slim +# Runtime stage - Ubuntu for newer GLIBC +FROM ubuntu:24.04 # Install runtime dependencies RUN apt-get update && apt-get install -y \ @@ -22,11 +22,11 @@ RUN apt-get update && apt-get install -y \ && rm -rf /var/lib/apt/lists/* # Copy binary from builder -COPY --from=builder /build/target/release/redis-enterprise /usr/local/bin/redis-enterprise +COPY --from=builder /build/target/release/redisctl /usr/local/bin/redisctl # Create non-root user -RUN useradd -m -u 1000 redis && \ - mkdir -p /home/redis/.config/redis-enterprise && \ +RUN useradd -m redis && \ + mkdir -p /home/redis/.config/redisctl && \ chown -R redis:redis /home/redis USER redis @@ -36,6 +36,8 @@ WORKDIR /home/redis ENV REDIS_ENTERPRISE_URL="" ENV REDIS_ENTERPRISE_USER="" ENV REDIS_ENTERPRISE_PASSWORD="" +ENV REDIS_CLOUD_API_KEY="" +ENV REDIS_CLOUD_SECRET_KEY="" -ENTRYPOINT ["redis-enterprise"] +ENTRYPOINT ["redisctl"] CMD ["--help"] \ No newline at end of file diff --git a/Makefile b/Makefile deleted file mode 100644 index 119b4bfd..00000000 --- a/Makefile +++ /dev/null @@ -1,162 +0,0 @@ -# Redis Enterprise CLI Development Makefile - -.PHONY: help build test clean docker-up docker-down docker-logs docker-cli docker-test docker-examples docker-monitor docker-showcase docker-integration - -# Default target -help: - @echo "Redis Enterprise CLI Development Commands" - @echo "" - @echo "Build Commands:" - @echo " make build - Build the CLI in release mode" - @echo " make build-debug - Build the CLI in debug mode" - @echo " make test - Run all tests" - @echo " make clippy - Run clippy linter" - @echo " make fmt - Format code" - @echo " make clean - Clean build artifacts" - @echo "" - @echo "Docker Commands:" - @echo " make docker-up - Start Redis Enterprise and initialize cluster" - @echo " make docker-down - Stop and remove all containers" - @echo " make docker-logs - Show container logs" - @echo " make docker-cli - Start interactive CLI container" - @echo " make docker-test - Run comprehensive tests against cluster" - @echo " make docker-showcase - Demonstrate all CLI features" - @echo " make docker-integration - Run full integration test suite" - @echo " make docker-examples - Create example databases" - @echo " make docker-monitor - Start monitoring service" - @echo " make docker-all-dbs - Create all database types" - @echo " make docker-perf - Run performance tests" - @echo " make docker-debug - Start debug container with verbose logging" - @echo " make docker-cleanup - Remove all test databases" - @echo " make docker-rebuild - Rebuild and restart containers" - @echo "" - @echo "Development Workflow:" - @echo " make dev - Build, test, and start Docker environment" - @echo " make dev-clean - Stop Docker and clean build artifacts" - -# Build Commands -build: - cargo build --release --bin redis-enterprise - -build-debug: - cargo build --bin redis-enterprise - -test: - cargo test --all-features - -clippy: - cargo clippy --all-targets --all-features -- -D warnings - -fmt: - cargo fmt --all -- --check - -fmt-fix: - cargo fmt --all - -clean: - cargo clean - rm -rf target/ - -# Docker Commands -docker-up: - docker compose up -d - @echo "Waiting for services to be ready..." - @sleep 5 - docker compose ps - -docker-down: - docker compose down -v - -docker-logs: - docker compose logs -f - -docker-cli: - docker compose --profile cli up -d cli - docker attach redis-enterprise-cli-interactive - -docker-test: - docker compose -f docker-compose.yml -f docker-compose.dev.yml --profile test up test-runner - -docker-examples: - docker compose --profile examples up enterprise-db-examples - -docker-monitor: - docker compose --profile monitor up monitor - -docker-all-dbs: - docker compose -f docker-compose.yml -f docker-compose.dev.yml --profile all-dbs up create-all-db-types - -docker-perf: - docker compose -f docker-compose.yml -f docker-compose.dev.yml --profile perf up perf-test - -docker-debug: - docker compose -f docker-compose.yml -f docker-compose.dev.yml --profile debug up -d debug - docker exec -it redis-enterprise-debug sh - -docker-cleanup: - docker compose -f docker-compose.yml -f docker-compose.dev.yml --profile cleanup up cleanup - -docker-showcase: - docker compose --profile showcase up showcase - -docker-integration: - docker compose -f docker-compose.yml -f docker-compose.dev.yml --profile integration up integration - -docker-rebuild: - docker compose down - docker compose build --no-cache - docker compose up -d - -docker-ps: - docker compose ps - -# Development Workflow Commands -dev: build test docker-up - @echo "Development environment ready!" - @echo "Redis Enterprise: https://localhost:9443" - @echo "Web UI: https://localhost:8443" - @echo "Use 'make docker-cli' for interactive testing" - -dev-clean: docker-down clean - @echo "Development environment cleaned" - -# Quick test against running cluster -quick-test: - REDIS_ENTERPRISE_URL=https://localhost:9443 \ - REDIS_ENTERPRISE_USER=admin@redis.local \ - REDIS_ENTERPRISE_PASSWORD=Redis123! \ - ./target/release/redis-enterprise cluster info --insecure - -# Run all Docker test profiles -docker-test-all: docker-up - @echo "Running all test profiles..." - docker compose --profile showcase up showcase - docker compose -f docker-compose.yml -f docker-compose.dev.yml --profile test up test-runner - docker compose -f docker-compose.yml -f docker-compose.dev.yml --profile integration up integration - @echo "All tests completed!" - -# Watch for changes and rebuild -watch: - cargo watch -x "build --bin redis-enterprise" -x "test" - -# Documentation -docs: - cargo doc --no-deps --open - -docs-all: - cargo doc --open - -# Check everything before committing -pre-commit: fmt test clippy - @echo "All checks passed!" - -# Install development dependencies -install-dev-deps: - cargo install cargo-watch - cargo install cargo-edit - cargo install cargo-outdated - -# Update dependencies -update-deps: - cargo update - cargo outdated \ No newline at end of file diff --git a/README.md b/README.md index e5ddd6eb..a527e422 100644 --- a/README.md +++ b/README.md @@ -85,17 +85,17 @@ cargo build --release --bin redisctl ### Using Docker (for Enterprise testing) ```bash -# Start Redis Enterprise cluster -make docker-up +# Start Redis Enterprise cluster with initialization +docker compose up -d -# Access the CLI -make docker-cli +# Check cluster status +docker compose logs init -# Run tests -make docker-test +# Access interactive CLI +docker compose run --rm cli # Clean up -make docker-down +docker compose down -v ``` ## Quick Start diff --git a/docker-compose.yml b/docker-compose.yml index 4c8f6afe..5ce96c79 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,28 +1,25 @@ -# Redis Enterprise Test Environment with Feature-Complete CLI -# Usage: docker compose up -d +# Redis Enterprise Test Environment with Full Validation +# +# Usage: +# docker compose up -d # Start and run full test cascade +# docker compose logs -f # Watch all service logs +# docker compose down -v # Clean up everything # -# Profiles: -# - default: Runs enterprise, init, and creates a test database -# - cli: Interactive CLI container with all commands -# - examples: Create example databases using workflows -# - monitor: Continuous cluster monitoring -# - showcase: Demonstrates all CLI features (modules, roles, users, license) +# For Mac users: Set REDIS_ENTERPRISE_IMAGE=kurtfm/rs-arm:latest services: - # Redis Enterprise single node for testing + # Redis Enterprise server enterprise: - image: ${ENTERPRISE_IMAGE:-kurtfm/rs-arm:latest} # ARM-compatible image for Mac + image: ${REDIS_ENTERPRISE_IMAGE:-redislabs/redis:latest} container_name: redis-enterprise cap_add: - SYS_RESOURCE ports: - "9443:9443" # REST API - "8443:8443" # Web UI - - "12000-12010:12000-12010" # Database ports + - "12000:12000" # Database port environment: ACCEPT_EULA: "yes" - networks: - - redis-net volumes: - enterprise-data:/var/opt/redislabs healthcheck: @@ -31,212 +28,157 @@ services: timeout: 5s retries: 30 start_period: 60s + networks: + - redis-net - # Initialize Enterprise cluster using our CLI workflow - enterprise-init: + # Initialize cluster + init-cluster: build: context: . dockerfile: Dockerfile - image: redis-enterprise-cli:latest - container_name: redis-enterprise-init - networks: - - redis-net + container_name: init-cluster restart: "no" depends_on: enterprise: condition: service_healthy environment: REDIS_ENTERPRISE_URL: "https://enterprise:9443" + REDIS_ENTERPRISE_INSECURE: "true" RUST_LOG: ${RUST_LOG:-info} - # Use the workflow command for initialization - command: | - workflow init-cluster \ - --insecure \ - --name "test-cluster" \ - --username "admin@redis.local" \ - --password "Redis123!" \ - --accept-eula - - # Create initial database after cluster init - enterprise-db-create: - build: - context: . - dockerfile: Dockerfile - image: redis-enterprise-cli:latest - container_name: redis-enterprise-db-create networks: - redis-net - restart: "no" - depends_on: - enterprise-init: - condition: service_completed_successfully - environment: - REDIS_ENTERPRISE_URL: "https://enterprise:9443" - REDIS_ENTERPRISE_USER: "admin@redis.local" - REDIS_ENTERPRISE_PASSWORD: "Redis123!" - RUST_LOG: ${RUST_LOG:-info} - command: | - database create \ - --insecure \ - --name "test-db" \ - --memory 100MB \ - --port 12000 + entrypoint: + - /bin/sh + - -c + - | + echo "========================================" + echo "Step 1: Initializing Redis Enterprise cluster..." + echo "========================================" + + redisctl enterprise bootstrap create \ + --name "test-cluster" \ + --username "admin@redis.local" \ + --password "Redis123!" + + echo "✓ Cluster initialized successfully" + echo "" - # Create various database types using workflows - enterprise-db-examples: + # Create database + create-db: build: context: . dockerfile: Dockerfile - image: redis-enterprise-cli:latest - container_name: redis-enterprise-db-examples - networks: - - redis-net + container_name: create-db restart: "no" depends_on: - enterprise-db-create: + init-cluster: condition: service_completed_successfully environment: REDIS_ENTERPRISE_URL: "https://enterprise:9443" REDIS_ENTERPRISE_USER: "admin@redis.local" REDIS_ENTERPRISE_PASSWORD: "Redis123!" + REDIS_ENTERPRISE_INSECURE: "true" RUST_LOG: ${RUST_LOG:-info} - profiles: ["examples"] - command: | - sh -c ' - echo "Creating cache database..." && - redis-enterprise workflow create-database \ - --insecure \ - --name "cache-db" \ - --db-type cache && - echo "Creating persistent database..." && - redis-enterprise workflow create-database \ - --insecure \ - --name "persistent-db" \ - --db-type persistent && - echo "Creating search database..." && - redis-enterprise workflow create-database \ - --insecure \ - --name "search-db" \ - --db-type search && - echo "Listing all databases..." && - redis-enterprise database list --insecure --output table && - echo "Showing database statistics..." && - redis-enterprise database stats test-db --insecure --output table - ' - - # CLI container for interactive testing - cli: - build: - context: . - dockerfile: Dockerfile - image: redis-enterprise-cli:latest - container_name: redis-enterprise-cli-interactive - stdin_open: true - tty: true networks: - redis-net - environment: - REDIS_ENTERPRISE_URL: "https://enterprise:9443" - REDIS_ENTERPRISE_USER: "admin@redis.local" - REDIS_ENTERPRISE_PASSWORD: "Redis123!" - RUST_LOG: ${RUST_LOG:-info} - volumes: - - ./:/workspace:ro # Mount project read-only for reference - working_dir: /workspace - command: ["sh"] # Interactive shell - profiles: ["cli"] # Only start with --profile cli + entrypoint: + - /bin/sh + - -c + - | + echo "========================================" + echo "Step 2: Creating test database..." + echo "========================================" + + redisctl enterprise database create test-db \ + --memory-limit 100 + + echo "✓ Database created successfully" + echo "" - # Health check and monitoring service - monitor: + # Validate API + validate-api: build: context: . dockerfile: Dockerfile - image: redis-enterprise-cli:latest - container_name: redis-enterprise-monitor - networks: - - redis-net + container_name: validate-api restart: "no" depends_on: - enterprise-db-create: + create-db: condition: service_completed_successfully environment: REDIS_ENTERPRISE_URL: "https://enterprise:9443" REDIS_ENTERPRISE_USER: "admin@redis.local" REDIS_ENTERPRISE_PASSWORD: "Redis123!" + REDIS_ENTERPRISE_INSECURE: "true" RUST_LOG: ${RUST_LOG:-info} - profiles: ["monitor"] - command: | - sh -c ' - while true; do - echo "=== Cluster Status ===" && - redis-enterprise cluster info --insecure --output json | head -20 && - echo "=== Database List ===" && - redis-enterprise database list --insecure --output table && - echo "=== Node Status ===" && - redis-enterprise node list --insecure --query "[].{id:uid,status:status,role:role}" && - echo "=== License Usage ===" && - redis-enterprise license usage --insecure --output json | head -10 && - sleep 30 - done - ' - - # Showcase all CLI features - showcase: - build: - context: . - dockerfile: Dockerfile - image: redis-enterprise-cli:latest - container_name: redis-enterprise-showcase networks: - redis-net + entrypoint: + - /bin/sh + - -c + - | + echo "========================================" + echo "Step 3: Validating API endpoints..." + echo "========================================" + + echo "→ Listing databases..." + redisctl --output table enterprise database list + + echo "" + echo "→ Getting database info..." + redisctl --output json enterprise database show 1 | head -20 + + echo "" + echo "→ Checking cluster info..." + redisctl --query "name" enterprise cluster info + + echo "✓ API validation successful" + echo "" + + # Test Redis connection + test-redis: + image: redis:7-alpine + container_name: test-redis restart: "no" depends_on: - enterprise-db-create: + validate-api: condition: service_completed_successfully - environment: - REDIS_ENTERPRISE_URL: "https://enterprise:9443" - REDIS_ENTERPRISE_USER: "admin@redis.local" - REDIS_ENTERPRISE_PASSWORD: "Redis123!" - RUST_LOG: ${RUST_LOG:-info} - profiles: ["showcase"] - command: | - sh -c ' - echo "\n=== Redis Enterprise CLI Feature Showcase ===\n" && - - echo "1. Cluster Management:" && - redis-enterprise cluster info --insecure --query "name" && - - echo "\n2. Database Operations with JMESPath:" && - redis-enterprise database list --insecure --query "[].{name:name,port:port,status:status}" --output table && - - echo "\n3. Node Management:" && - redis-enterprise node list --insecure --output table && - - echo "\n4. User Management:" && - redis-enterprise user create --email test@company.com --password Test123! --insecure && - redis-enterprise user list --insecure --query "[?email==\`test@company.com\`]" && - - echo "\n5. Role Management:" && - redis-enterprise role list --insecure --output table && - - echo "\n6. Module Management:" && - redis-enterprise module list --insecure --query "[].{name:module_name,version:version}" && - - echo "\n7. License Information:" && - redis-enterprise license get --insecure --query "expiration_date" && - - echo "\n8. Bootstrap Status:" && - redis-enterprise bootstrap status --insecure --query "status" && - - echo "\n9. Configuration Profiles:" && - redis-enterprise config set --profile test --url https://enterprise:9443 --username admin@redis.local && - redis-enterprise config list && - - echo "\n10. Raw API Access:" && - redis-enterprise api get /v1/cluster --insecure --query "name" && - - echo "\n=== Feature Showcase Complete ===\n" - ' + networks: + - redis-net + command: + - sh + - -c + - | + echo "========================================" + echo "Step 4: Testing Redis connection..." + echo "========================================" + + # Wait for database to be fully ready + sleep 5 + + echo "→ Setting test key..." + redis-cli -h enterprise -p 12000 SET test:key "Hello from Docker!" + + echo "→ Getting test key..." + redis-cli -h enterprise -p 12000 GET test:key + + echo "→ Running PING..." + redis-cli -h enterprise -p 12000 PING + + echo "→ Getting INFO..." + redis-cli -h enterprise -p 12000 INFO server | head -10 + + echo "" + echo "========================================" + echo "✅ All tests passed successfully!" + echo "" + echo "Web UI: https://localhost:8443" + echo "Username: admin@redis.local" + echo "Password: Redis123!" + echo "" + echo "API: https://localhost:9443" + echo "Database: redis://localhost:12000" + echo "========================================" networks: redis-net: