Skip to content

Instantly share code, notes, and snippets.

@Firsh
Last active July 12, 2025 15:42
Show Gist options
  • Save Firsh/0420749efdc5df91ce00e61baf4a3ccb to your computer and use it in GitHub Desktop.
Save Firsh/0420749efdc5df91ce00e61baf4a3ccb to your computer and use it in GitHub Desktop.
RedisInsight Setup Script for AI Hero Course
#!/usr/bin/env bash
# Use this script to start a docker container for RedisInsight (Redis GUI)
# TO RUN ON WINDOWS:
# 1. Install WSL (Windows Subsystem for Linux) - https://learn.microsoft.com/en-us/windows/wsl/install
# 2. Install Docker Desktop for Windows - https://docs.docker.com/docker-for-windows/install/
# 3. Open WSL - `wsl`
# 4. Run this script - `./start-redisinsight.sh`
# On Linux and macOS you can run this script directly - `./start-redisinsight.sh`
REDISINSIGHT_CONTAINER_NAME="redisinsight"
if ! [ -x "$(command -v docker)" ]; then
echo -e "Docker is not installed. Please install docker and try again.\nDocker install guide: https://docs.docker.com/engine/install/"
exit 1
fi
if ! docker info >/dev/null 2>&1; then
echo "Docker daemon is not running. Please start Docker and try again."
exit 1
fi
if [ "$(docker ps -q -f name=$REDISINSIGHT_CONTAINER_NAME)" ]; then
echo "RedisInsight container '$REDISINSIGHT_CONTAINER_NAME' already running"
exit 0
fi
if [ "$(docker ps -q -a -f name=$REDISINSIGHT_CONTAINER_NAME)" ]; then
docker start "$REDISINSIGHT_CONTAINER_NAME"
echo "Existing RedisInsight container '$REDISINSIGHT_CONTAINER_NAME' started"
exit 0
fi
# import env variables from .env
set -a
source .env
# Extract connection details from REDIS_URL
REDIS_PASSWORD=$(echo "$REDIS_URL" | awk -F':' '{print $3}' | awk -F'@' '{print $1}')
# Get Redis container IP address
REDIS_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' ai-app-template-redis)
if [ -z "$REDIS_IP" ]; then
echo "Error: Could not find Redis container IP address. Make sure Redis is running."
exit 1
fi
echo "Found Redis container at IP: $REDIS_IP"
# Wait for Redis to be ready
echo "Waiting for Redis to be ready..."
until docker exec ai-app-template-redis redis-cli -a "$REDIS_PASSWORD" ping >/dev/null 2>&1; do
echo "Waiting for Redis to be ready..."
sleep 2
done
echo "Redis is ready!"
docker run -d \
--name $REDISINSIGHT_CONTAINER_NAME \
--network bridge \
-p 5540:5540 \
-e RI_REDIS_HOST="$REDIS_IP" \
-e RI_REDIS_PORT="6379" \
-e RI_REDIS_ALIAS="AIHero" \
-e RI_REDIS_USERNAME="default" \
-e RI_REDIS_PASSWORD="$REDIS_PASSWORD" \
redis/redisinsight:latest && echo "RedisInsight container '$REDISINSIGHT_CONTAINER_NAME' was successfully created"
@Firsh
Copy link
Author

Firsh commented Jul 12, 2025

A fanmade bonus script for the AI Hero course that provides a Redis GUI similar to Drizzle Studio. This script automatically starts RedisInsight (the official Redis GUI) in Docker with pre-configured connection to your local Redis instance.

Features:

  • Auto-detects Redis container and extracts connection details from .env
  • Pre-configures connection so you can inspect Redis data immediately

Perfect for debugging Redis operations, inspecting keys, and monitoring your AI Hero course Redis instance without manual configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment