Skip to content

Commit 25e77e1

Browse files
committed
Open WebUI: Add basic software test and CI/GHA configuration
1 parent 1116e54 commit 25e77e1

File tree

6 files changed

+116
-8
lines changed

6 files changed

+116
-8
lines changed

.github/dependabot.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,16 @@ updates:
120120
schedule:
121121
interval: "daily"
122122

123+
- directory: "/application/open-webui"
124+
package-ecosystem: "docker-compose"
125+
schedule:
126+
interval: "daily"
127+
128+
- directory: "/application/open-webui/init"
129+
package-ecosystem: "docker"
130+
schedule:
131+
interval: "daily"
132+
123133
- directory: "/application/ingestr"
124134
package-ecosystem: "pip"
125135
schedule:
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: "Open WebUI"
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- '.github/workflows/application-open-webui.yml'
7+
- 'application/open-webui/**'
8+
push:
9+
branches: [ main ]
10+
paths:
11+
- '.github/workflows/application-open-webui.yml'
12+
- 'application/open-webui/**'
13+
14+
# Allow job to be triggered manually.
15+
workflow_dispatch:
16+
17+
# Run job each night after CrateDB nightly has been published.
18+
#schedule:
19+
# - cron: '0 3 * * *'
20+
21+
# Cancel in-progress jobs when pushing to the same branch.
22+
concurrency:
23+
cancel-in-progress: true
24+
group: ${{ github.workflow }}-${{ github.ref }}
25+
26+
jobs:
27+
28+
test:
29+
runs-on: ${{ matrix.os }}
30+
31+
strategy:
32+
fail-fast: true
33+
matrix:
34+
os: [ "ubuntu-latest" ]
35+
36+
name: OS ${{ matrix.os }}
37+
38+
env:
39+
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
40+
41+
steps:
42+
43+
- name: Acquire sources
44+
uses: actions/checkout@v4
45+
46+
- name: Validate application/open-webui
47+
run: |
48+
# TODO: Generalize invocation into `ngr` test runner.
49+
50+
# Invoke software stack.
51+
cd application/open-webui
52+
docker compose up --detach
53+
54+
# Invoke validation payload.
55+
docker compose run test

application/open-webui/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,14 @@ docker volume rm open-webui_open-webui
101101
docker volume rm open-webui_cratedb
102102
```
103103

104+
### Jobs
105+
Invoke individual jobs defined in the Compose file.
106+
```shell
107+
export BUILDKIT_PROGRESS=plain
108+
docker compose run --build setup
109+
docker compose run --build test
110+
```
111+
104112
## What's inside
105113

106114
- `.env`: The dotenv file defines `OPENAI_API_KEY` for `compose.yml`.

application/open-webui/compose.yml

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ services:
9191
test: [ "CMD", "curl", "--fail", "http://localhost:8080" ]
9292
start_period: 3s
9393
interval: 10s
94-
timeout: 90s
9594
retries: 60
95+
timeout: 120s
9696
#depends_on:
9797
# cratedb-mcpo:
9898
# condition: service_healthy
@@ -114,6 +114,21 @@ services:
114114
open-webui:
115115
condition: service_healthy
116116

117+
# ----
118+
# Test
119+
# ----
120+
test:
121+
build:
122+
context: init
123+
command: bash /app/test.sh
124+
networks:
125+
- llm-demo
126+
depends_on:
127+
setup:
128+
condition: service_completed_successfully
129+
deploy:
130+
replicas: 0
131+
117132
# -------
118133
# Bundler
119134
# -------
@@ -123,11 +138,5 @@ services:
123138
start-dependencies:
124139
image: docker.io/dadarek/wait-for-dependencies
125140
depends_on:
126-
cratedb:
127-
condition: service_healthy
128-
#cratedb-mcpo:
129-
# condition: service_healthy
130-
open-webui:
131-
condition: service_healthy
132141
setup:
133142
condition: service_completed_successfully

application/open-webui/init/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@ RUN uv pip install crash cratedb-mcp httpie
3131

3232
RUN mkdir /app
3333
WORKDIR /app
34-
COPY .env setup.sh *.json *.sql /app/
34+
COPY .env *.sh *.json *.sql /app/
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/usr/bin/env bash
2+
3+
# Test Open WebUI configuration via HTTP API.
4+
5+
# Runtime options.
6+
set -euo pipefail
7+
8+
# Uncomment for local debugging, but **never** in automated runs.
9+
# set -x
10+
11+
# Load configuration.
12+
source .env
13+
14+
# Sign in to receive JWT token.
15+
token=$( http --ignore-stdin POST ${OPEN_WEBUI_URL}/api/v1/auths/signin email= password= | jq -r .token )
16+
if [[ -z "${token}" ]]; then
17+
echo "FATAL: Could not obtain JWT token from Open WebUI" >&2
18+
exit 1
19+
fi
20+
21+
# Check for a canonical available model to validate that Open WebUI configuration worked.
22+
http ${OPEN_WEBUI_URL}/api/models Authorization:"Bearer $token" refresh==true | \
23+
grep '"id":"gpt-4.1"' >/dev/null 2>&1 || {
24+
echo "ERROR: Model GPT-4.1 not available"
25+
exit 1
26+
}

0 commit comments

Comments
 (0)