2025-11-02 23:49:54 -08:00
|
|
|
|
#!/usr/bin/env bash
|
2026-08-25 11:04:15 +02:00
|
|
|
|
_cs_boot="${COMMUNITY_SCRIPTS_CORE_DIR:-$(dirname "${BASH_SOURCE[0]}")/../../core}/core/build.func"
|
|
|
|
|
|
source "$_cs_boot" 2>/dev/null || source <(curl -fsSL "${COMMUNITY_SCRIPTS_CORE_URL:-https://raw.githubusercontent.com/community-scripts/core/main}/core/build.func")
|
2026-01-06 13:28:12 +01:00
|
|
|
|
# Copyright (c) 2021-2026 tteck
|
2025-11-05 14:20:33 +01:00
|
|
|
|
# Author: tteck | Co-Author: havardthom | Co-Author: Slaviša Arežina (tremor021)
|
2024-12-16 12:42:51 +01:00
|
|
|
|
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
|
|
|
|
|
# Source: https://openwebui.com/
|
2024-10-22 18:39:54 +02:00
|
|
|
|
|
|
|
|
|
|
APP="Open WebUI"
|
2025-04-10 11:56:52 +02:00
|
|
|
|
var_tags="${var_tags:-ai;interface}"
|
|
|
|
|
|
var_cpu="${var_cpu:-4}"
|
2025-05-08 21:41:59 +02:00
|
|
|
|
var_ram="${var_ram:-8192}"
|
2026-02-15 00:23:05 +01:00
|
|
|
|
var_disk="${var_disk:-50}"
|
2025-04-10 11:56:52 +02:00
|
|
|
|
var_os="${var_os:-debian}"
|
2025-11-05 14:20:33 +01:00
|
|
|
|
var_version="${var_version:-13}"
|
2026-06-22 04:45:41 +10:00
|
|
|
|
var_arm64="${var_arm64:-yes}"
|
2025-04-10 11:56:52 +02:00
|
|
|
|
var_unprivileged="${var_unprivileged:-1}"
|
2025-12-08 13:52:30 +01:00
|
|
|
|
var_gpu="${var_gpu:-yes}"
|
2024-12-16 12:42:51 +01:00
|
|
|
|
|
|
|
|
|
|
header_info "$APP"
|
2024-10-22 18:39:54 +02:00
|
|
|
|
variables
|
|
|
|
|
|
color
|
|
|
|
|
|
catch_errors
|
|
|
|
|
|
|
|
|
|
|
|
function update_script() {
|
2024-12-16 12:42:51 +01:00
|
|
|
|
header_info
|
|
|
|
|
|
check_container_storage
|
|
|
|
|
|
check_container_resources
|
2025-11-10 13:06:44 +01:00
|
|
|
|
|
2026-03-09 13:51:59 +01:00
|
|
|
|
ensure_dependencies zstd build-essential libmariadb-dev
|
2026-05-20 07:34:03 +02:00
|
|
|
|
[[ -f /root/.ollama ]] && rm -f /root/.ollama
|
2026-03-09 13:51:59 +01:00
|
|
|
|
|
2025-11-10 13:06:44 +01:00
|
|
|
|
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
|
2025-12-02 17:10:59 +01:00
|
|
|
|
cp -a /opt/open-webui/.env /opt/open-webui-backup/.env || true
|
2025-11-10 13:06:44 +01:00
|
|
|
|
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"
|
2026-02-13 11:26:19 +01:00
|
|
|
|
PYTHON_VERSION="3.12" setup_uv
|
2026-08-31 18:36:40 +02:00
|
|
|
|
for attempt in $(seq 1 3); do
|
|
|
|
|
|
$STD uv tool install --python 3.12 --constraint <(echo "numba>=0.60") open-webui[all] && break
|
|
|
|
|
|
[[ $attempt -lt 3 ]] && msg_warn "Open WebUI install attempt $attempt failed, retrying..." && sleep 10
|
|
|
|
|
|
done
|
2025-11-10 13:06:44 +01:00
|
|
|
|
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
|
2025-12-02 17:10:59 +01:00
|
|
|
|
cp -a /opt/open-webui-backup/.env /root/.env || true
|
2025-11-10 13:06:44 +01:00
|
|
|
|
rm -rf /opt/open-webui-backup || true
|
|
|
|
|
|
msg_ok "Restored data"
|
|
|
|
|
|
|
|
|
|
|
|
msg_info "Recreating Service"
|
|
|
|
|
|
cat <<EOF >/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
|
|
|
|
|
|
|
2025-11-05 14:20:33 +01:00
|
|
|
|
if [[ ! -d /root/.open-webui ]]; then
|
2024-12-16 12:42:51 +01:00
|
|
|
|
msg_error "No ${APP} Installation Found!"
|
|
|
|
|
|
exit
|
|
|
|
|
|
fi
|
2025-03-30 11:43:44 +02:00
|
|
|
|
|
2025-03-30 17:16:55 +02:00
|
|
|
|
if [ -x "/usr/bin/ollama" ]; then
|
2025-12-15 22:17:00 +01:00
|
|
|
|
msg_info "Checking for Ollama Update"
|
2026-05-20 07:34:03 +02:00
|
|
|
|
if check_for_gh_release "ollama-com" "ollama/ollama"; then
|
2026-05-16 00:45:51 +02:00
|
|
|
|
msg_info "Stopping Ollama Service"
|
|
|
|
|
|
systemctl stop ollama
|
|
|
|
|
|
msg_ok "Stopped Service"
|
|
|
|
|
|
|
|
|
|
|
|
rm -rf /usr/lib/ollama /usr/bin/ollama
|
2026-06-22 04:45:41 +10:00
|
|
|
|
if ! fetch_and_deploy_gh_release "ollama-com" "ollama/ollama" "prebuild" "latest" "/usr/lib/ollama" "ollama-linux-$(arch_resolve).tar.zst"; then
|
2026-05-16 00:45:51 +02:00
|
|
|
|
msg_error "Ollama download or deployment failed – check network connectivity and GitHub API availability"
|
2025-12-15 22:17:00 +01:00
|
|
|
|
else
|
2026-05-16 00:45:51 +02:00
|
|
|
|
ln -sf /usr/lib/ollama/bin/ollama /usr/bin/ollama
|
|
|
|
|
|
msg_ok "Updated Ollama to ${CHECK_UPDATE_RELEASE}"
|
2025-12-15 22:17:00 +01:00
|
|
|
|
fi
|
2026-05-16 00:45:51 +02:00
|
|
|
|
|
|
|
|
|
|
msg_info "Starting Ollama Service"
|
|
|
|
|
|
systemctl start ollama
|
|
|
|
|
|
msg_ok "Started Service"
|
2025-03-30 11:43:44 +02:00
|
|
|
|
fi
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
2025-11-10 13:06:44 +01:00
|
|
|
|
msg_info "Updating Open WebUI via uv"
|
|
|
|
|
|
PYTHON_VERSION="3.12" setup_uv
|
2026-08-11 12:38:34 -07:00
|
|
|
|
OWUI_PYTHON="/root/.local/share/uv/tools/open-webui/bin/python3.12"
|
|
|
|
|
|
OTEL_ARGS=()
|
|
|
|
|
|
if [[ -x "$OWUI_PYTHON" ]]; then
|
|
|
|
|
|
while IFS= read -r pkg; do
|
|
|
|
|
|
OTEL_ARGS+=(--with "$pkg")
|
|
|
|
|
|
done < <(uv pip list --python "$OWUI_PYTHON" --format freeze 2>/dev/null | grep -i '^opentelemetry-' | cut -d= -f1)
|
|
|
|
|
|
fi
|
2026-08-31 18:36:40 +02:00
|
|
|
|
for attempt in $(seq 1 3); do
|
|
|
|
|
|
$STD uv tool install --force --python 3.12 --constraint <(echo "numba>=0.60") "${OTEL_ARGS[@]}" open-webui[all] && break
|
|
|
|
|
|
[[ $attempt -lt 3 ]] && msg_warn "Open WebUI update attempt $attempt failed, retrying..." && sleep 10
|
|
|
|
|
|
done
|
2025-11-05 14:20:33 +01:00
|
|
|
|
systemctl restart open-webui
|
2025-11-10 13:06:44 +01:00
|
|
|
|
msg_ok "Updated Open WebUI"
|
2025-10-30 09:24:16 -07:00
|
|
|
|
msg_ok "Updated successfully!"
|
2024-10-22 18:39:54 +02:00
|
|
|
|
exit
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
start
|
|
|
|
|
|
build_container
|
|
|
|
|
|
description
|
|
|
|
|
|
|
2026-01-06 22:57:40 +01:00
|
|
|
|
msg_ok "Completed successfully!\n"
|
2024-12-16 12:42:51 +01:00
|
|
|
|
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
|
2026-06-03 11:03:13 +02:00
|
|
|
|
echo -e "${INFO}${YW}Access it using the following URL:${CL}"
|
|
|
|
|
|
echo -e "${GATEWAY}${BGN}http://${IP}:8080${CL}"
|