diff --git a/docs/features/usergroups/default-perms.md b/docs/features/usergroups/default-perms.md new file mode 100644 index 0000000..ff319fe --- /dev/null +++ b/docs/features/usergroups/default-perms.md @@ -0,0 +1,6 @@ +--- +sidebar_position: 4 +title: "☑️ Default Permissions" +--- + +COMING SOON! diff --git a/docs/getting-started/advanced-topics/env-configuration.md b/docs/getting-started/advanced-topics/env-configuration.md index fe0e4e0..e4c3550 100644 --- a/docs/getting-started/advanced-topics/env-configuration.md +++ b/docs/getting-started/advanced-topics/env-configuration.md @@ -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. diff --git a/docs/tutorials/integrations/redis.md b/docs/tutorials/integrations/redis.md new file mode 100644 index 0000000..a31b855 --- /dev/null +++ b/docs/tutorials/integrations/redis.md @@ -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. diff --git a/docs/tutorials/integrations/web_search.md b/docs/tutorials/integrations/web_search.md index 9301f19..96ace85 100644 --- a/docs/tutorials/integrations/web_search.md +++ b/docs/tutorials/integrations/web_search.md @@ -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 by the SearXNG hostname +# * uncomment LETSENCRYPT_EMAIL, and replace by your email (require to create a Let's Encrypt certificate) + + +SEARXNG_HOSTNAME=example.locale +# LETSENCRYPT_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/ searxng-docker/limiter.toml ```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