From 4a56c00e835014877cb020bc7987eb4c80893d91 Mon Sep 17 00:00:00 2001 From: Scott Davidson Date: Fri, 24 Oct 2025 14:02:51 +0100 Subject: [PATCH 1/9] Limit model context length to 100 tokens in CI --- charts/azimuth-llm/ci/default-values.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/charts/azimuth-llm/ci/default-values.yaml b/charts/azimuth-llm/ci/default-values.yaml index 40dbbde3..64f51ba2 100644 --- a/charts/azimuth-llm/ci/default-values.yaml +++ b/charts/azimuth-llm/ci/default-values.yaml @@ -10,6 +10,8 @@ api: enabled: false # No GPUs in CI runners gpus: 0 + # Limit context length for efficiency + modelMaxContextLength: 100 ui: service: zenith: From 0d523940ec4e15a434c3263e1b86454fed6de1ea Mon Sep 17 00:00:00 2001 From: Scott Davidson Date: Fri, 24 Oct 2025 14:15:52 +0100 Subject: [PATCH 2/9] Give test containers more time to start We're seeing intermittent transient failures in CI (e.g. [1]), hopefully this will help. [1] https://github.com/stackhpc/azimuth-llm/actions/runs/18780593105/job/53586017528 --- web-apps/test-images.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web-apps/test-images.sh b/web-apps/test-images.sh index d2a9706d..60d8af62 100755 --- a/web-apps/test-images.sh +++ b/web-apps/test-images.sh @@ -69,7 +69,7 @@ test() { docker run --network $DOCKER_NET_NAME -d --name $1-app $IMAGE # Give the app time to start - sleep 3 + sleep 10 log "Running tests" docker run --network $DOCKER_NET_NAME --rm \ From 8e35fde4b32dda4dadc7e1fade4e66ad3e68510d Mon Sep 17 00:00:00 2001 From: Scott Davidson Date: Fri, 24 Oct 2025 14:50:53 +0100 Subject: [PATCH 3/9] Switch to non-containerised ollama in CI tests --- .github/workflows/test-pr.yml | 1 + web-apps/chat/defaults.yml | 3 +-- web-apps/test-images.sh | 40 ++++++++++++++++++++++------------- 3 files changed, 27 insertions(+), 17 deletions(-) diff --git a/.github/workflows/test-pr.yml b/.github/workflows/test-pr.yml index 5c833269..b42f5998 100644 --- a/.github/workflows/test-pr.yml +++ b/.github/workflows/test-pr.yml @@ -69,6 +69,7 @@ jobs: - name: Run Gradio app tests run: | + curl -fsSL https://ollama.com/install.sh | sh ./test-images.sh $(git rev-parse --short ${{ github.sha }}) working-directory: web-apps diff --git a/web-apps/chat/defaults.yml b/web-apps/chat/defaults.yml index 8a189767..8b9ebdff 100644 --- a/web-apps/chat/defaults.yml +++ b/web-apps/chat/defaults.yml @@ -1,8 +1,7 @@ # Default target is a local ollama instance -# running inside the same docker network model_name: smollm2:135m -backend_url: http://ollama:11434 +backend_url: http://localhost:11434 host_address: 0.0.0.0 diff --git a/web-apps/test-images.sh b/web-apps/test-images.sh index 60d8af62..f9815c93 100755 --- a/web-apps/test-images.sh +++ b/web-apps/test-images.sh @@ -41,10 +41,12 @@ test() { if [[ -f $1/test.py ]]; then - DOCKER_NET_NAME=azimuth-llm-shared - if [[ ! $(docker network ls | grep $DOCKER_NET_NAME) ]]; then - docker network create $DOCKER_NET_NAME - fi + DOCKER_NET_NAME=host + + # DOCKER_NET_NAME=azimuth-llm-shared + # if [[ ! $(docker network ls | grep $DOCKER_NET_NAME) ]]; then + # docker network create $DOCKER_NET_NAME + # fi # Ensure app image is available IMAGE=$(image_name $1):$IMAGE_TAG @@ -56,13 +58,15 @@ test() { fi # Ensure Ollama instance is available - if [[ $(curl -s localhost:11434) == "Ollama is running" ]]; then - log "Using existing ollama process running on localhost:11434" - else - log "Ollama process not running - starting containerised server" - docker run --rm --network $DOCKER_NET_NAME -d -v ollama:/root/.ollama -p 11434:11434 --name ollama ollama/ollama - sleep 3 - docker exec ollama ollama pull smollm2:135m + if [[ $(curl -s localhost:11434) != "Ollama is running" ]]; then + log "Ollama not running on localhost:11434 - aborting test" + exit 1 + # log "Using existing ollama process running on localhost:11434" + # else + # log "Ollama process not running - starting containerised server" + # docker run --rm --network $DOCKER_NET_NAME -d -v ollama:/root/.ollama -p 11434:11434 --name ollama ollama/ollama + # sleep 3 + # docker exec ollama ollama pull smollm2:135m fi log "Starting Gradio app container" @@ -72,17 +76,23 @@ test() { sleep 10 log "Running tests" + # docker run --network $DOCKER_NET_NAME --rm \ + # --name $1-test-suite \ + # -e GRADIO_URL=http://$1-app:7860 --entrypoint python \ + # $IMAGE \ + # test.py docker run --network $DOCKER_NET_NAME --rm \ --name $1-test-suite \ - -e GRADIO_URL=http://$1-app:7860 --entrypoint python \ + --entrypoint python \ $IMAGE \ test.py log "Removing containers:" - docker rm -f ollama $1-app + # docker rm -f ollama $1-app + docker rm -f $1-app - log "Removing docker network:" - docker network rm $DOCKER_NET_NAME + # log "Removing docker network:" + # docker network rm $DOCKER_NET_NAME echo echo "----- Tests succeed -----" From a776175dcb899d8be1e76aa1d7a0515b49363349 Mon Sep 17 00:00:00 2001 From: Scott Davidson Date: Fri, 24 Oct 2025 15:26:27 +0100 Subject: [PATCH 4/9] Pin langchain to <1.0 --- web-apps/chat/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web-apps/chat/requirements.txt b/web-apps/chat/requirements.txt index 635f4a4e..a448a54f 100644 --- a/web-apps/chat/requirements.txt +++ b/web-apps/chat/requirements.txt @@ -1,7 +1,7 @@ gradio<6 gradio_client openai -langchain +langchain<1.0 langchain_openai pydantic structlog From e7a7d42dc1de43e33399865ef6e15c95422b2cb2 Mon Sep 17 00:00:00 2001 From: Scott Davidson Date: Fri, 24 Oct 2025 15:27:03 +0100 Subject: [PATCH 5/9] Switch to UV for python package installation --- web-apps/chat/Dockerfile | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/web-apps/chat/Dockerfile b/web-apps/chat/Dockerfile index c963b29f..aa124b70 100644 --- a/web-apps/chat/Dockerfile +++ b/web-apps/chat/Dockerfile @@ -1,10 +1,13 @@ -FROM python:3.11-slim +# FROM python:3.11-slim +FROM ghcr.io/astral-sh/uv:python3.11-bookworm-slim ARG DIR=chat COPY $DIR/requirements.txt requirements.txt +RUN sed -i s$../utils$./utils$ requirements.txt COPY utils utils -RUN pip install --no-cache-dir -r requirements.txt +# RUN pip install --no-cache-dir -r requirements.txt +RUN uv pip install --system --no-cache-dir -r requirements.txt COPY purge-google-fonts.sh purge-google-fonts.sh RUN bash purge-google-fonts.sh From bfa751c98d1e1f2b0cea80ebb01253ed7429d2c0 Mon Sep 17 00:00:00 2001 From: Scott Davidson Date: Fri, 24 Oct 2025 15:27:14 +0100 Subject: [PATCH 6/9] Pull required ollama model in CI --- .github/workflows/test-pr.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/test-pr.yml b/.github/workflows/test-pr.yml index b42f5998..a9c1ff59 100644 --- a/.github/workflows/test-pr.yml +++ b/.github/workflows/test-pr.yml @@ -69,7 +69,10 @@ jobs: - name: Run Gradio app tests run: | + # Set up Ollama backend curl -fsSL https://ollama.com/install.sh | sh + ollama pull smollm2:135m + # Run the Gradio tests against Ollama ./test-images.sh $(git rev-parse --short ${{ github.sha }}) working-directory: web-apps From 4251c96c472bf5019f846ca3bc24a986f9de3334 Mon Sep 17 00:00:00 2001 From: Scott Davidson Date: Fri, 24 Oct 2025 15:35:16 +0100 Subject: [PATCH 7/9] Give ollama systemd unit time to start --- .github/workflows/test-pr.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test-pr.yml b/.github/workflows/test-pr.yml index a9c1ff59..20c7a4b4 100644 --- a/.github/workflows/test-pr.yml +++ b/.github/workflows/test-pr.yml @@ -71,6 +71,8 @@ jobs: run: | # Set up Ollama backend curl -fsSL https://ollama.com/install.sh | sh + # Give ollama systemd unit time to start + sleep 5 ollama pull smollm2:135m # Run the Gradio tests against Ollama ./test-images.sh $(git rev-parse --short ${{ github.sha }}) From ee19d01692d433bd6ac529b6df44618a61a5b49e Mon Sep 17 00:00:00 2001 From: Scott Davidson Date: Fri, 24 Oct 2025 15:35:44 +0100 Subject: [PATCH 8/9] Switch to uv for python package installation --- web-apps/chat/Dockerfile | 2 -- web-apps/flux-image-gen/Dockerfile | 4 ++-- web-apps/image-analysis/Dockerfile | 5 +++-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/web-apps/chat/Dockerfile b/web-apps/chat/Dockerfile index aa124b70..0dd199b4 100644 --- a/web-apps/chat/Dockerfile +++ b/web-apps/chat/Dockerfile @@ -1,4 +1,3 @@ -# FROM python:3.11-slim FROM ghcr.io/astral-sh/uv:python3.11-bookworm-slim ARG DIR=chat @@ -6,7 +5,6 @@ ARG DIR=chat COPY $DIR/requirements.txt requirements.txt RUN sed -i s$../utils$./utils$ requirements.txt COPY utils utils -# RUN pip install --no-cache-dir -r requirements.txt RUN uv pip install --system --no-cache-dir -r requirements.txt COPY purge-google-fonts.sh purge-google-fonts.sh diff --git a/web-apps/flux-image-gen/Dockerfile b/web-apps/flux-image-gen/Dockerfile index ba48dbe0..b05b609f 100644 --- a/web-apps/flux-image-gen/Dockerfile +++ b/web-apps/flux-image-gen/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.11 +FROM ghcr.io/astral-sh/uv:python3.11-bookworm # https://stackoverflow.com/questions/55313610/importerror-libgl-so-1-cannot-open-shared-object-file-no-such-file-or-directo RUN apt-get update && apt-get install ffmpeg libsm6 libxext6 -y @@ -7,7 +7,7 @@ RUN apt-get update && apt-get install ffmpeg libsm6 libxext6 -y ARG DIR=flux-image-gen COPY $DIR/requirements.txt requirements.txt -RUN pip install --no-cache-dir -r requirements.txt +RUN uv pip install --system --no-cache-dir -r requirements.txt COPY purge-google-fonts.sh . RUN bash purge-google-fonts.sh diff --git a/web-apps/image-analysis/Dockerfile b/web-apps/image-analysis/Dockerfile index 5f858f85..50d30ea2 100644 --- a/web-apps/image-analysis/Dockerfile +++ b/web-apps/image-analysis/Dockerfile @@ -1,10 +1,11 @@ -FROM python:3.11-slim +FROM ghcr.io/astral-sh/uv:python3.11-bookworm-slim ARG DIR=image-analysis COPY $DIR/requirements.txt requirements.txt +RUN sed -i s$../utils$./utils$ requirements.txt COPY utils utils -RUN pip install --no-cache-dir -r requirements.txt +RUN uv pip install --system --no-cache-dir -r requirements.txt COPY purge-google-fonts.sh purge-google-fonts.sh RUN bash purge-google-fonts.sh From c5ce8a9cb0fb6946cbb2485235d59a9f65f5f98c Mon Sep 17 00:00:00 2001 From: Scott Davidson Date: Fri, 24 Oct 2025 17:15:58 +0100 Subject: [PATCH 9/9] Add comments and debug info --- .github/workflows/test-pr.yml | 11 ++++++++--- web-apps/test-images.sh | 6 ++++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test-pr.yml b/.github/workflows/test-pr.yml index 20c7a4b4..505ab079 100644 --- a/.github/workflows/test-pr.yml +++ b/.github/workflows/test-pr.yml @@ -69,12 +69,17 @@ jobs: - name: Run Gradio app tests run: | - # Set up Ollama backend + echo "Installing ollama..." curl -fsSL https://ollama.com/install.sh | sh + # Give ollama systemd unit time to start sleep 5 - ollama pull smollm2:135m - # Run the Gradio tests against Ollama + + MODEL=smollm2:135m + echo "Pulling model $MODEL..." + ollama pull $MODEL + + echo "Running Gradio test script" ./test-images.sh $(git rev-parse --short ${{ github.sha }}) working-directory: web-apps diff --git a/web-apps/test-images.sh b/web-apps/test-images.sh index f9815c93..8909207f 100755 --- a/web-apps/test-images.sh +++ b/web-apps/test-images.sh @@ -1,6 +1,12 @@ #!/bin/bash set -e +# NOTE(sd109): This script relies on docker host networking in order +# to communicate from Gradio to ollama running on localhost. This means +# it does not work on MacOS since docker host networking does not work. +# It is intended to be run on a Linux machine and is primarily used in +# GitHub runners as part of CI testing. + IMAGE_TAG="${1:-latest}" echo Testing image tag $IMAGE_TAG