Skip to content

Commit de4324c

Browse files
authored
Merge pull request #1 from stackhpc/feature/pydantic
Refactor to use Pydantic-validated config file for frontend web app
2 parents c9e65c9 + 9dc5974 commit de4324c

File tree

13 files changed

+172
-191
lines changed

13 files changed

+172
-191
lines changed

.github/workflows/build-push-artifacts.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,15 @@ jobs:
3535
type=sha,prefix=
3636
3737
- name: Build and push image
38-
uses: stackhpc/github-actions/docker-multiarch-build-push@master
38+
uses: stackhpc/github-actions/docker-multiarch-build-push@allow-continue-after-scan
3939
with:
4040
cache-key: ${{ matrix.component }}-base
4141
context: ./images/${{ matrix.component }}-base
4242
platforms: linux/amd64 #,linux/arm64
4343
push: true
4444
tags: ${{ steps.image-meta.outputs.tags }}
4545
labels: ${{ steps.image-meta.outputs.labels }}
46+
fail_on_high_severity_cve: false
4647

4748
build_push_chart:
4849
name: Build and push Helm chart

.helmignore

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,10 @@
2525
# Others
2626
README.md
2727
Dockerfile
28-
gradio-app.py
2928
kubeconfig.yml
3029
venv/
3130
__pycache__/
32-
images/
31+
images/
32+
.hf-token.secret
33+
hu-poc/
34+
test-values.yaml

app-dev.py

Lines changed: 0 additions & 59 deletions
This file was deleted.

images/ui-base/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ FROM python:3.11-slim
33

44
ENV GRADIO_SERVER_PORT=7680
55

6-
RUN pip install --no-cache-dir gradio==3.50.2 huggingface-hub==0.18.0
6+
RUN pip install --no-cache-dir gradio==4.10.0 huggingface-hub==0.19.4 pydantic-settings==2.1.0

templates/ui/app-config-map.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,6 @@ metadata:
55
labels:
66
{{- include "azimuth-llm.labels" . | nindent 4 }}
77
data:
8-
{{ (.Files.Glob "web-app-utils/*").AsConfig | nindent 2 }}
8+
{{ (.Files.Glob "web-app/*").AsConfig | nindent 2 }}
9+
settings.yml: |
10+
{{- .Values.ui.appSettings | toYaml | nindent 4 }}

templates/ui/deployment.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,14 @@ spec:
2222
ports:
2323
- name: ui
2424
containerPort: 7680
25+
workingDir: /etc/web-app
2526
volumeMounts:
2627
- name: app
2728
mountPath: /etc/web-app
2829
command:
2930
- python
3031
args:
31-
- {{ printf "/etc/web-app/%s" .Values.ui.entrypoint }}
32+
- {{ .Values.ui.entrypoint }}
3233
env:
3334
- name: PYTHONUNBUFFERED
3435
value: "1"

values.yaml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ huggingface:
2929
api:
3030
# Container image config
3131
image:
32-
repository: ghcr.io/stackhpc/azimuth-llm-api-base
33-
version: "6876068"
32+
repository: vllm/vllm-openai
33+
version: v0.2.4
3434
# Service config
3535
service:
3636
name: llm-backend
@@ -65,8 +65,12 @@ api:
6565

6666
# Configuration for the frontend web interface
6767
ui:
68-
# The file from the UI config map to execute as the frontend app
69-
entrypoint: example_app_vanilla.py
68+
# The file from the UI config map to execute as the entrypoint to the frontend app
69+
entrypoint: app.py
70+
# The values to be written to settings.yml for parsing as frontend app setting
71+
# (see example_app.py and config.py for example using pydantic-settings to configure app)
72+
appSettings:
73+
prompt_template: ""
7074
# Container image config
7175
image:
7276
repository: ghcr.io/stackhpc/azimuth-llm-ui-base

web-app-utils/example_app_playful.py

Lines changed: 0 additions & 58 deletions
This file was deleted.

web-app-utils/example_app_vanilla.py

Lines changed: 0 additions & 62 deletions
This file was deleted.

web-app-utils/api_startup_check.py renamed to web-app/api_startup_check.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import requests, time
2+
from urllib.parse import urljoin
23

34

45
def wait_for_backend(url):
@@ -7,10 +8,11 @@ def wait_for_backend(url):
78
accept requests until the backend API is up and running.
89
"""
910
ready = False
11+
endpoint = urljoin(url, "/health")
1012
while not ready:
1113
try:
12-
ready = requests.get(f"{url}/health").status_code == 200
13-
print("Waiting for backend API to start")
14+
ready = requests.get(endpoint).status_code == 200
15+
print(f"Waiting for 200 status from backend API at {endpoint}")
1416
time.sleep(1)
1517
except requests.exceptions.ConnectionError as e:
1618
pass

0 commit comments

Comments
 (0)