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, }; 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: 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}