Skip to content

Commit

Permalink
fix: use redis cluster (bcgov#27)
Browse files Browse the repository at this point in the history
Signed-off-by: Jason C. Leach <[email protected]>
  • Loading branch information
jleach authored Feb 3, 2024
1 parent 90bffd6 commit e652aa7
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ services:
networks:
- local_network
environment:
- REDIS_URL=redis://redis:6379/0
- REDIS_URI=redis://redis:6379/0
7 changes: 5 additions & 2 deletions devops/charts/controller/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@ spec:
envFrom:
- secretRef:
name: {{ include "attestation-controller.fullname" . }}-traction-creds
- secretRef:
name: {{ include "attestation-controller.fullname" . }}-redis-creds
env:
- name: PORT
value: {{.Values.service.targetPort | quote}}
Expand All @@ -71,3 +69,8 @@ spec:
value: {{.Values.env.GOOGLE_AUTH_JSON_PATH | quote}}
- name: MESSAGE_TEMPLATES_PATH
value: {{.Values.env.MESSAGE_TEMPLATES_PATH | quote}}
- name: REDIS_URI
valueFrom:
secretKeyRef:
name: redis-shared
key: connection-string
10 changes: 1 addition & 9 deletions devops/charts/controller/templates/secrets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,4 @@ type: Opaque
data:
TRACTION_WALLET_ID: {{.Values.wallet_id | b64enc}}
TRACTION_WALLET_KEY: {{.Values.wallet_key | b64enc}}
---
apiVersion: v1
kind: Secret
metadata:
name: {{ include "attestation-controller.fullname" . }}-redis-creds
labels: {{- include "attestation-controller.labels" . | nindent 4}}
type: Opaque
data:
REDIS_URL: {{.Values.redis_url | b64enc}}

2 changes: 1 addition & 1 deletion devops/charts/controller/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ image:
registry: ghcr.io
repository: bcgov/mobile-attestation-vc-controller/controller
# Overrides the image tag whose default is the chart appVersion.
tag: "fdbeea6"
tag: "90bffd6"

env:
TRACTION_BASE_URL: "https://traction-tenant-proxy-dev.apps.silver.devops.gov.bc.ca"
Expand Down
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ google-api-python-client
google-auth-oauthlib
google-auth
gunicorn
redis
redis
redis-py-cluster
8 changes: 5 additions & 3 deletions src/redis_config.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import redis
# import redis
import os
from rediscluster import RedisCluster

# Get the Redis URL from environment variables
redis_url = os.getenv('REDIS_URL')
redis_uri = os.getenv("REDIS_URI")

redis_instance = redis.from_url(redis_url, decode_responses=True)
# redis_instance = redis.from_url(redis_url, decode_responses=True)
redis_instance = RedisCluster.from_url(redis_uri, decode_responses=True)

0 comments on commit e652aa7

Please sign in to comment.