From 8704f47b4417f4e8a947c00213ea27379668bd14 Mon Sep 17 00:00:00 2001 From: Jules Lefebvre Date: Tue, 24 Dec 2024 10:24:51 +0100 Subject: [PATCH 1/3] feat(common/infra): allow to chose redis ip familly Introduce a new environment variable (`REDIS_IP_FAMILY`) to choose witch version of the IP protocol to use in Redis. --- Common/Server/EnvironmentConfig.ts | 3 +++ Common/Server/Infrastructure/Redis.ts | 2 ++ 2 files changed, 5 insertions(+) diff --git a/Common/Server/EnvironmentConfig.ts b/Common/Server/EnvironmentConfig.ts index b6c8f1a8d83..97130659ee4 100644 --- a/Common/Server/EnvironmentConfig.ts +++ b/Common/Server/EnvironmentConfig.ts @@ -181,6 +181,9 @@ export const ShouldRedisTlsEnable: boolean = Boolean( RedisTlsCa || (RedisTlsCert && RedisTlsKey), ); +export const RedisIPFamily: number = + Number(process.env["REDIS_IP_FAMILY"]) || 4; + export const IsProduction: boolean = process.env["ENVIRONMENT"] === "production"; diff --git a/Common/Server/Infrastructure/Redis.ts b/Common/Server/Infrastructure/Redis.ts index 77fb01f9c0d..576969e7f78 100644 --- a/Common/Server/Infrastructure/Redis.ts +++ b/Common/Server/Infrastructure/Redis.ts @@ -1,6 +1,7 @@ import { RedisDb, RedisHostname, + RedisIPFamily, RedisPassword, RedisPort, RedisTlsCa, @@ -40,6 +41,7 @@ export default abstract class Redis { password: RedisPassword, db: RedisDb, enableTLSForSentinelMode: RedisTlsSentinelMode, + family: RedisIPFamily, lazyConnect: true, }; From 96f5173fb9903002b419c88d2da46cbd8937c802 Mon Sep 17 00:00:00 2001 From: Jules Lefebvre Date: Tue, 24 Dec 2024 11:45:07 +0100 Subject: [PATCH 2/3] feat(docker): allow to chose redis ip family Add the `REDIS_IP_FAMILY` to the default docker environment variables --- config.example.env | 1 + docker-compose.base.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/config.example.env b/config.example.env index 8137d1eb64c..59c02730c56 100644 --- a/config.example.env +++ b/config.example.env @@ -88,6 +88,7 @@ REDIS_HOST=redis REDIS_PORT=6379 REDIS_DB=0 REDIS_USERNAME=default +REDIS_IP_FAMILY= REDIS_TLS_CA= REDIS_TLS_SENTINEL_MODE=false diff --git a/docker-compose.base.yml b/docker-compose.base.yml index f57180a4a1b..ce8efda6f10 100644 --- a/docker-compose.base.yml +++ b/docker-compose.base.yml @@ -90,6 +90,7 @@ x-common-server-variables: &common-server-variables REDIS_HOST: ${REDIS_HOST} REDIS_PORT: ${REDIS_PORT} REDIS_DB: ${REDIS_DB} + REDIS_IP_FAMILY: ${REDIS_IP_FAMILY} REDIS_TLS_CA: ${REDIS_TLS_CA} REDIS_TLS_SENTINEL_MODE: ${REDIS_TLS_SENTINEL_MODE} From 19162504c8fe0e1741e39fd122c4259e69efc270 Mon Sep 17 00:00:00 2001 From: Jules Lefebvre Date: Tue, 24 Dec 2024 11:54:41 +0100 Subject: [PATCH 3/3] feat(helm): add `externalRedis.ipFamily` configuration Add the `externalRedis.ipFamily` values to set `REDIS_IP_FAMILY environmental variable --- HelmChart/Public/oneuptime/templates/_helpers.tpl | 2 ++ HelmChart/Public/oneuptime/values.yaml | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/HelmChart/Public/oneuptime/templates/_helpers.tpl b/HelmChart/Public/oneuptime/templates/_helpers.tpl index 5810c14fa63..fec34a7e0d1 100644 --- a/HelmChart/Public/oneuptime/templates/_helpers.tpl +++ b/HelmChart/Public/oneuptime/templates/_helpers.tpl @@ -297,6 +297,8 @@ Usage: key: {{ $.Values.externalRedis.existingSecret.passwordKey }} {{- end }} {{- end }} +- name: REDIS_IP_FAMILY + value: {{ printf "%s" $.Values.externalRedis.ipFamily | quote }} - name: REDIS_DB {{- if $.Values.redis.enabled }} value: {{ printf "0" | squote}} diff --git a/HelmChart/Public/oneuptime/values.yaml b/HelmChart/Public/oneuptime/values.yaml index a1472428886..9e470e0c45c 100644 --- a/HelmChart/Public/oneuptime/values.yaml +++ b/HelmChart/Public/oneuptime/values.yaml @@ -2,7 +2,6 @@ global: storageClass: clusterDomain: &global-cluster-domain cluster.local - # Please change this to the domain name / IP where OneUptime server is hosted on. host: localhost httpProtocol: http @@ -343,6 +342,7 @@ externalRedis: port: username: password: + ipFamily: # If you're using an existing secret for the password, please use this instead of password. existingSecret: name: