From de5024633bb6695c0afd91f054c7382d4872cbe8 Mon Sep 17 00:00:00 2001 From: tremor021 Date: Thu, 23 Apr 2026 12:18:59 +0200 Subject: [PATCH] owebui trixie test --- ct/openwebui.sh | 144 +++++++++++++++++++++++++++++++++++ install/openwebui-install.sh | 125 ++++++++++++++++++++++++++++++ 2 files changed, 269 insertions(+) create mode 100644 ct/openwebui.sh create mode 100644 install/openwebui-install.sh diff --git a/ct/openwebui.sh b/ct/openwebui.sh new file mode 100644 index 00000000..9a5115b5 --- /dev/null +++ b/ct/openwebui.sh @@ -0,0 +1,144 @@ +#!/usr/bin/env bash +source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/build.func) +# Copyright (c) 2021-2026 tteck +# Author: tteck | Co-Author: havardthom | Co-Author: Slaviša Arežina (tremor021) +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://openwebui.com/ + +APP="Open WebUI" +var_tags="${var_tags:-ai;interface}" +var_cpu="${var_cpu:-4}" +var_ram="${var_ram:-8192}" +var_disk="${var_disk:-50}" +var_os="${var_os:-debian}" +var_version="${var_version:-13}" +var_unprivileged="${var_unprivileged:-1}" +var_gpu="${var_gpu:-yes}" + +header_info "$APP" +variables +color +catch_errors + +function update_script() { + header_info + check_container_storage + check_container_resources + + ensure_dependencies zstd build-essential libmariadb-dev + + if [[ -d /opt/open-webui ]]; then + msg_warn "Legacy installation detected — migrating to uv based install..." + msg_info "Stopping Service" + systemctl stop open-webui + msg_ok "Stopped Service" + + msg_info "Creating Backup" + mkdir -p /opt/open-webui-backup + cp -a /opt/open-webui/backend/data /opt/open-webui-backup/data || true + cp -a /opt/open-webui/.env /opt/open-webui-backup/.env || true + msg_ok "Created Backup" + + msg_info "Removing legacy installation" + rm -rf /opt/open-webui + rm -rf /root/.open-webui || true + msg_ok "Removed legacy installation" + + msg_info "Installing uv-based Open-WebUI" + PYTHON_VERSION="3.12" setup_uv + $STD uv tool install --python 3.12 --constraint <(echo "numba>=0.60") open-webui[all] + msg_ok "Installed uv-based Open-WebUI" + + msg_info "Restoring data" + mkdir -p /root/.open-webui + cp -a /opt/open-webui-backup/data/* /root/.open-webui/ || true + cp -a /opt/open-webui-backup/.env /root/.env || true + rm -rf /opt/open-webui-backup || true + msg_ok "Restored data" + + msg_info "Recreating Service" + cat </etc/systemd/system/open-webui.service +[Unit] +Description=Open WebUI Service +After=network.target + +[Service] +Type=simple +Environment=DATA_DIR=/root/.open-webui +EnvironmentFile=-/root/.env +ExecStart=/root/.local/bin/open-webui serve +WorkingDirectory=/root +Restart=on-failure +RestartSec=5 +User=root + +[Install] +WantedBy=multi-user.target +EOF + + $STD systemctl daemon-reload + systemctl enable -q --now open-webui + msg_ok "Recreated Service" + + msg_ok "Migration completed" + exit 0 + fi + + if [[ ! -d /root/.open-webui ]]; then + msg_error "No ${APP} Installation Found!" + exit + fi + + if [ -x "/usr/bin/ollama" ]; then + msg_info "Checking for Ollama Update" + OLLAMA_VERSION=$(ollama -v | awk '{print $NF}') + RELEASE=$(curl -s https://api.github.com/repos/ollama/ollama/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4)}') + if [ "$OLLAMA_VERSION" != "$RELEASE" ]; then + msg_info "Ollama update available: v$OLLAMA_VERSION -> v$RELEASE" + msg_info "Downloading Ollama v$RELEASE \n" + curl -fS#LO https://github.com/ollama/ollama/releases/download/v${RELEASE}/ollama-linux-amd64.tar.zst + msg_ok "Download Complete" + + if [ -f "ollama-linux-amd64.tar.zst" ]; then + + msg_info "Stopping Ollama Service" + systemctl stop ollama + msg_ok "Stopped Service" + + msg_info "Installing Ollama" + rm -rf /usr/lib/ollama + rm -rf /usr/bin/ollama + tar --zstd -C /usr -xf ollama-linux-amd64.tar.zst + rm -rf ollama-linux-amd64.tar.zst + msg_ok "Installed Ollama" + + msg_info "Starting Ollama Service" + systemctl start ollama + msg_ok "Started Service" + + msg_ok "Ollama updated to version $RELEASE" + else + msg_error "Ollama download failed. Aborting update." + fi + else + msg_ok "Ollama is already up to date." + fi + fi + + msg_info "Updating Open WebUI via uv" + PYTHON_VERSION="3.12" setup_uv + $STD uv tool install --force --python 3.12 --constraint <(echo "numba>=0.60") open-webui[all] + systemctl restart open-webui + msg_ok "Updated Open WebUI" + msg_ok "Updated successfully!" + exit +} + +start +build_container +description + +msg_ok "Completed successfully!\n" +echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}" +echo -e "${INFO}${YW} Access it using the following URL:${CL}" +echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:8080${CL}" diff --git a/install/openwebui-install.sh b/install/openwebui-install.sh new file mode 100644 index 00000000..1344a88c --- /dev/null +++ b/install/openwebui-install.sh @@ -0,0 +1,125 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2026 tteck +# Author: tteck | Co-Author: havardthom | Co-Author: Slaviša Arežina (tremor021) +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://openwebui.com/ + +source /dev/stdin <<<"$FUNCTIONS_FILE_PATH" +color +verb_ip6 +catch_errors +setting_up_container +network_check +update_os + +msg_info "Installing Dependencies" +$STD apt install -y \ + ffmpeg \ + zstd \ + build-essential \ + libmariadb-dev +msg_ok "Installed Dependencies" + +setup_hwaccel + +PYTHON_VERSION="3.12" setup_uv + +msg_info "Installing Open WebUI" +$STD uv tool install --python 3.12 --constraint <(echo "numba>=0.60") open-webui[all] +msg_ok "Installed Open WebUI" + +read -r -p "${TAB3}Would you like to add Ollama? " prompt +if [[ ${prompt,,} =~ ^(y|yes)$ ]]; then + msg_info "Setting up Intel® Repositories" + mkdir -p /usr/share/keyrings + curl -fsSL https://repositories.intel.com/gpu/intel-graphics.key | gpg --dearmor -o /usr/share/keyrings/intel-graphics.gpg 2>/dev/null || true + cat </etc/apt/sources.list.d/intel-gpu.sources +Types: deb +URIs: https://repositories.intel.com/gpu/ubuntu +Suites: jammy +Components: client +Architectures: amd64 i386 +Signed-By: /usr/share/keyrings/intel-graphics.gpg +EOF + curl -fsSL https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | gpg --dearmor -o /usr/share/keyrings/oneapi-archive-keyring.gpg 2>/dev/null || true + cat </etc/apt/sources.list.d/oneAPI.sources +Types: deb +URIs: https://apt.repos.intel.com/oneapi +Suites: all +Components: main +Signed-By: /usr/share/keyrings/oneapi-archive-keyring.gpg +EOF + $STD apt update + msg_ok "Set up Intel® Repositories" + + msg_info "Installing Intel® Level Zero" + # Debian 13+ has newer Level Zero packages in system repos that conflict with Intel repo packages + if is_debian && [[ "$(get_os_version_major)" -ge 13 ]]; then + # Use system packages on Debian 13+ (avoid conflicts with libze1) + $STD apt -y install libze1 libze-dev intel-level-zero-gpu 2>/dev/null || { + msg_warn "Failed to install some Level Zero packages, continuing anyway" + } + else + # Use Intel repository packages for older systems + $STD apt -y install intel-level-zero-gpu level-zero level-zero-dev 2>/dev/null || { + msg_warn "Failed to install Intel Level Zero packages, continuing anyway" + } + fi + msg_ok "Installed Intel® Level Zero" + + msg_info "Installing Intel® oneAPI Base Toolkit (Patience)" + $STD apt install -y --no-install-recommends intel-basekit-2024.1 2>/dev/null || true + msg_ok "Installed Intel® oneAPI Base Toolkit" + + msg_info "Installing Ollama" + OLLAMA_RELEASE=$(curl -fsSL https://api.github.com/repos/ollama/ollama/releases/latest | grep "tag_name" | awk -F '"' '{print $4}') + curl -fsSLO -C - https://github.com/ollama/ollama/releases/download/${OLLAMA_RELEASE}/ollama-linux-amd64.tar.zst + tar --zstd -C /usr -xf ollama-linux-amd64.tar.zst + rm -rf ollama-linux-amd64.tar.zst + cat </etc/systemd/system/ollama.service +[Unit] +Description=Ollama Service +After=network-online.target + +[Service] +Type=exec +ExecStart=/usr/bin/ollama serve +Environment=HOME=$HOME +Environment=OLLAMA_HOST=0.0.0.0 +Restart=always +RestartSec=3 + +[Install] +WantedBy=multi-user.target +EOF + systemctl enable -q --now ollama + echo "ENABLE_OLLAMA_API=true" >/root/.env + msg_ok "Installed Ollama" +fi + +msg_info "Creating Service" +cat </etc/systemd/system/open-webui.service +[Unit] +Description=Open WebUI Service +After=network.target + +[Service] +Type=simple +EnvironmentFile=-/root/.env +Environment=DATA_DIR=/root/.open-webui +ExecStart=/root/.local/bin/open-webui serve +WorkingDirectory=/root +Restart=on-failure +RestartSec=5 +User=root + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now open-webui +msg_ok "Created Service" + +motd_ssh +customize +cleanup_lxc