mirror of
https://github.com/open-webui/docs
synced 2025-05-20 03:08:56 +00:00
Merge pull request #335 from silentoplayz/main
New "Redis Websockets" Docs Page
This commit is contained in:
commit
6d8b6d97ca
6
docs/features/usergroups/default-perms.md
Normal file
6
docs/features/usergroups/default-perms.md
Normal file
@ -0,0 +1,6 @@
|
||||
---
|
||||
sidebar_position: 4
|
||||
title: "☑️ Default Permissions"
|
||||
---
|
||||
|
||||
COMING SOON!
|
@ -1151,6 +1151,26 @@ account takeovers.
|
||||
- Default: `${DATA_DIR}/tools`
|
||||
- Description: Specifies the directory for custom tools.
|
||||
|
||||
### Redis
|
||||
|
||||
#### `ENABLE_WEBSOCKET_SUPPORT`
|
||||
|
||||
- Type: `bool`
|
||||
- Default: `False`
|
||||
- Description: Enables websocket support in Open WebUI (used with Redis).
|
||||
|
||||
#### `WEBSOCKET_MANAGER`
|
||||
|
||||
- Type: `str`
|
||||
- Default: `redis`
|
||||
- Description: Specifies the websocket manager to use (in this case, Redis).
|
||||
|
||||
#### `WEBSOCKET_REDIS_URL`
|
||||
|
||||
- Type: `str`
|
||||
- Default: `redis://localhost:6379/0`
|
||||
- Description: Specifies the URL of the Redis instance for websocket communication.
|
||||
|
||||
## Misc Environment Variables
|
||||
|
||||
These variables are not specific to Open WebUI but can still be valuable in certain contexts.
|
||||
|
94
docs/tutorials/integrations/redis.md
Normal file
94
docs/tutorials/integrations/redis.md
Normal file
@ -0,0 +1,94 @@
|
||||
---
|
||||
sidebar_position: 30
|
||||
title: "🔒 Redis Websocket Support"
|
||||
---
|
||||
|
||||
# 🔒 Redis Websocket Support
|
||||
|
||||
## Overview
|
||||
|
||||
This documentation page outlines the steps required to integrate Redis with Open WebUI for websocket support. By following these steps, you will be able to enable websocket functionality in your Open WebUI instance, allowing for real-time communication and updates between clients and your application.
|
||||
|
||||
### Prerequisites
|
||||
|
||||
* A valid Open WebUI instance (running version 1.0 or higher)
|
||||
* A Redis container (we will use `docker.io/valkey/valkey:8.0.1-alpine` in this example, which is based on the latest Redis 7.x release)
|
||||
* Docker Composer (version 2.0 or higher) installed on your system
|
||||
|
||||
## Setting up Redis
|
||||
|
||||
To set up Redis for websocket support, you will need to create a `docker-compose.yml` file with the following contents:
|
||||
|
||||
```yml
|
||||
version: '3.9'
|
||||
services:
|
||||
redis:
|
||||
image: docker.io/valkey/valkey:8.0.1-alpine
|
||||
container_name: redis-valkey
|
||||
volumes:
|
||||
- redis-data:/data
|
||||
command: "valkey-server --save 30 1"
|
||||
healthcheck:
|
||||
test: "[ $$(valkey-cli ping) = 'PONG' ]"
|
||||
start_period: 5s
|
||||
interval: 1s
|
||||
timeout: 3s
|
||||
retries: 5
|
||||
restart: unless-stopped
|
||||
cap_drop:
|
||||
- ALL
|
||||
cap_add:
|
||||
- SETGID
|
||||
- SETUID
|
||||
- DAC_OVERRIDE
|
||||
logging:
|
||||
driver: "json-file"
|
||||
options:
|
||||
max-size: "1m"
|
||||
max-file: "1"
|
||||
|
||||
volumes:
|
||||
redis-data:
|
||||
```
|
||||
|
||||
This configuration sets up a Redis container named `redis-valkey` and mounts a volume for data persistence. The `healthcheck` directive ensures that the container is restarted if it fails to respond to the `ping` command.
|
||||
|
||||
## Configuring Open WebUI
|
||||
|
||||
To enable websocket support in Open WebUI, you will need to set the following environment variables for your Open WebUI instance:
|
||||
|
||||
```bash
|
||||
ENABLE_WEBSOCKET_SUPPORT="true"
|
||||
WEBSOCKET_MANAGER="redis"
|
||||
WEBSOCKET_REDIS_URL="redis://redis:6379/1"
|
||||
```
|
||||
|
||||
These environment variables enable websocket support, specify Redis as the websocket manager, and define the Redis URL. Make sure to replace the `WEBSOCKET_REDIS_URL` value with the actual URL of your Redis instance.
|
||||
|
||||
## Verification
|
||||
|
||||
If you have properly set up Redis and configured Open WebUI, you should see the following log message when starting your Open WebUI instance:
|
||||
|
||||
`DEBUG:open_webui.socket.main:Using Redis to manage websockets.`
|
||||
|
||||
This confirms that Open WebUI is using Redis for websocket management. You can also use the `docker exec` command using Command Prompt to verify that the Redis instance is running and accepting connections:
|
||||
|
||||
```bash
|
||||
docker exec -it redis-valkey redis-cli -p 6379 ping
|
||||
```
|
||||
|
||||
This command should output `PONG` if the Redis instance is running correctly. If this command fails, you could try this command instead:
|
||||
|
||||
```bash
|
||||
docker exec -it redis-valkey valkey-cli -p 6379 ping
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
If you encounter issues with Redis or websocket support in Open WebUI, you can refer to the following resources for troubleshooting:
|
||||
|
||||
* [Redis Documentation](https://redis.io/docs)
|
||||
* [Open WebUI Documentation](https://open-webui.github.io/docs)
|
||||
* [Docker Composer Documentation](https://docs.docker.com/compose/overview/)
|
||||
|
||||
By following these steps and troubleshooting tips, you should be able to set up Redis with Open WebUI for websocket support and enable real-time communication and updates between clients and your application.
|
@ -7,7 +7,7 @@ title: "🌐 Web Search"
|
||||
|
||||
This guide provides instructions on how to set up web search capabilities in Open WebUI using various search engines.
|
||||
|
||||
## SearXNG (Docker)
|
||||
### SearXNG (Docker)
|
||||
|
||||
> "**SearXNG is a free internet metasearch engine which aggregates results from various search services and databases. Users are neither tracked nor profiled.**"
|
||||
|
||||
@ -15,18 +15,41 @@ This guide provides instructions on how to set up web search capabilities in Ope
|
||||
|
||||
If you want to modify the default configuration, follow these steps:
|
||||
|
||||
1. Create a new directory `searxng-docker` by cloning the searxng-docker repository. This folder will contain your SearXNG configuration files. Refer to the [SearXNG documentation](https://docs.searxng.org/) for configuration instructions.
|
||||
#### Create a New Directory `searxng-docker`
|
||||
|
||||
Clone the searxng-docker repository. This folder will contain your SearXNG configuration files. Refer to the [SearXNG documentation](https://docs.searxng.org/) for configuration instructions.
|
||||
|
||||
```bash
|
||||
git clone https://github.com/searxng/searxng-docker.git
|
||||
```
|
||||
|
||||
2. Navigate to the `searxng-docker` repository:
|
||||
#### Configure SearXNG
|
||||
|
||||
Navigate to the `searxng-docker` repository:
|
||||
|
||||
```bash
|
||||
cd searxng-docker
|
||||
```
|
||||
|
||||
Create a new `.env` file:
|
||||
|
||||
```bash
|
||||
touch .env
|
||||
```
|
||||
|
||||
Add the following to the `.env` file:
|
||||
|
||||
```bash
|
||||
# By default listen on https://localhost
|
||||
# To change this:
|
||||
# * uncomment SEARXNG_HOSTNAME, and replace <host> by the SearXNG hostname
|
||||
# * uncomment LETSENCRYPT_EMAIL, and replace <email> by your email (require to create a Let's Encrypt certificate)
|
||||
|
||||
|
||||
SEARXNG_HOSTNAME=example.locale
|
||||
# LETSENCRYPT_EMAIL=<email>
|
||||
```
|
||||
|
||||
3. Remove the `localhost` restriction and define a less used port by modifying the `docker-compose.yaml` file:
|
||||
|
||||
```bash
|
||||
@ -45,7 +68,10 @@ sudo chmod a+rwx searxng-docker/
|
||||
<summary>searxng-docker/limiter.toml</summary>
|
||||
|
||||
```bash
|
||||
|
||||
cat > searxng-docker/limiter.toml << EOF
|
||||
# This configuration file updates the default configuration file See https://github.com/searxng/searxng/blob/master/searx/botdetection/limiter.toml
|
||||
|
||||
[botdetection.ip_limit]
|
||||
# activate link_token method in the ip_limit method
|
||||
link_token = false
|
||||
@ -90,8 +116,9 @@ The default `settings.yml` file contains many engine settings. Below is an extra
|
||||
use_default_settings: true
|
||||
|
||||
server:
|
||||
secret_key: "Generate a secret key and provide it here"
|
||||
limiter: false
|
||||
# base_url is defined in the SEARXNG_BASE_URL environment variable, see .env and docker-compose.yml
|
||||
secret_key: "xxxxx" # change this!
|
||||
limiter: false # can be disabled for a private instance
|
||||
image_proxy: true
|
||||
port: 8080
|
||||
bind_address: "0.0.0.0"
|
||||
@ -105,8 +132,13 @@ search:
|
||||
default_lang: ""
|
||||
formats:
|
||||
- html
|
||||
- json
|
||||
# json is required
|
||||
- json # json is required
|
||||
# remove format to deny access, use lower case.
|
||||
# formats: [html, csv, json, rss]
|
||||
redis:
|
||||
# URL to connect redis database. Is overwritten by ${SEARXNG_REDIS_URL}.
|
||||
# https://docs.searxng.org/admin/settings/settings_redis.html#settings-redis
|
||||
url: redis://redis:6379/2
|
||||
```
|
||||
|
||||
The port in the settings.yml file for SearXNG should match that of the port number in your docker-compose.yml file for SearXNG. So if you plan to use port `1337` for example, you'd set both to `1337`. If you want to use port `8080`, keep both on `8080`. Feel free to change the `bind_address` from `0.0.0.0` to `127.0.0.1` instead. Leaving it on `0.0.0.0` means that SearXNG can listen across all interfaces, while `127.0.0.1` just means that its listening on localhost.
|
||||
@ -194,11 +226,25 @@ services:
|
||||
searxng:
|
||||
image: searxng/searxng:latest
|
||||
container_name: searxng
|
||||
env_file:
|
||||
- stack.env
|
||||
volumes:
|
||||
- ./searxng:/etc/searxng:rw
|
||||
ports:
|
||||
- "1337:8080"
|
||||
volumes:
|
||||
- ./searxng:/etc/searxng
|
||||
restart: unless-stopped
|
||||
cap_drop:
|
||||
- ALL
|
||||
cap_add:
|
||||
- CHOWN
|
||||
- SETGID
|
||||
- SETUID
|
||||
- DAC_OVERRIDE
|
||||
logging:
|
||||
driver: "json-file"
|
||||
options:
|
||||
max-size: "1m"
|
||||
max-file: "1"
|
||||
```
|
||||
|
||||
Launch your updated stack with:
|
||||
@ -210,13 +256,13 @@ docker compose up -d
|
||||
Alternatively, you can run SearXNG directly using `docker run`:
|
||||
|
||||
```bash
|
||||
docker run -d --name searxng -p 1337:8080 -v ./searxng:/etc/searxng --restart always searxng/searxng:latest
|
||||
docker run --name searxng --env-file stack.env -v ./searxng:/etc/searxng:rw -p 1337:8080 --restart unless-stopped --cap-drop ALL --cap-add CHOWN --cap-add SETGID --cap-add SETUID --cap-add DAC_OVERRIDE --log-driver json-file --log-opt max-size=1m,max-file=1 searxng/searxng:latest
|
||||
```
|
||||
|
||||
Confirm connectivity from Open-WebUI container instance:
|
||||
|
||||
```bash
|
||||
docker exec -it open-webui curl 'http://host.docker.internal:1337/search?q=this+is+a+test+query&format=json'
|
||||
docker exec -it open-webui curl http://host.docker.internal:1337/search?q=this+is+a+test+query&format=json
|
||||
```
|
||||
|
||||
### 3. GUI Configuration
|
||||
|
Loading…
Reference in New Issue
Block a user