forked from argoproj/argo-cd
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Make dev env redis password protected (argoproj#19863)
* create pr Signed-off-by: reggie-k <[email protected]> * create pr Signed-off-by: reggie-k <[email protected]> * create pr Signed-off-by: reggie-k <[email protected]> * initial Signed-off-by: reggie-k <[email protected]> * initial Signed-off-by: reggie-k <[email protected]> * initial Signed-off-by: reggie-k <[email protected]> * checking Redis is installed locally per Nitish's suggestion Signed-off-by: reggie-k <[email protected]> * Update hack/start-redis-with-password.sh Co-authored-by: Nitish Kumar <[email protected]> Signed-off-by: Regina Voloshin <[email protected]> * Update hack/start-redis-with-password.sh Co-authored-by: Nitish Kumar <[email protected]> Signed-off-by: Regina Voloshin <[email protected]> * fixed unreachable code Signed-off-by: reggie-k <[email protected]> --------- Signed-off-by: reggie-k <[email protected]> Signed-off-by: Regina Voloshin <[email protected]> Co-authored-by: Nitish Kumar <[email protected]>
- Loading branch information
Showing
2 changed files
with
31 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/bin/bash | ||
|
||
# Default values for environment variables | ||
REDIS_PORT="${ARGOCD_E2E_REDIS_PORT:-6379}" | ||
REDIS_IMAGE_TAG=$(grep 'image: redis' manifests/base/redis/argocd-redis-deployment.yaml | cut -d':' -f3) | ||
|
||
if [ "$ARGOCD_REDIS_LOCAL" = 'true' ]; then | ||
if ! command -v redis-server &>/dev/null; then | ||
echo "Redis server is not installed locally. Please install Redis or set ARGOCD_REDIS_LOCAL to false." | ||
exit 1 | ||
fi | ||
|
||
# Start local Redis server with password if defined | ||
if [ -z "$REDIS_PASSWORD" ]; then | ||
echo "Starting local Redis server without password." | ||
redis-server --save '' --appendonly no --port "$REDIS_PORT" | ||
else | ||
echo "Starting local Redis server with password." | ||
redis-server --save '' --appendonly no --port "$REDIS_PORT" --requirepass "$REDIS_PASSWORD" | ||
fi | ||
else | ||
# Run Redis in a Docker container with password if defined | ||
if [ -z "$REDIS_PASSWORD" ]; then | ||
echo "Starting Docker container without password." | ||
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" | ||
else | ||
echo "Starting Docker container with password." | ||
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" | ||
fi | ||
fi |