Skip to content

Commit 2e07fb6

Browse files
committed
Refactor: Open WebUI
1 parent a6ae347 commit 2e07fb6

File tree

3 files changed

+188
-0
lines changed

3 files changed

+188
-0
lines changed

ct/openwebui.sh

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
#!/usr/bin/env bash
2+
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
3+
# Copyright (c) 2021-2025 tteck
4+
# Author: tteck | Co-Author: havardthom | Co-Author: Slaviša Arežina (tremor021)
5+
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
6+
# Source: https://openwebui.com/
7+
8+
APP="Open WebUI"
9+
var_tags="${var_tags:-ai;interface}"
10+
var_cpu="${var_cpu:-4}"
11+
var_ram="${var_ram:-8192}"
12+
var_disk="${var_disk:-25}"
13+
var_os="${var_os:-debian}"
14+
var_version="${var_version:-13}"
15+
var_unprivileged="${var_unprivileged:-1}"
16+
17+
header_info "$APP"
18+
variables
19+
color
20+
catch_errors
21+
22+
function update_script() {
23+
header_info
24+
check_container_storage
25+
check_container_resources
26+
if [[ ! -d /root/.open-webui ]]; then
27+
msg_error "No ${APP} Installation Found!"
28+
exit
29+
fi
30+
31+
if [ -x "/usr/bin/ollama" ]; then
32+
msg_info "Updating Ollama"
33+
OLLAMA_VERSION=$(ollama -v | awk '{print $NF}')
34+
RELEASE=$(curl -s https://api.github.com/repos/ollama/ollama/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4)}')
35+
if [ "$OLLAMA_VERSION" != "$RELEASE" ]; then
36+
msg_info "Stopping Service"
37+
systemctl stop ollama
38+
msg_ok "Stopped Service"
39+
curl -fsSLO -C - https://ollama.com/download/ollama-linux-amd64.tgz
40+
rm -rf /usr/lib/ollama
41+
rm -rf /usr/bin/ollama
42+
tar -C /usr -xzf ollama-linux-amd64.tgz
43+
rm -rf ollama-linux-amd64.tgz
44+
msg_info "Starting Service"
45+
systemctl start ollama
46+
msg_info "Started Service"
47+
msg_ok "Ollama updated to version $RELEASE"
48+
else
49+
msg_ok "Ollama is already up to date."
50+
fi
51+
fi
52+
53+
msg_info "Restarting Open WebUI to initiate update"
54+
systemctl restart open-webui
55+
msg_ok "Updated successfully!"
56+
exit
57+
}
58+
59+
start
60+
build_container
61+
description
62+
63+
msg_ok "Completed Successfully!\n"
64+
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
65+
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
66+
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:8080${CL}"
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{
2+
"name": "Open WebUI",
3+
"slug": "openwebui",
4+
"categories": [
5+
20
6+
],
7+
"date_created": "2024-10-24",
8+
"type": "ct",
9+
"updateable": true,
10+
"privileged": false,
11+
"interface_port": 8080,
12+
"documentation": "https://docs.openwebui.com/",
13+
"website": "https://openwebui.com/",
14+
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/webp/open-webui.webp",
15+
"config_path": "/root/.env",
16+
"description": "OpenWebUI is a self-hosted, web-based interface that allows you to run AI models entirely offline. It integrates with various LLM runners, such as OpenAI and Ollama, and supports features like markdown and LaTeX rendering, model management, and voice/video calls. It also offers multilingual support and the ability to generate images using APIs like DALL-E or ComfyUI",
17+
"install_methods": [
18+
{
19+
"type": "default",
20+
"script": "ct/openwebui.sh",
21+
"resources": {
22+
"cpu": 4,
23+
"ram": 8192,
24+
"hdd": 25,
25+
"os": "debian",
26+
"version": "13"
27+
}
28+
}
29+
],
30+
"default_credentials": {
31+
"username": null,
32+
"password": null
33+
},
34+
"notes": [
35+
{
36+
"text": "Script contains optional installation of Ollama.",
37+
"type": "info"
38+
},
39+
{
40+
"text": "Initial run of the application/container can take some time, depending on your host speed, as the application is installed/updated at runtime. Please be patient!",
41+
"type": "warning"
42+
}
43+
]
44+
}

install/openwebui-install.sh

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright (c) 2021-2025 tteck
4+
# Author: tteck | Co-Author: havardthom | Co-Author: Slaviša Arežina (tremor021)
5+
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
6+
# Source: https://openwebui.com/
7+
8+
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
9+
color
10+
verb_ip6
11+
catch_errors
12+
setting_up_container
13+
network_check
14+
update_os
15+
16+
msg_info "Installing Dependencies"
17+
$STD apt install -y ffmpeg
18+
msg_ok "Installed Dependencies"
19+
20+
USE_UVX="YES" PYTHON_VERSION="3.12" setup_uv
21+
22+
read -r -p "${TAB3}Would you like to add Ollama? <y/N> " prompt
23+
if [[ ${prompt,,} =~ ^(y|yes)$ ]]; then
24+
msg_info "Installing Ollama"
25+
curl -fsSLO -C - https://ollama.com/download/ollama-linux-amd64.tgz
26+
tar -C /usr -xzf ollama-linux-amd64.tgz
27+
rm -rf ollama-linux-amd64.tgz
28+
cat <<EOF >/etc/systemd/system/ollama.service
29+
[Unit]
30+
Description=Ollama Service
31+
After=network-online.target
32+
33+
[Service]
34+
Type=exec
35+
ExecStart=/usr/bin/ollama serve
36+
Environment=HOME=$HOME
37+
Environment=OLLAMA_HOST=0.0.0.0
38+
Restart=always
39+
RestartSec=3
40+
41+
[Install]
42+
WantedBy=multi-user.target
43+
EOF
44+
systemctl enable -q --now ollama
45+
echo "ENABLE_OLLAMA_API=true" >/root/.env
46+
msg_ok "Installed Ollama"
47+
fi
48+
49+
msg_info "Creating Service"
50+
cat <<EOF >/etc/systemd/system/open-webui.service
51+
[Unit]
52+
Description=Open WebUI Service
53+
After=network.target
54+
55+
[Service]
56+
Type=simple
57+
EnvironmentFile=-/root/.env
58+
Environment=DATA_DIR=/root/.open-webui
59+
ExecStart=/usr/local/bin/uvx --python 3.12 open-webui@latest serve
60+
WorkingDirectory=/root
61+
Restart=on-failure
62+
RestartSec=5
63+
User=root
64+
65+
[Install]
66+
WantedBy=multi-user.target
67+
EOF
68+
systemctl enable -q --now open-webui
69+
msg_ok "Created Service"
70+
71+
motd_ssh
72+
customize
73+
74+
msg_info "Cleaning up"
75+
$STD apt -y autoremove
76+
$STD apt -y autoclean
77+
$STD apt -y clean
78+
msg_ok "Cleaned"

0 commit comments

Comments
 (0)