test
This commit is contained in:
parent
21bd9618c0
commit
2da7eaa41a
71
ct/openwebui.sh
Normal file
71
ct/openwebui.sh
Normal file
@ -0,0 +1,71 @@
|
||||
#!/usr/bin/env bash
|
||||
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/build.func)
|
||||
# Copyright (c) 2021-2025 tteck
|
||||
# Author: havardthom
|
||||
# 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:-25}"
|
||||
var_os="${var_os:-debian}"
|
||||
var_version="${var_version:-12}"
|
||||
var_unprivileged="${var_unprivileged:-1}"
|
||||
|
||||
header_info "$APP"
|
||||
variables
|
||||
color
|
||||
catch_errors
|
||||
|
||||
function update_script() {
|
||||
header_info
|
||||
check_container_storage
|
||||
check_container_resources
|
||||
if [[ ! -d /opt/open-webui ]]; then
|
||||
msg_error "No ${APP} Installation Found!"
|
||||
exit
|
||||
fi
|
||||
|
||||
if [ -x "/usr/bin/ollama" ]; then
|
||||
msg_info "Updating Ollama"
|
||||
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
|
||||
curl -fsSLO https://ollama.com/download/ollama-linux-amd64.tgz
|
||||
tar -C /usr -xzf ollama-linux-amd64.tgz
|
||||
rm -rf ollama-linux-amd64.tgz
|
||||
msg_ok "Ollama updated to version $RELEASE"
|
||||
else
|
||||
msg_ok "Ollama is already up to date."
|
||||
fi
|
||||
fi
|
||||
|
||||
msg_info "Updating ${APP} (Patience)"
|
||||
systemctl stop open-webui.service
|
||||
mkdir -p /opt/open-webui-backup
|
||||
cp -rf /opt/open-webui/backend/data /opt/open-webui-backup
|
||||
cp /opt/open-webui/.env /opt
|
||||
rm -rf /opt/open-webui
|
||||
fetch_and_deploy_gh_release "open-webui/open-webui"
|
||||
cd /opt/open-webui
|
||||
$STD npm install
|
||||
export NODE_OPTIONS="--max-old-space-size=3584"
|
||||
$STD npm run build
|
||||
cd ./backend
|
||||
$STD pip install -r requirements.txt -U
|
||||
cp -rf /opt/open-webui-backup/* /opt/open-webui/backend
|
||||
systemctl start open-webui.service
|
||||
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}"
|
99
install/openwebui-install.sh
Normal file
99
install/openwebui-install.sh
Normal file
@ -0,0 +1,99 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright (c) 2021-2025 tteck
|
||||
# Author: tteck
|
||||
# Co-Author: havardthom
|
||||
# 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-get install -y \
|
||||
git \
|
||||
ffmpeg
|
||||
msg_ok "Installed Dependencies"
|
||||
|
||||
msg_info "Setup Python3"
|
||||
$STD apt-get install -y --no-install-recommends \
|
||||
python3 \
|
||||
python3-pip
|
||||
msg_ok "Setup Python3"
|
||||
|
||||
install_node_and_modules
|
||||
|
||||
msg_info "Installing Open WebUI (Patience)"
|
||||
fetch_and_deploy_gh_release "open-webui/open-webui"
|
||||
cd /opt/open-webui/backend
|
||||
$STD pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
|
||||
$STD pip3 install -r requirements.txt -U
|
||||
cd /opt/open-webui
|
||||
cp .env.example .env
|
||||
cat <<EOF >/opt/open-webui/.env
|
||||
ENV=prod
|
||||
ENABLE_OLLAMA_API=false
|
||||
OLLAMA_BASE_URL=http://0.0.0.0:11434
|
||||
EOF
|
||||
$STD npm install
|
||||
export NODE_OPTIONS="--max-old-space-size=3584"
|
||||
$STD npm run build
|
||||
msg_ok "Installed Open WebUI"
|
||||
|
||||
read -r -p "${TAB3}Would you like to add Ollama? <y/N> " prompt
|
||||
if [[ ${prompt,,} =~ ^(y|yes)$ ]]; then
|
||||
msg_info "Installing Ollama"
|
||||
curl -fsSLO https://ollama.com/download/ollama-linux-amd64.tgz
|
||||
tar -C /usr -xzf ollama-linux-amd64.tgz
|
||||
rm -rf ollama-linux-amd64.tgz
|
||||
cat <<EOF >/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
|
||||
sed -i 's/ENABLE_OLLAMA_API=false/ENABLE_OLLAMA_API=true/g' /opt/open-webui/.env
|
||||
msg_ok "Installed Ollama"
|
||||
fi
|
||||
|
||||
msg_info "Creating Service"
|
||||
cat <<EOF >/etc/systemd/system/open-webui.service
|
||||
[Unit]
|
||||
Description=Open WebUI Service
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=exec
|
||||
WorkingDirectory=/opt/open-webui
|
||||
EnvironmentFile=/opt/open-webui/.env
|
||||
ExecStart=/opt/open-webui/backend/start.sh
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
systemctl enable -q --now open-webui
|
||||
msg_ok "Created Service"
|
||||
|
||||
motd_ssh
|
||||
customize
|
||||
|
||||
msg_info "Cleaning up"
|
||||
$STD apt-get -y autoremove
|
||||
$STD apt-get -y autoclean
|
||||
msg_ok "Cleaned"
|
Loading…
x
Reference in New Issue
Block a user