Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Allow to set Redis IP Family #1773

Merged
merged 3 commits into from
Dec 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading