forked from open-webui/open-webui
added drop to kill and build capabilities
This commit is contained in:
parent
16a2d0cdb0
commit
567b88bb00
1 changed files with 40 additions and 34 deletions
|
@ -75,6 +75,7 @@ usage() {
|
||||||
echo " --webui[port=PORT] Set the port for the web user interface."
|
echo " --webui[port=PORT] Set the port for the web user interface."
|
||||||
echo " --data[folder=PATH] Bind mount for ollama data folder (by default will create the 'ollama' volume)."
|
echo " --data[folder=PATH] Bind mount for ollama data folder (by default will create the 'ollama' volume)."
|
||||||
echo " --build Build the docker image before running the compose project."
|
echo " --build Build the docker image before running the compose project."
|
||||||
|
echo " --drop Drop the compose project."
|
||||||
echo " -q, --quiet Run script in headless mode."
|
echo " -q, --quiet Run script in headless mode."
|
||||||
echo " -h, --help Show this help message."
|
echo " -h, --help Show this help message."
|
||||||
echo ""
|
echo ""
|
||||||
|
@ -95,6 +96,7 @@ api_port=11435
|
||||||
webui_port=3000
|
webui_port=3000
|
||||||
headless=false
|
headless=false
|
||||||
build_image=false
|
build_image=false
|
||||||
|
kill_compose=false
|
||||||
|
|
||||||
# Function to extract value from the parameter
|
# Function to extract value from the parameter
|
||||||
extract_value() {
|
extract_value() {
|
||||||
|
@ -124,6 +126,9 @@ while [[ $# -gt 0 ]]; do
|
||||||
value=$(extract_value "$key")
|
value=$(extract_value "$key")
|
||||||
data_dir=${value:-"./ollama-data"}
|
data_dir=${value:-"./ollama-data"}
|
||||||
;;
|
;;
|
||||||
|
--drop)
|
||||||
|
kill_compose=true
|
||||||
|
;;
|
||||||
--build)
|
--build)
|
||||||
build_image=true
|
build_image=true
|
||||||
;;
|
;;
|
||||||
|
@ -144,6 +149,11 @@ while [[ $# -gt 0 ]]; do
|
||||||
shift # past argument or value
|
shift # past argument or value
|
||||||
done
|
done
|
||||||
|
|
||||||
|
if [[ $kill_compose == true ]]; then
|
||||||
|
docker compose down --remove-orphans
|
||||||
|
echo -e "${GREEN}${BOLD}Compose project dropped successfully.${NC}"
|
||||||
|
exit
|
||||||
|
else
|
||||||
DEFAULT_COMPOSE_COMMAND="docker compose -f docker-compose.yaml"
|
DEFAULT_COMPOSE_COMMAND="docker compose -f docker-compose.yaml"
|
||||||
if [[ $enable_gpu == true ]]; then
|
if [[ $enable_gpu == true ]]; then
|
||||||
# Validate and process command-line arguments
|
# Validate and process command-line arguments
|
||||||
|
@ -172,10 +182,10 @@ fi
|
||||||
DEFAULT_COMPOSE_COMMAND+=" up -d"
|
DEFAULT_COMPOSE_COMMAND+=" up -d"
|
||||||
DEFAULT_COMPOSE_COMMAND+=" --remove-orphans"
|
DEFAULT_COMPOSE_COMMAND+=" --remove-orphans"
|
||||||
DEFAULT_COMPOSE_COMMAND+=" --force-recreate"
|
DEFAULT_COMPOSE_COMMAND+=" --force-recreate"
|
||||||
if [[ -n $build_image ]]; then
|
if [[ $build_image == true ]]; then
|
||||||
DEFAULT_COMPOSE_COMMAND+=" --build"
|
DEFAULT_COMPOSE_COMMAND+=" --build"
|
||||||
fi
|
fi
|
||||||
DEFAULT_COMPOSE_COMMAND+=" > /dev/null 2>&1"
|
fi
|
||||||
|
|
||||||
# Recap of environment variables
|
# Recap of environment variables
|
||||||
echo
|
echo
|
||||||
|
@ -195,12 +205,8 @@ else
|
||||||
echo -ne "${WHITE}${BOLD}Do you want to proceed with current setup? (Y/n): ${NC}"
|
echo -ne "${WHITE}${BOLD}Do you want to proceed with current setup? (Y/n): ${NC}"
|
||||||
read -n1 -s choice
|
read -n1 -s choice
|
||||||
fi
|
fi
|
||||||
echo -e " ${GREEN}${BOLD}WebUI Port:${NC} $webui_port"
|
|
||||||
echo
|
|
||||||
|
|
||||||
# Ask for user acceptance
|
echo
|
||||||
echo -ne "${WHITE}${BOLD}Do you want to proceed with current setup? (Y/n): ${NC}"
|
|
||||||
read -n1 -s choice
|
|
||||||
|
|
||||||
if [[ $choice == "" || $choice == "y" ]]; then
|
if [[ $choice == "" || $choice == "y" ]]; then
|
||||||
# Execute the command with the current user
|
# Execute the command with the current user
|
||||||
|
@ -210,7 +216,7 @@ if [[ $choice == "" || $choice == "y" ]]; then
|
||||||
PID=$!
|
PID=$!
|
||||||
|
|
||||||
# Display the loading animation
|
# Display the loading animation
|
||||||
show_loading $PID
|
#show_loading $PID
|
||||||
|
|
||||||
# Wait for the command to finish
|
# Wait for the command to finish
|
||||||
wait $PID
|
wait $PID
|
||||||
|
|
Loading…
Reference in a new issue