Skip to content

Commit

Permalink
Merge pull request #1773 from diabolocom/redis-ipv6
Browse files Browse the repository at this point in the history
Feature: Allow to set Redis IP Family
  • Loading branch information
simlarsen authored Dec 24, 2024
2 parents 64bba92 + 1916250 commit bb543ef
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 1 deletion.
3 changes: 3 additions & 0 deletions Common/Server/EnvironmentConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down
2 changes: 2 additions & 0 deletions Common/Server/Infrastructure/Redis.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {
RedisDb,
RedisHostname,
RedisIPFamily,
RedisPassword,
RedisPort,
RedisTlsCa,
Expand Down Expand Up @@ -40,6 +41,7 @@ export default abstract class Redis {
password: RedisPassword,
db: RedisDb,
enableTLSForSentinelMode: RedisTlsSentinelMode,
family: RedisIPFamily,
lazyConnect: true,
};

Expand Down
2 changes: 2 additions & 0 deletions HelmChart/Public/oneuptime/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
Expand Down
2 changes: 1 addition & 1 deletion HelmChart/Public/oneuptime/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions config.example.env
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions docker-compose.base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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}

Expand Down

0 comments on commit bb543ef

Please sign in to comment.