🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
feat(redis): add optional TLS for Redis Sentinel (#13360)
Stanislav Nikulindd740850622a
diff --git a/.env.dev.example b/.env.dev.exampleindex 5b74c7b3c8..2394dade3d 100644--- a/.env.dev.example+++ b/.env.dev.example@@ -130,6 +130,7 @@ REDIS_AUTH="myredissecret"# Cache operations will use this via ioredis keyPrefix# LANGFUSE_BULLMQ_SKIP_REDIS_VERSION_CHECK="false" # Set to true for Redis-compatible services that report a non-Redis version# REDIS_SENTINEL_ENABLED="false"+# REDIS_SENTINEL_TLS_ENABLED="false" # Requires REDIS_TLS_ENABLED="true"; otherwise ignored.# REDIS_SENTINEL_NODES="sentinel1:26379,sentinel2:26379"# REDIS_SENTINEL_MASTER_NAME="mymaster"# REDIS_SENTINEL_USERNAME=""diff --git a/.env.prod.example b/.env.prod.exampleindex 1421db3e61..ff8ef0d5c7 100644--- a/.env.prod.example+++ b/.env.prod.example@@ -219,6 +219,7 @@ LANGFUSE_ENABLE_BLOB_STORAGE_FILE_LOG=true# Redis Sentinel configuration (optional, cannot be enabled with cluster mode simultaneously)# REDIS_SENTINEL_ENABLED=false+# REDIS_SENTINEL_TLS_ENABLED=false # Requires REDIS_TLS_ENABLED="true"; otherwise ignored.# REDIS_SENTINEL_NODES=sentinel1:26379,sentinel2:26379,sentinel3:26379# REDIS_SENTINEL_MASTER_NAME=mymaster# REDIS_SENTINEL_USERNAME=diff --git a/packages/shared/src/env.ts b/packages/shared/src/env.tsindex 48693e58ef..7b06411e2f 100644--- a/packages/shared/src/env.ts+++ b/packages/shared/src/env.ts@@ -67,6 +67,7 @@ const EnvSchema = z.object({.positive().default(5000),REDIS_SENTINEL_ENABLED: z.enum(["true", "false"]).default("false"),+ REDIS_SENTINEL_TLS_ENABLED: z.enum(["true", "false"]).default("false"),REDIS_SENTINEL_NODES: z.string().optional(),REDIS_SENTINEL_MASTER_NAME: z.string().optional(),REDIS_SENTINEL_USERNAME: z.string().optional(),diff --git a/packages/shared/src/server/redis/redis.ts b/packages/shared/src/server/redis/redis.tsindex 8d68e8a6e3..8f9cfb80f3 100644--- a/packages/shared/src/server/redis/redis.ts+++ b/packages/shared/src/server/redis/redis.ts@@ -166,6 +166,14 @@ const createRedisSentinelInstance = (const sentinels = parseSentinelNodes(env.REDIS_SENTINEL_NODES);const tlsOptions = buildTlsOptions();+ const sentinelTlsRequested = env.REDIS_SENTINEL_TLS_ENABLED === "true";+ const redisTlsEnabled = env.REDIS_TLS_ENABLED === "true";++ if (sentinelTlsRequested && !redisTlsEnabled) {+ logger.warn(+ "REDIS_SENTINEL_TLS_ENABLED is true but REDIS_TLS_ENABLED is false; sentinel TLS will not be applied",+ );+ }const instance = new Redis({sentinels,@@ -174,6 +182,12 @@ const createRedisSentinelInstance = (password: env.REDIS_AUTH || undefined,sentinelUsername: env.REDIS_SENTINEL_USERNAME || undefined,sentinelPassword: env.REDIS_SENTINEL_PASSWORD || undefined,+ ...(sentinelTlsRequested && redisTlsEnabled && tlsOptions.tls+ ? {+ enableTLSForSentinelMode: true,+ sentinelTLS: tlsOptions.tls,+ }+ : {}),...defaultRedisOptions,...additionalOptions,...tlsOptions,