github.com/argoproj/argo-cd/v3@v3.2.1/hack/start-redis-with-password.sh (about) 1 #!/bin/bash 2 3 # Default values for environment variables 4 REDIS_PORT="${ARGOCD_E2E_REDIS_PORT:-6379}" 5 REDIS_IMAGE_TAG=$(grep 'image: redis' manifests/base/redis/argocd-redis-deployment.yaml | cut -d':' -f3) 6 7 if [ "$ARGOCD_REDIS_LOCAL" = 'true' ]; then 8 if ! command -v redis-server &>/dev/null; then 9 echo "Redis server is not installed locally. Please install Redis or set ARGOCD_REDIS_LOCAL to false." 10 exit 1 11 fi 12 13 # Start local Redis server with password if defined 14 if [ -z "$REDIS_PASSWORD" ]; then 15 echo "Starting local Redis server without password." 16 redis-server --save '' --appendonly no --port "$REDIS_PORT" 17 else 18 echo "Starting local Redis server with password." 19 redis-server --save '' --appendonly no --port "$REDIS_PORT" --requirepass "$REDIS_PASSWORD" 20 fi 21 else 22 # Run Redis in a Docker container with password if defined 23 if [ -z "$REDIS_PASSWORD" ]; then 24 echo "Starting Docker container without password." 25 docker run --rm --name argocd-redis -i -p "$REDIS_PORT:$REDIS_PORT" docker.io/library/redis:"$REDIS_IMAGE_TAG" --save '' --appendonly no --port "$REDIS_PORT" 26 else 27 echo "Starting Docker container with password." 28 docker run --rm --name argocd-redis -i -p "$REDIS_PORT:$REDIS_PORT" -e REDIS_PASSWORD="$REDIS_PASSWORD" docker.io/library/redis:"$REDIS_IMAGE_TAG" redis-server --save '' --requirepass "$REDIS_PASSWORD" --appendonly no --port "$REDIS_PORT" 29 fi 30 fi