Skip to content

Commit b76dd96

Browse files
Fix analytics REDIS params, default to REDIS URL
1 parent 1d6ba58 commit b76dd96

6 files changed

Lines changed: 43 additions & 11 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ postgres:
154154
openopsEnv:
155155
OPS_PUBLIC_URL: "https://us-east.openops.example.com"
156156
OPS_POSTGRES_HOST: "rds-us-east-1.example.com"
157-
OPS_REDIS_HOST: "elasticache-us-east-1.example.com"
157+
OPS_REDIS_URL: "redis://elasticache-us-east-1.example.com:6379/0"
158158

159159
nginx:
160160
service:

chart/templates/_helpers.tpl

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,40 @@ Redis connection parameters
9292
{{- printf "redis://%s:%s/0" (include "openops.redisHost" .) (include "openops.redisPort" .) -}}
9393
{{- end }}
9494

95+
{{- define "openops.resolvedRedisUrl" -}}
96+
{{- tpl .Values.openopsEnv.OPS_REDIS_URL . -}}
97+
{{- end }}
98+
99+
{{- define "openops.redisUrlExtractHost" -}}
100+
{{- $url := urlParse (include "openops.resolvedRedisUrl" .) -}}
101+
{{- $host := $url.host -}}
102+
{{- if contains ":" $host -}}
103+
{{- first (splitList ":" $host) -}}
104+
{{- else -}}
105+
{{- $host -}}
106+
{{- end -}}
107+
{{- end }}
108+
109+
{{- define "openops.redisUrlExtractPort" -}}
110+
{{- $url := urlParse (include "openops.resolvedRedisUrl" .) -}}
111+
{{- $host := $url.host -}}
112+
{{- if contains ":" $host -}}
113+
{{- last (splitList ":" $host) -}}
114+
{{- else -}}
115+
6379
116+
{{- end -}}
117+
{{- end }}
118+
119+
{{- define "openops.redisUrlExtractDb" -}}
120+
{{- $url := urlParse (include "openops.resolvedRedisUrl" .) -}}
121+
{{- $path := trimPrefix "/" $url.path -}}
122+
{{- if $path -}}
123+
{{- $path -}}
124+
{{- else -}}
125+
0
126+
{{- end -}}
127+
{{- end }}
128+
95129
{{/*
96130
PostgreSQL connection parameters
97131
*/}}

chart/values.production.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ openopsEnv:
3737

3838
# Queue - externalized to managed Redis (e.g., AWS ElastiCache, GCP Memorystore, Azure Cache)
3939
OPS_QUEUE_MODE: REDIS
40-
OPS_REDIS_HOST: "your-redis-cluster.cache.amazonaws.com"
41-
OPS_REDIS_PORT: "6379"
40+
OPS_REDIS_URL: "redis://your-redis-cluster.cache.amazonaws.com:6379/0"
4241

4342
# AWS-specific settings for EKS deployments
4443
OPS_AWS_ENABLE_IMPLICIT_ROLE: "true"

chart/values.yaml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,7 @@ openopsEnv:
112112

113113
# Queue
114114
OPS_QUEUE_MODE: REDIS
115-
OPS_REDIS_HOST: '{{ include "openops.redisHost" . }}'
116-
OPS_REDIS_PORT: '{{ include "openops.redisPort" . }}'
115+
OPS_REDIS_URL: '{{ include "openops.redisUrl" . }}'
117116

118117
# Database
119118
OPS_DB_TYPE: POSTGRES
@@ -366,8 +365,10 @@ analytics:
366365
DATABASE_HOST_ALT: "{{ .Values.openopsEnv.OPS_OPENOPS_TABLES_DB_HOST }}"
367366
SUPERSET_SECRET_KEY: "{{ .Values.openopsEnvSecrets.SUPERSET_SECRET_KEY }}"
368367
SUPERSET_FEATURE_ALLOW_ADHOC_SUBQUERY: '"{{ .Values.openopsEnv.ANALYTICS_ALLOW_ADHOC_SUBQUERY }}"'
369-
REDIS_HOST: "{{ .Values.openopsEnv.OPS_REDIS_HOST }}"
370-
REDIS_PORT: "{{ .Values.openopsEnv.OPS_REDIS_PORT }}"
368+
REDIS_HOST: '{{ include "openops.redisUrlExtractHost" . }}'
369+
REDIS_PORT: '{{ include "openops.redisUrlExtractPort" . }}'
370+
REDIS_CELERY_DB: '{{ include "openops.redisUrlExtractDb" . }}'
371+
REDIS_RESULTS_DB: '{{ include "openops.redisUrlExtractDb" . }}'
371372

372373
postgres:
373374
name: postgres

docs/DEPLOY_TO_AWS_EKS.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -638,8 +638,7 @@ openopsEnv:
638638

639639
# Queue - AWS ElastiCache Redis
640640
OPS_QUEUE_MODE: REDIS
641-
OPS_REDIS_HOST: "openops-production-redis.xxxxx.cache.amazonaws.com"
642-
OPS_REDIS_PORT: "6379"
641+
OPS_REDIS_URL: "redis://openops-production-redis.xxxxx.cache.amazonaws.com:6379/0"
643642
# If using auth token:
644643
# OPS_REDIS_PASSWORD: set via secretEnv
645644

docs/DEPLOY_TO_AWS_EKS_FARGATE.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -699,8 +699,7 @@ openopsEnv:
699699

700700
# External ElastiCache Redis
701701
OPS_QUEUE_MODE: REDIS
702-
OPS_REDIS_HOST: "REPLACE_WITH_REDIS_ENDPOINT" # Replace with actual Redis endpoint
703-
OPS_REDIS_PORT: "6379"
702+
OPS_REDIS_URL: "redis://REPLACE_WITH_REDIS_ENDPOINT:6379/0" # Replace with actual Redis endpoint
704703

705704
# AWS-specific settings
706705
OPS_AWS_ENABLE_IMPLICIT_ROLE: "true"

0 commit comments

Comments
 (0)