diff --git a/tasks/workstation/linux/software/ai/llm.yml b/tasks/workstation/linux/software/ai/llm.yml index 40edc45..028062d 100644 --- a/tasks/workstation/linux/software/ai/llm.yml +++ b/tasks/workstation/linux/software/ai/llm.yml @@ -419,21 +419,29 @@ # Ensure the old container is gone. echo "RUN: Stopping..." docker stop open-webui && - echo "RUN: Container stopped" || + echo "RUN: Container stopped." || echo "RUN: Container already stopped." echo "RUN: Deleting..." docker rm -f open-webui && - echo "RUN: Container deleted" || + echo "RUN: Container deleted." || echo "RUN: Container already deleted." - # Check for any new updates in background. - sleep 300 && - echo "RUN: Updating..." && - docker pull $image & + # Check for any new updates in the background. + ( + while true; do + sleep 600 + echo "RUN: Checking for updates..." + docker pull $image + done + ) & + LOOP_PID=$! + + # Ensure cleanup on any exit (normal or signal from runit). + trap 'kill "$LOOP_PID" 2>/dev/null; wait "$LOOP_PID" 2>/dev/null' EXIT # Start the open-webui program. set -e - exec docker run \ + docker run \ --name open-webui \ -e PORT={{ open_webui_port }} \ -p {{ open_webui_port }}:{{ open_webui_port }} \ @@ -657,7 +665,7 @@ - name: Workstation | Linux | Software | LLMs | runit | open-terminal | Script | Compose YAML ansible.builtin.copy: - dest: /usr/local/etc/open-terminal/docker-compose.yml + dest: /usr/local/etc/open-terminal/compose.yml content: | #exec docker run \ # --name open-terminal \ @@ -786,22 +794,32 @@ # Ensure the old container is stopped. echo "RUN: Stopping..." - docker compose -f /usr/local/etc/open-terminal/docker-compose.yml down && - echo "RUN: Container stopped" || + docker compose \ + -f /usr/local/etc/open-terminal/docker-compose.yml down && + echo "RUN: Container stopped." || echo "RUN: Container already stopped." - # Check for any new updates in background. - sleep 600 && - echo "RUN: Updating..." && - docker compose -f /usr/local/etc/open-terminal/docker-compose.yml \ - build --pull & + # Check for any new updates in the background. + ( + while true; do + sleep 600 + echo "RUN: Checking for updates..." + docker compose \ + -f /usr/local/etc/open-terminal/compose.yml \ + build --pull + done + ) & + LOOP_PID=$! + + # Ensure cleanup on any exit (normal or signal from runit). + trap 'kill "$LOOP_PID" 2>/dev/null; wait "$LOOP_PID" 2>/dev/null' EXIT export GOT_EM=true # Start the open-terminal program. # https://github.com/open-webui/open-terminal#configuration set -e - exec docker compose -f /usr/local/etc/open-terminal/docker-compose.yml up + docker compose -f /usr/local/etc/open-terminal/docker-compose.yml up owner: root mode: "0755"