From 44f8899947df9a3dccd81eab52c21a64b5085dfb Mon Sep 17 00:00:00 2001 From: Justin Hayes Date: Thu, 14 Mar 2024 23:39:15 -0400 Subject: [PATCH 1/2] Create tutorial/ollama.md Add tutorial page for setting up multiple Ollama backends. --- docs/tutorial/ollama.md | 52 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 docs/tutorial/ollama.md diff --git a/docs/tutorial/ollama.md b/docs/tutorial/ollama.md new file mode 100644 index 0000000..28d8af6 --- /dev/null +++ b/docs/tutorial/ollama.md @@ -0,0 +1,52 @@ +--- +sidebar_position: 1 +title: "Ollama Load Balancing" +--- + +# Ollama Load Balancing Setup + +This guide demonstrates how to configure Open WebUI to connect to multiple Ollama instances for load balancing within your deployment. This approach enables you to distribute processing loads across several nodes, enhancing both performance and reliability. The configuration leverages environment variables to manage connections between container updates, rebuilds, or redeployments seamlessly. + +## Docker Run + +To connect to multiple Ollama instances with Docker, use the following example command: + +```bash +docker run -d -p 3000:8080 \ + -v open-webui:/app/backend/data \ + -e OLLAMA_BASE_URLS="http://ollama-one:11434;http://ollama-two:11434" \ + --name open-webui \ + --restart always \ + ghcr.io/open-webui/open-webui:main +``` + +This command configures your Docker container with these key environment variables: + +- `OLLAMA_BASE_URLS`: Specifies the base URLs for each Ollama instance, separated by semicolons (`;`). This example uses two instances, but you can adjust this to fit your setup. + +Ensure both Ollama instances are of the same version and have matching tags for each model they share. Discrepancies in model versions or tags across instances can lead to errors due to how WebUI de-duplicates and merges model lists. + +## Docker Compose + +For those preferring `docker-compose`, here's an abridged version of a `docker-compose.yaml` file: + +```yaml +services: + open-webui: + environment: + - OLLAMA_BASE_URLS=http://ollama-one:11434;http://ollama-two:11434 +``` + +To further streamline this setup, you can define `OLLAMA_BASE_URLS` in an `.env` file located in the same directory as your `docker-compose.yaml`. Your `.env` file might look like this: + +```ini +OLLAMA_BASE_URLS="http://ollama-one:11434;http://ollama-two:11434" +``` + +## Ensuring Model Consistency + +Both Ollama instances must run identical versions and tags for each shared model to prevent issues. The system allows for models to be present on one server and not the other, smartly routing requests to the server containing the requested model. However, having different versions or hashes for the same model tag across instances can cause inconsistencies. + +Utilize the `Update All Models` button beside the server selector drop-down within the **Settings > Models** screen to keep models synchronized across instances. + +By following these steps, you can effectively distribute the computational load across multiple Ollama instances, ensuring a robust and efficient deployment with Open WebUI. From 79312d0dc676978e1ee30bd60f2af5319e584212 Mon Sep 17 00:00:00 2001 From: Justin Hayes Date: Thu, 14 Mar 2024 23:41:33 -0400 Subject: [PATCH 2/2] Update tutorial/openai.md --- docs/tutorial/openai.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/tutorial/openai.md b/docs/tutorial/openai.md index 4511bc4..957bb9f 100644 --- a/docs/tutorial/openai.md +++ b/docs/tutorial/openai.md @@ -1,5 +1,5 @@ --- -sidebar_position: 1 +sidebar_position: 2 title: "OpenAI API" --- @@ -9,7 +9,7 @@ In this tutorial, we will demonstrate how to configure multiple OpenAI (or compa ## Docker Run -Here's an example `docker run` command similar to what you might use for Open-WebUI: +Here's an example `docker run` command similar to what you might use for Open WebUI: ```bash docker run -d -p 3000:8080 \ -v open-webui:/app/backend/data \ @@ -28,7 +28,7 @@ You can adapt this command to your own needs, and add even more endpoint/key pai ## Docker Compose -Alternatively, you can use a `docker-compose.yaml` file to define and run the Open-WebUI container. Here's an abridged version of what that might look like: +Alternatively, you can use a `docker-compose.yaml` file to define and run the Open WebUI container. Here's an abridged version of what that might look like: ```yaml services: open-webui: