From 5adff7767f1dcbc6dca77dff32e9f0deeb248705 Mon Sep 17 00:00:00 2001 From: Patrice-Gaudicheau Date: Thu, 22 Feb 2024 22:00:59 +0100 Subject: [PATCH 1/5] Adding Makefile and LLM update script --- Makefile | 22 ++++++++++++++++++++++ update_llm.sh | 10 ++++++++++ 2 files changed, 32 insertions(+) create mode 100644 Makefile create mode 100644 update_llm.sh diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..f8df0ef4 --- /dev/null +++ b/Makefile @@ -0,0 +1,22 @@ +install: + @docker-compose up -d + +remove: + @docker-compose down -v + +start: + @docker-compose start + +stop: + @docker-compose stop + +update: + # Appelle le script de mise à jour des LLM + @./update_llm.sh + @git pull + @docker-compose down + # Assure-toi que le conteneur ollama-webui est arrêté avant de reconstruire + @docker stop ollama-webui || true + @docker-compose up --build -d + @docker-compose start + diff --git a/update_llm.sh b/update_llm.sh new file mode 100644 index 00000000..4bc423f0 --- /dev/null +++ b/update_llm.sh @@ -0,0 +1,10 @@ +#!/bin/bash +# update_llm.sh + +# Récupère la liste des LLM installées dans le container Docker +llm_list=$(docker exec ollama ollama list | tail -n +2 | awk '{print $1}') + +# Boucle sur chaque LLM pour la mettre à jour +for llm in $llm_list; do + docker exec ollama ollama pull $llm +done From 6bc627bbfba1bf9232286e53993a857aa5cc005b Mon Sep 17 00:00:00 2001 From: Patrice Gaudicheau <61966507+Patrice-Gaudicheau@users.noreply.github.com> Date: Fri, 23 Feb 2024 15:52:55 +0100 Subject: [PATCH 2/5] Updated code comments to English. --- update_llm.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/update_llm.sh b/update_llm.sh index 4bc423f0..bde11b4b 100644 --- a/update_llm.sh +++ b/update_llm.sh @@ -1,10 +1,10 @@ #!/bin/bash # update_llm.sh -# Récupère la liste des LLM installées dans le container Docker +# Retrieves the list of LLMs installed in the Docker container llm_list=$(docker exec ollama ollama list | tail -n +2 | awk '{print $1}') -# Boucle sur chaque LLM pour la mettre à jour +# Loop over each LLM to update it for llm in $llm_list; do docker exec ollama ollama pull $llm done From 7d0d504390c55f09aa31dc6ba555dc8497aab0bb Mon Sep 17 00:00:00 2001 From: Patrice Gaudicheau <61966507+Patrice-Gaudicheau@users.noreply.github.com> Date: Fri, 23 Feb 2024 15:53:47 +0100 Subject: [PATCH 3/5] Updated code comments to English. --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index f8df0ef4..49736e60 100644 --- a/Makefile +++ b/Makefile @@ -11,11 +11,11 @@ stop: @docker-compose stop update: - # Appelle le script de mise à jour des LLM + # Calls the LLM update script @./update_llm.sh @git pull @docker-compose down - # Assure-toi que le conteneur ollama-webui est arrêté avant de reconstruire + # Make sure the ollama-webui container is stopped before rebuilding @docker stop ollama-webui || true @docker-compose up --build -d @docker-compose start From a016171573f9da5d09c1030776d4a9050e55569b Mon Sep 17 00:00:00 2001 From: Patrice-Gaudicheau Date: Sat, 24 Feb 2024 07:51:27 +0100 Subject: [PATCH 4/5] fix: update Makefile and rename script for open-webui integration --- Makefile | 5 +++-- update_llm.sh => update_ollama_models.sh | 0 2 files changed, 3 insertions(+), 2 deletions(-) rename update_llm.sh => update_ollama_models.sh (100%) diff --git a/Makefile b/Makefile index 49736e60..265a608a 100644 --- a/Makefile +++ b/Makefile @@ -12,11 +12,12 @@ stop: update: # Calls the LLM update script - @./update_llm.sh + chmod +x update_ollama_models.sh + @./update_ollama_models.sh @git pull @docker-compose down # Make sure the ollama-webui container is stopped before rebuilding - @docker stop ollama-webui || true + @docker stop open-webui || true @docker-compose up --build -d @docker-compose start diff --git a/update_llm.sh b/update_ollama_models.sh similarity index 100% rename from update_llm.sh rename to update_ollama_models.sh From 0f6bdaa60238e15832bcbe0414b5d62d3fe55669 Mon Sep 17 00:00:00 2001 From: Patrice-Gaudicheau Date: Sat, 24 Feb 2024 09:02:18 +0100 Subject: [PATCH 5/5] feat: implemented user confirmation for safe removal of containers and volumes in Makefile --- Makefile | 4 +++- confirm_remove.sh | 8 ++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100755 confirm_remove.sh diff --git a/Makefile b/Makefile index 265a608a..cbcc41d9 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,9 @@ install: @docker-compose up -d remove: - @docker-compose down -v + @chmod +x confirm_remove.sh + @./confirm_remove.sh + start: @docker-compose start diff --git a/confirm_remove.sh b/confirm_remove.sh new file mode 100755 index 00000000..729c2507 --- /dev/null +++ b/confirm_remove.sh @@ -0,0 +1,8 @@ +#!/bin/bash +echo "Warning: This will remove all containers and volumes, including persistent data. Do you want to continue? [Y/N]" +read ans +if [ "$ans" == "Y" ] || [ "$ans" == "y" ]; then + docker-compose down -v +else + echo "Operation cancelled." +fi