Replace the dead dankserver open-webui (bare container, :3000, pointed at a dead :9090 backend) with a boot-persistent quadlet on dankclaw: - CPU image (:main); dankclaw is CPU-only, so the :cuda image is wasted. - Isolated on slirp4netns; publishes 3005 (3000 is Gitea's HTTP port). - Default LLM backend is the local vLLM on 52625 (frank-default-large). - Data persists under /home/dank/Containers/open-webui/data. - Caddy route now proxies to the published LAN port (the container is not on Caddy's network). Also corrects the model/port mapping in the docs: the live state (verified 2026-08-19) is frank-default-large on vLLM :52625 (dankclaw) and frank-default-small on llama.cpp :7770 (dankserver) — the reverse of the 2026-08-17 note.
104 lines
3.6 KiB
Bash
Executable File
104 lines
3.6 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# deploy-open-webui-quadlet.sh — Install and (re)start open-webui on dankclaw.
|
|
#
|
|
# open-webui is boot-persistent via Quadlet (see AGENTS.md). This script:
|
|
# 1. Pushes main to origin
|
|
# 2. Pulls the repo on the target
|
|
# 3. Creates the data dir and copies the unit into ~/.config/containers/systemd/
|
|
# 4. daemon-reloads and starts open-webui (first run pulls the image)
|
|
#
|
|
# It is idempotent: it stops any running unit and removes any container with the
|
|
# name (a prior run or a bare-container leftover) before reinstalling and
|
|
# starting. The data dir is preserved across reruns, so existing chats survive.
|
|
#
|
|
# Usage:
|
|
# ./scripts/deploy-open-webui-quadlet.sh <target> [--dry-run]
|
|
# ./scripts/deploy-open-webui-quadlet.sh dankclaw
|
|
set -euo pipefail
|
|
|
|
REMOTE_USER="dank"
|
|
REMOTE_HOST="dankclaw"
|
|
REMOTE_DIR="/home/dank/serverAppConfigs"
|
|
QDIR="dankclaw/open-webui/quadlet"
|
|
UNIT="open-webui.service"
|
|
DATA_DIR="/home/dank/Containers/open-webui/data"
|
|
|
|
TARGET="${1:-}"
|
|
DRY_RUN=0
|
|
if [ "${2:-}" = "--dry-run" ]; then
|
|
DRY_RUN=1
|
|
fi
|
|
|
|
if [ -z "${TARGET:-}" ]; then
|
|
echo "Usage: $0 <target> [--dry-run]"
|
|
exit 1
|
|
fi
|
|
if [ "${TARGET}" != "dankclaw" ]; then
|
|
echo "This stack runs only on dankclaw (got: ${TARGET})"
|
|
exit 1
|
|
fi
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Local pre-flight
|
|
# ---------------------------------------------------------------------------
|
|
cd "$(dirname "$0")/.."
|
|
if ! git diff --quiet HEAD; then
|
|
echo "FAIL: Local working tree has uncommitted changes. Commit first."
|
|
exit 1
|
|
fi
|
|
|
|
if [ "$DRY_RUN" = "1" ]; then
|
|
echo "[dry-run] Would push main, pull on ${REMOTE_HOST}, install ${UNIT}, and start it (data at ${DATA_DIR})."
|
|
exit 0
|
|
fi
|
|
|
|
echo "=== Deploying open-webui quadlet to ${REMOTE_HOST} ==="
|
|
echo "[1/3] Pushing local main to origin..."
|
|
git push origin main
|
|
|
|
REMOTE="${REMOTE_USER}@${REMOTE_HOST}"
|
|
|
|
echo "[2/3] Installing and starting ${UNIT} on ${REMOTE_HOST}..."
|
|
ssh "$REMOTE" bash -s <<REMOTE_EOF
|
|
set -euo pipefail
|
|
cd '${REMOTE_DIR}'
|
|
|
|
echo ' Pulling repo...'
|
|
git pull origin main
|
|
|
|
echo ' Stopping any running unit (idempotent)...'
|
|
systemctl --user stop '${UNIT}' 2>/dev/null || true
|
|
|
|
echo ' Removing any container with the name (prior run or bare-container leftover)...'
|
|
podman rm -f open-webui 2>/dev/null || true
|
|
|
|
echo ' Creating the data dir (preserved across reruns)...'
|
|
mkdir -p '${DATA_DIR}'
|
|
|
|
echo ' Copying the quadlet unit into ~/.config/containers/systemd/ ...'
|
|
mkdir -p ~/.config/containers/systemd
|
|
cp ${QDIR}/open-webui.container ~/.config/containers/systemd/
|
|
|
|
echo ' daemon-reload (generates the unit)...'
|
|
# Quadlet units are generator-managed: systemctl enable fails on them. The
|
|
# [Install] WantedBy=default.target in the .container file is itself the
|
|
# enablement (is-enabled reports "generated"); with user linger on it starts at
|
|
# boot. So: daemon-reload, then start.
|
|
systemctl --user daemon-reload
|
|
|
|
echo ' Starting (first run pulls the image; this can take a while)...'
|
|
systemctl --user start '${UNIT}'
|
|
|
|
echo ' Unit state:'
|
|
systemctl --user --no-pager status '${UNIT}' 2>&1 | grep -E "●|Active:" || true
|
|
REMOTE_EOF
|
|
|
|
echo "[3/3] Verifying open-webui is up..."
|
|
ssh "$REMOTE" '
|
|
echo " is-enabled: $(systemctl --user is-enabled open-webui.service 2>&1) (boot-persistent)"
|
|
echo " port 3005:"; (ss -tlnp 2>/dev/null || netstat -tlnp 2>/dev/null) | grep -E ":3005\b" || echo " (not listening yet)"
|
|
echo " HTTP probe:"; curl -s -o /dev/null -w " http://127.0.0.1:3005 -> %{http_code}\n" -m 10 http://127.0.0.1:3005/ || echo " (no HTTP yet)"
|
|
' || true
|
|
|
|
echo "=== open-webui quadlet deployed to ${REMOTE_HOST} ==="
|