mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-06 10:58:17 -05:00
[PR #11148] [MERGED] feat: Support for Redis Sentinel #45714
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/11148
Author: @Ithanil
Created: 3/4/2025
Status: ✅ Merged
Merged: 3/28/2025
Merged by: @tjbck
Base:
dev← Head:redis_sentinel📝 Commits (7)
3b35774first part of adding Redis Sentinel support4370332second part of adding Redis Sentinel support9bf6639fixes & add envs for Sentinel implementation9167a8brefac as prep for sentinel support in AppConfige68cd9bRedis Sentinel support for AppConfigd0b13cfprefix sentinel envs with redis_0615c11fix sentinel connection being attempted for non-sentinel redis📊 Changes
6 files changed (+128 additions, -14 deletions)
View changed files
📝
backend/open_webui/config.py(+5 -3)📝
backend/open_webui/env.py(+6 -0)📝
backend/open_webui/main.py(+6 -1)📝
backend/open_webui/socket/main.py(+15 -4)📝
backend/open_webui/socket/utils.py(+5 -6)➕
backend/open_webui/utils/redis.py(+91 -0)📄 Description
Support for Redis Sentinel
Adds support for Redis Sentinel failover clusters, allowing for a fully highly available OpenWebUI-Setup.
Pull Request Checklist
Before submitting, make sure you've checked the following:
devbranch.Changelog Entry
Description
The PR adds support for Redis Sentinel failover clusters, allowing for a fully highly available OpenWebUI-Setup. Unfortunately, the implemention needs to work around socketio's lack of support for Redis Sentinel in a somewhat involved way, by creating a class AsyncRedisSentinelManager that inherits from socketio's AsyncRedisManager and bypasses the parent constructor. Otherwise, the Sentinel support from redis-py is used directly.
To avoid adding too many new env variables, WEBSOCKET_REDIS_URL (and REDIS_URL) is maintained as source of Redis configuration, but with the "host" part being used as Sentinel service name.
The code has been tested in a staging environment and is stable.
Added
Notes
I'm not entirely sure why there are both REDIS_URL and WEBSOCKET_REDIS_URL envs. It seems like the former has only recently been picked up for AppConfig. For the moment, I have correspondingly added two sets of Sentinel environment variables. But because I'm not sure if this is supposed to stay like this, I'm currently holding back on commiting corresponding changes to the documentation.Doc PR: https://github.com/open-webui/docs/pull/457
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.