Initial production-ready Gemma 3 vLLM ROCm stack

Co-Authored-By: Oz <oz-agent@warp.dev>
This commit is contained in:
Raghav
2026-04-18 22:53:38 +05:30
commit ef8537e923
18 changed files with 988 additions and 0 deletions

98
scripts/uninstall.sh Executable file
View File

@ -0,0 +1,98 @@
#!/usr/bin/env bash
# Stops and removes the Gemma 3 vLLM stack. Optional --purge removes local model/cache data.
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)"
PURGE=0
log() {
printf '[uninstall] %s
' "$*"
}
err() {
printf '[uninstall][error] %s
' "$*" >&2
}
usage() {
cat <<'EOF'
Usage: scripts/uninstall.sh [--purge]
Options:
--purge Remove local Hugging Face cache directory and ./models data in addition to containers/volumes.
-h, --help Show this help message.
EOF
}
while [[ $# -gt 0 ]]; do
case "$1" in
--purge)
PURGE=1
;;
-h|--help)
usage
exit 0
;;
*)
err "Unknown argument: $1"
usage
exit 1
;;
esac
shift
done
if [[ ! -f "${REPO_ROOT}/docker-compose.yml" ]]; then
err "docker-compose.yml not found at ${REPO_ROOT}."
exit 1
fi
ENV_FILE="${REPO_ROOT}/.env"
if [[ ! -f "${ENV_FILE}" ]]; then
ENV_FILE="${REPO_ROOT}/.env.example"
fi
log "Stopping stack and removing containers, networks, and named/anonymous volumes."
docker compose -f "${REPO_ROOT}/docker-compose.yml" --env-file "${ENV_FILE}" down -v || true
if [[ ${PURGE} -eq 1 ]]; then
log "Purge requested. Removing local data directories used by this stack."
huggingface_cache_dir="$(grep -E '^HUGGINGFACE_CACHE_DIR=' "${ENV_FILE}" | tail -n1 | cut -d'=' -f2- || true)"
open_webui_data_dir="$(grep -E '^OPEN_WEBUI_DATA_DIR=' "${ENV_FILE}" | tail -n1 | cut -d'=' -f2- || true)"
if [[ -n "${huggingface_cache_dir}" ]]; then
# Expand potential variables such as ${USER}
evaluated_hf_dir="$(eval "printf '%s' "${huggingface_cache_dir}"")"
if [[ -d "${evaluated_hf_dir}" ]]; then
log "Removing Hugging Face cache directory: ${evaluated_hf_dir}"
rm -rf "${evaluated_hf_dir}"
else
log "Hugging Face cache directory not found: ${evaluated_hf_dir}"
fi
fi
if [[ -z "${open_webui_data_dir}" ]]; then
open_webui_data_dir="./frontend/data/open-webui"
fi
if [[ "${open_webui_data_dir}" == ./* ]]; then
open_webui_data_dir="${REPO_ROOT}/${open_webui_data_dir#./}"
fi
if [[ -d "${open_webui_data_dir}" ]]; then
log "Removing Open WebUI data directory: ${open_webui_data_dir}"
rm -rf "${open_webui_data_dir}"
fi
if [[ -d "${REPO_ROOT}/models" ]]; then
log "Removing local models directory: ${REPO_ROOT}/models"
rm -rf "${REPO_ROOT}/models"
fi
else
log "Safe mode enabled (default). Local model/cache data was preserved."
fi
log "Uninstall complete."