From 0d6c64d7fd32d2cbe9f8d03e1121bf5f1bc5104e Mon Sep 17 00:00:00 2001 From: j Date: Sun, 15 Mar 2026 13:15:46 +1300 Subject: [PATCH] Add open-webui dropshell template for AI chat interface --- open-webui/backup.sh | 12 ++++++++++++ open-webui/config/service.env | 12 ++++++++++++ open-webui/destroy.sh | 11 +++++++++++ open-webui/install-pre.sh | 7 +++++++ open-webui/install.sh | 14 ++++++++++++++ open-webui/logs.sh | 5 +++++ open-webui/restore.sh | 13 +++++++++++++ open-webui/start.sh | 12 ++++++++++++ open-webui/status.sh | 25 +++++++++++++++++++++++++ open-webui/stop.sh | 5 +++++ open-webui/template_info.env | 12 ++++++++++++ open-webui/uninstall.sh | 10 ++++++++++ 12 files changed, 138 insertions(+) create mode 100755 open-webui/backup.sh create mode 100644 open-webui/config/service.env create mode 100755 open-webui/destroy.sh create mode 100755 open-webui/install-pre.sh create mode 100755 open-webui/install.sh create mode 100755 open-webui/logs.sh create mode 100755 open-webui/restore.sh create mode 100755 open-webui/start.sh create mode 100755 open-webui/status.sh create mode 100755 open-webui/stop.sh create mode 100644 open-webui/template_info.env create mode 100755 open-webui/uninstall.sh diff --git a/open-webui/backup.sh b/open-webui/backup.sh new file mode 100755 index 0000000..c321fc9 --- /dev/null +++ b/open-webui/backup.sh @@ -0,0 +1,12 @@ +#!/bin/bash +source "${AGENT_PATH}/common.sh" +_check_required_env_vars "CONTAINER_NAME" "DATA_VOLUME" "BACKUP_FILE" "TEMP_DIR" + +mkdir -p "${TEMP_DIR}/backup" + +docker run --rm -v "${DATA_VOLUME}":/source -v "${TEMP_DIR}/backup":/backup \ + debian tar -czf /backup/data.tgz -C /source . + +tar -czf "${BACKUP_FILE}" -C "${TEMP_DIR}/backup" . + +echo "Backup completed successfully" diff --git a/open-webui/config/service.env b/open-webui/config/service.env new file mode 100644 index 0000000..9cfa409 --- /dev/null +++ b/open-webui/config/service.env @@ -0,0 +1,12 @@ +CONTAINER_NAME=open-webui +SSH_USER="root" +IMAGE_TAG="main" + +# Port to expose on the host +HOST_PORT=3000 + +# Ollama connection URL (e.g. http://ollama-host:11434) +OLLAMA_BASE_URL="http://localhost:11434" + +# Set to False to disable authentication (single-user mode) +# WEBUI_AUTH=False diff --git a/open-webui/destroy.sh b/open-webui/destroy.sh new file mode 100755 index 0000000..b4befb1 --- /dev/null +++ b/open-webui/destroy.sh @@ -0,0 +1,11 @@ +#!/bin/bash +source "${AGENT_PATH}/common.sh" +_check_required_env_vars "CONTAINER_NAME" "DATA_VOLUME" + +echo "WARNING: This will PERMANENTLY DELETE all data for ${CONTAINER_NAME}" + +bash ./stop.sh +_remove_container "$CONTAINER_NAME" +_remove_volume "$DATA_VOLUME" + +echo "Service and all data destroyed" diff --git a/open-webui/install-pre.sh b/open-webui/install-pre.sh new file mode 100755 index 0000000..4862bd2 --- /dev/null +++ b/open-webui/install-pre.sh @@ -0,0 +1,7 @@ +#!/bin/bash +source "${AGENT_PATH}/common.sh" +_check_required_env_vars "IMAGE_REGISTRY" "IMAGE_REPO" "IMAGE_TAG" + +docker pull -q "$IMAGE_REGISTRY/$IMAGE_REPO:$IMAGE_TAG" || echo "Warning: pre-pull failed, install.sh will retry" + +echo "Pre-install complete" diff --git a/open-webui/install.sh b/open-webui/install.sh new file mode 100755 index 0000000..3f58d6b --- /dev/null +++ b/open-webui/install.sh @@ -0,0 +1,14 @@ +#!/bin/bash +source "${AGENT_PATH}/common.sh" + +_check_required_env_vars "CONTAINER_NAME" "IMAGE_REGISTRY" "IMAGE_REPO" "IMAGE_TAG" "DATA_VOLUME" +_check_docker_installed || _die "Docker test failed" + +docker pull "$IMAGE_REGISTRY/$IMAGE_REPO:$IMAGE_TAG" || _die "Failed to pull image" +docker volume create "$DATA_VOLUME" 2>/dev/null || true + +bash ./stop.sh || _die "Failed to stop container" +_remove_container "$CONTAINER_NAME" || _die "Failed to remove container" +bash ./start.sh || _die "Failed to start container" + +echo "Installation of ${CONTAINER_NAME} complete" diff --git a/open-webui/logs.sh b/open-webui/logs.sh new file mode 100755 index 0000000..cd2b3bc --- /dev/null +++ b/open-webui/logs.sh @@ -0,0 +1,5 @@ +#!/bin/bash +source "${AGENT_PATH}/common.sh" +_check_required_env_vars "CONTAINER_NAME" + +docker logs "$CONTAINER_NAME" "$@" diff --git a/open-webui/restore.sh b/open-webui/restore.sh new file mode 100755 index 0000000..860b4a2 --- /dev/null +++ b/open-webui/restore.sh @@ -0,0 +1,13 @@ +#!/bin/bash +source "${AGENT_PATH}/common.sh" +_check_required_env_vars "CONTAINER_NAME" "DATA_VOLUME" "BACKUP_FILE" "TEMP_DIR" + +mkdir -p "${TEMP_DIR}/restore" +tar -xzf "${BACKUP_FILE}" -C "${TEMP_DIR}/restore" + +docker volume rm "${DATA_VOLUME}" 2>/dev/null || true +docker volume create "${DATA_VOLUME}" +docker run --rm -v "${DATA_VOLUME}":/target -v "${TEMP_DIR}/restore":/backup \ + debian tar -xzf /backup/data.tgz -C /target + +echo "Restore completed successfully" diff --git a/open-webui/start.sh b/open-webui/start.sh new file mode 100755 index 0000000..522d814 --- /dev/null +++ b/open-webui/start.sh @@ -0,0 +1,12 @@ +#!/bin/bash +source "${AGENT_PATH}/common.sh" +_check_required_env_vars "CONTAINER_NAME" "IMAGE_REGISTRY" "IMAGE_REPO" "IMAGE_TAG" "DATA_VOLUME" "HOST_PORT" "OLLAMA_BASE_URL" + +docker run -d \ + --name "$CONTAINER_NAME" \ + --restart unless-stopped \ + -p "${HOST_PORT}:8080" \ + -e "OLLAMA_BASE_URL=${OLLAMA_BASE_URL}" \ + ${WEBUI_AUTH:+-e "WEBUI_AUTH=${WEBUI_AUTH}"} \ + -v "${DATA_VOLUME}:/app/backend/data" \ + "$IMAGE_REGISTRY/$IMAGE_REPO:$IMAGE_TAG" diff --git a/open-webui/status.sh b/open-webui/status.sh new file mode 100755 index 0000000..6510fb4 --- /dev/null +++ b/open-webui/status.sh @@ -0,0 +1,25 @@ +#!/bin/bash +source "${AGENT_PATH}/common.sh" +_check_required_env_vars "CONTAINER_NAME" + +if ! docker ps -a --format "{{.Names}}" | grep -q "^${CONTAINER_NAME}$"; then + echo "Unknown" + exit 0 +fi + +STATE=$(docker inspect -f '{{.State.Status}}' "$CONTAINER_NAME" 2>/dev/null) +case "$STATE" in + running) + if docker inspect -f '{{.State.Health.Status}}' "$CONTAINER_NAME" 2>/dev/null | grep -q "unhealthy"; then + echo "Error" + else + echo "Running" + fi + ;; + exited|stopped) + echo "Stopped" + ;; + *) + echo "Unknown" + ;; +esac diff --git a/open-webui/stop.sh b/open-webui/stop.sh new file mode 100755 index 0000000..4dcf0fe --- /dev/null +++ b/open-webui/stop.sh @@ -0,0 +1,5 @@ +#!/bin/bash +source "${AGENT_PATH}/common.sh" +_check_required_env_vars "CONTAINER_NAME" + +docker stop "$CONTAINER_NAME" 2>/dev/null || true diff --git a/open-webui/template_info.env b/open-webui/template_info.env new file mode 100644 index 0000000..3d0130e --- /dev/null +++ b/open-webui/template_info.env @@ -0,0 +1,12 @@ +# Requirements +REQUIRES_HOST_ROOT=false +REQUIRES_DOCKER=true +REQUIRES_DOCKER_ROOT=false + +# Docker image settings +IMAGE_REGISTRY="ghcr.io" +IMAGE_REPO="open-webui/open-webui" +IMAGE_TAG="main" + +# Volume definitions +DATA_VOLUME="${CONTAINER_NAME}_data" diff --git a/open-webui/uninstall.sh b/open-webui/uninstall.sh new file mode 100755 index 0000000..d3e3d7b --- /dev/null +++ b/open-webui/uninstall.sh @@ -0,0 +1,10 @@ +#!/bin/bash +source "${AGENT_PATH}/common.sh" +_check_required_env_vars "CONTAINER_NAME" + +bash ./stop.sh || _die "Failed to stop container" +_remove_container "$CONTAINER_NAME" || _die "Failed to remove container" + +# DO NOT remove volumes here! Data is preserved for reinstallation. +echo "Uninstallation of ${CONTAINER_NAME} complete" +echo "Note: Data volumes have been preserved. To remove all data, use destroy.sh"