llm, get Open WebUI & Terminal working 100% without using host network, solves some DNS issues that the containers were seeing for some reason, but adds complexity since they are not in the same compose file.

This commit is contained in:
me committed 2026-10-29 17:37:17 -07:00
1 parent 648962e710
commit 076f954abd
1 file changed
+22 -4
+22 -4
View File
@@ -84,6 +84,7 @@
llm_size_coef: 1.3 llm_size_coef: 1.3
# Base the context on MB of RAM, with a minumum 64k for decent thinking. # Base the context on MB of RAM, with a minumum 64k for decent thinking.
llm_context: "{{ [(ansible_memtotal_mb * 4) | round(-3, method='ceil'), 64000] | max | int }}" llm_context: "{{ [(ansible_memtotal_mb * 4) | round(-3, method='ceil'), 64000] | max | int }}"
llm_docker_network: open-webui-net
- name: Workstation | Linux | Software | LLMs | Facts 02 - name: Workstation | Linux | Software | LLMs | Facts 02
ansible.builtin.set_fact: ansible.builtin.set_fact:
@@ -272,6 +273,7 @@
### Required ### ### Required ###
export HOME={{ user_user.home }} export HOME={{ user_user.home }}
export OLLAMA_HOST=0.0.0.0 # Needed for Open WebUI
### Timeouts ### ### Timeouts ###
export OLLAMA_LOAD_TIMEOUT=30m # default is 5m export OLLAMA_LOAD_TIMEOUT=30m # default is 5m
@@ -411,6 +413,13 @@
content: | content: |
#!/bin/sh #!/bin/sh
exec 2>&1 exec 2>&1
## TBD / TODO
## Move this to the same compose file as Open Terminal.
## Will solve quite a few network related complications.
## Also refactor the two into their own file (open_webui.yml).
## Probably also will then condense into 1 runit service.
image=ghcr.io/open-webui/open-webui:latest image=ghcr.io/open-webui/open-webui:latest
# Wait for Docker to start up. # Wait for Docker to start up.
@@ -439,14 +448,18 @@
# Ensure cleanup on any exit (normal or signal from runit). # Ensure cleanup on any exit (normal or signal from runit).
trap 'kill "$LOOP_PID" 2>/dev/null; wait "$LOOP_PID" 2>/dev/null' EXIT trap 'kill "$LOOP_PID" 2>/dev/null; wait "$LOOP_PID" 2>/dev/null' EXIT
# Create a network for associated programs.
net={{ llm_docker_network }}
docker network inspect $net >/dev/null 2>&1 || \
docker network create $net
# Start the open-webui program. # Start the open-webui program.
set -e set -e
docker run \ docker run \
--name open-webui \ --name open-webui --network $net \
-e PORT={{ open_webui_port }} \ -e PORT={{ open_webui_port }} \
-p {{ open_webui_port }}:{{ open_webui_port }} \ -p {{ open_webui_port }}:{{ open_webui_port }} \--add-host=host.docker.internal:host-gateway \
--add-host=host.docker.internal:host-gateway \ -e OLLAMA_BASE_URL=http://host.docker.internal:11434 \
-e OLLAMA_BASE_URL=http://0.0.0.0:11434 \
{{ ("-e HF_TOKEN=" ~ hf_token) if hf_token else '' }} \ {{ ("-e HF_TOKEN=" ~ hf_token) if hf_token else '' }} \
-e WEBUI_SECRET_KEY={{ open_webui_key }} \ -e WEBUI_SECRET_KEY={{ open_webui_key }} \
-e ENABLE_QUERIES_CACHE=True \ -e ENABLE_QUERIES_CACHE=True \
@@ -686,6 +699,9 @@
# -e OPEN_TERMINAL_PACKAGES="$packages" \ # -e OPEN_TERMINAL_PACKAGES="$packages" \
# -e GOT_EM="$GOT_EM" \ # -e GOT_EM="$GOT_EM" \
# $image run --port {{ open_terminal_port }} # $image run --port {{ open_terminal_port }}
networks:
{{ llm_docker_network }}:
name: {{ llm_docker_network }}
services: services:
open-terminal: open-terminal:
@@ -695,6 +711,8 @@
container_name: open-terminal container_name: open-terminal
ports: ports:
- {{ open_terminal_port }}:{{ open_terminal_port }} - {{ open_terminal_port }}:{{ open_terminal_port }}
networks:
- {{ llm_docker_network }}
#dns: #dns:
# ## Mullvad # ## Mullvad
# ## (https://mullvad.net/en/help/dns-over-https-and-dns-over-tls) # ## (https://mullvad.net/en/help/dns-over-https-and-dns-over-tls)