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

Add redis for websocket #137

Open
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

jyje
Copy link
Contributor

@jyje jyje commented Jan 11, 2025

Opinion

Important

I tested this feature in local k8s and personal on-premise k8s. To verify clearly, I hope you guys test and improve with me

Hello folks.

To resolve #135, I added redis deployments for websocket supports without PV+PVC or HA settings. This is small installation scenario in here. After merging this, I will propose the installation of HA redis cluster from bitnami chart step-by-step. Please give me any advise.

Thank you


Copilot Summary

This pull request introduces websocket support to the Open WebUI Helm chart, along with several related enhancements and configurations. The most important changes include adding websocket configuration options, defining Redis deployment and service templates, and updating the chart version.

Websocket support and configuration:

  • charts/open-webui/README.md: Added websocket configuration options, including enabling websocket support, specifying the websocket manager, and configuring Redis settings.
  • charts/open-webui/values.yaml: Introduced websocket configuration parameters such as enabling websocket support, specifying the websocket manager, and defining Redis settings.

Redis deployment and service templates:

Chart version update:

@jyje jyje force-pushed the feat/websocket-with-redis branch from f1a6c78 to 3b1bfc2 Compare January 11, 2025 14:17
@jyje
Copy link
Contributor Author

jyje commented Jan 11, 2025

By this doc(redis verification), maybe, I can verify redis configuration for 3 scenarios in #135 (Small, Full, External). I will soon be able to ready this draft for review 🥹.

jyje added 2 commits January 12, 2025 01:34
- add values and corresponding readme
- add subchart **redis-20.6.2**
@jyje
Copy link
Contributor Author

jyje commented Jan 11, 2025

Note

If there is something wrong. Please comment and improve it together.

Hello folks. I tired add Redis. Please review these commands for reproducing together.

0. Default (+Prerequirement)

kind create cluster -n owui-websocket
git clone -b feat/websocket-with-redis https://github.com/jyje/owui-helm-charts.git
cd owui-helm-charts

helm template owui-default ./charts/open-webui \
  --namespace owui-default --create-namespace \
  --set 'extraEnvVars[0].name=SOCKET_LOG_LEVEL' \
  --set 'extraEnvVars[0].value=DEBUG' \
  > owui-default.yaml

kubectl create namespace owui-default
kubectl apply -f owui-default.yaml

kubectl wait -n owui-default --for=condition=Ready pod/open-webui-0
kubectl get -n owui-default all
kubectl logs -n owui-default pod/open-webui-0 -c open-webui | grep "open_webui.socket"

## You may see:
# DEBUG [open_webui.socket.main] Running periodic_usage_pool_cleanup

kubectl delete namespace owui-default

1. Small Installation

a single redis pod from deployment

helm template owui-small ./charts/open-webui \
  --namespace owui-small --create-namespace \
  --set websocket.enabled=true \
  --set 'extraEnvVars[0].name=SOCKET_LOG_LEVEL' \
  --set 'extraEnvVars[0].value=DEBUG' \
  > owui-small.yaml

kubectl create namespace owui-small
kubectl apply -f owui-small.yaml

kubectl wait -n owui-small --for=condition=Ready pod/open-webui-0
kubectl get -n owui-small all
kubectl logs -n owui-small pod/open-webui-0 -c open-webui | grep "open_webui.socket"

## You may see:
# DEBUG:open_webui.socket.main:Using Redis to manage websockets.
# DEBUG [open_webui.socket.main] Running periodic_usage_pool_cleanup

kubectl delete namespace owui-small

2. Full Installation

deploy and connect redis chart

helm template owui-full ./charts/open-webui \
  --namespace owui-full --create-namespace \
  --set websocket.enabled=true \
  --set websocket.redis.enabled=false \
  --set websocket.url=redis://open-webui-redis-master:6379/0 \
  --set redis-cluster.enabled=true \
  --set 'extraEnvVars[0].name=SOCKET_LOG_LEVEL' \
  --set 'extraEnvVars[0].value=DEBUG' \
  > owui-full.yaml

kubectl create namespace owui-full
kubectl apply -f owui-full.yaml

kubectl wait -n owui-full --for=condition=Ready pod/open-webui-0
kubectl get -n owui-full all
kubectl logs -n owui-full pod/open-webui-0 -c open-webui | grep "open_webui.socket"

## You may see:
# DEBUG:open_webui.socket.main:Using Redis to manage websockets.
# DEBUG [open_webui.socket.main] Running periodic_usage_pool_cleanup

kubectl delete namespace owui-full

3. External Installation

connect external redis url (no redis in k8s)

# please set url to `localhost:6379` or `redis.example.com`
helm template owui-external ./charts/open-webui \
  --namespace owui-external --create-namespace \
  --set websocket.enabled=true \
  --set websocket.redis.enabled=false \
  --set websocket.url=redis://redis.example.com/0 \
  --set 'extraEnvVars[0].name=SOCKET_LOG_LEVEL' \
  --set 'extraEnvVars[0].value=DEBUG' \
  > owui-external.yaml

kubectl create namespace owui-external
kubectl apply -f owui-external.yaml

kubectl wait -n owui-external --for=condition=Ready pod/open-webui-0
kubectl get -n owui-external all
kubectl logs -n owui-external pod/open-webui-0 -c open-webui | grep "open_webui.socket"

## You may see:
# DEBUG:open_webui.socket.main:Using Redis to manage websockets.
# DEBUG [open_webui.socket.main] Running periodic_usage_pool_cleanup

kubectl delete namespace owui-external

Copilot Summary

This pull request introduces several significant updates to the open-webui Helm chart. The main changes include version upgrades, the addition of Redis and WebSocket support, and the corresponding updates to configuration files and templates.

Version Upgrade:

Note

Proposed version needs to be checked

Redis Support:

WebSocket Support:

@jyje jyje marked this pull request as ready for review January 11, 2025 17:37
@jyje
Copy link
Contributor Author

jyje commented Jan 11, 2025

I tested using above 3 set of commands

Here is test kind cluster:
image

And here is log of an owui websocket mode with a bitnami redis chart
image

@0xThresh
Copy link
Collaborator

Hi @jyje, thank you for another amazing PR. I haven't had the chance to test this one out yet but should hopefully be able to do so in the next few days so we can get this merged if it all works. I'll let you know if I run into any issues when I get a chance to try this out!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Redis to helm chart
2 participants