Skip to content

Commit

Permalink
Reduce PVC size for Redis cluster
Browse files Browse the repository at this point in the history
Adjust REDIS_NAME
  • Loading branch information
warrenchristian1telus committed Oct 19, 2024
1 parent fa09ecc commit 45db953
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ PHP_NAME=php
DB_SERVICE=db
CRON_NAME=cron
WEB_NAME=web
REDIS_NAME=redis-sentinel
REDIS_NAME=redis

APP_ENV=production
APP_KEY=base64:**Add_app_key_here**
Expand Down
12 changes: 10 additions & 2 deletions openshift/scripts/deploy-redis-sentinel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,14 @@ global:
password: "$REDIS_PASSWORD"
replica:
replicaCount: $REDIS_REPLICAS
persistence:
enabled: true
size: 5Gi
sentinel:
enabled: true
persistence:
enabled: true
size: 100Mi
EOF

# Check if the Helm deployment exists
Expand All @@ -33,7 +39,7 @@ if helm list -q | grep -q "^$REDIS_NAME$"; then
else
echo "Helm $REDIS_NAME NOT FOUND. Beginning deployment..."

helm install $REDIS_NAME-sentinel $REDIS_HELM_CHART --values values.yml
helm install $REDIS_NAME $REDIS_HELM_CHART --values values.yml
fi

echo "Helm updates completed for $REDIS_NAME."
Expand All @@ -42,8 +48,10 @@ echo "Helm updates completed for $REDIS_NAME."
echo "Setting best-effort resource limits for the deployment..."
oc set resources deployment/$REDIS_NAME --limits=cpu=0,memory=0 --requests=cpu=0,memory=0



# Clean up the temporary values file
rm values.yaml

e ho "Deploying Redis Insight..."
echo "Deploying Redis Insight..."
oc apply -f ./openshift/redis-insight.yml
3 changes: 2 additions & 1 deletion openshift/scripts/redis-client-increment.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#!/bin/bash
export REDISCLI_AUTH=$REDIS_PASSWORD
export REDIS_HOST=$(oc get svc redis-sentinel -o jsonpath='{.spec.clusterIP}')
while true
do
CURRENT_PRIMARY=$(redis-cli -h redis-sentinel -p 26379 SENTINEL get-master-addr-by-name mymaster)
CURRENT_PRIMARY=$(redis-cli -h $REDIS_HOST -p 26379 SENTINEL get-master-addr-by-name mymaster)
CURRENT_PRIMARY_HOST=$(echo $CURRENT_PRIMARY | cut -d' ' -f1 | head -n 1)
echo "Current master's host: $CURRENT_PRIMARY_HOST"
redis-cli -h ${CURRENT_PRIMARY_HOST} -p 6379 INCR mycounter
Expand Down

0 comments on commit 45db953

Please sign in to comment.