Skip to content

Commit 53d7bea

Browse files
committed
Implement GenAI functionality & testing
2 parents 912a2c0 + 5e4a311 commit 53d7bea

File tree

23 files changed

+549
-78
lines changed

23 files changed

+549
-78
lines changed

.github/workflows/ci.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,21 @@ jobs:
2626

2727
# TODO Add linting
2828

29-
# Run Java unit-tests
29+
# Run Java unit tests
3030
unit_tests:
3131
name: Run Tests
3232
uses: ./.github/workflows/java_tests.yml
3333
needs: update_api_spec
3434

35-
# Run UI tests (unit, integration, and e2e)
35+
# Run GenAI module tests
36+
genai_tests:
37+
name: Run GenAI Tests
38+
uses: ./.github/workflows/genai_tests.yml
39+
needs: update_api_spec
40+
secrets:
41+
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
3642

43+
# Run UI tests (unit, integration, and e2e)
3744
ui_tests:
3845
name: Run UI Tests
3946
uses: ./.github/workflows/ui_tests.yml

.github/workflows/genai_tests.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: GenAI Tests
2+
3+
on:
4+
workflow_call:
5+
secrets:
6+
OPENAI_API_KEY:
7+
required: true
8+
9+
jobs:
10+
genai-tests:
11+
runs-on: ubuntu-latest
12+
env:
13+
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v3
17+
18+
- name: Set up Python
19+
uses: actions/setup-python@v4
20+
with:
21+
python-version: '3.11'
22+
23+
- name: Install dependencies
24+
run: |
25+
python -m pip install --upgrade pip
26+
pip install -r server/genai/requirements.txt
27+
pip install pytest
28+
29+
- name: Run GenAI tests
30+
run: PYTHONPATH=server/genai pytest -v

deployment/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ The `deployment` directory contains necessary files for the deployment of Meet@M
44
To deploy the system manually on your local machine, follow the guides below. Automated deployment workflows in GitHub Actions can be found under `../.github/workflows`.
55

66
## Docker Compose
7+
Prerequisites:
8+
- a `.env` file is located in `/docker` directory and contains the `OPENAI_API_KEY` secret for the GenAI service (in AWS deployment, a GitHub secret is used instead)
9+
710
Use the following commands to start / stop / inspect the project using Docker Compose:
811
```
912
cd docker # Move to docker directory
@@ -26,6 +29,12 @@ kubectl create secret generic <match/user>-db-secret \
2629
--from-literal=MYSQL_ROOT_PASSWORD='<your-password>' \
2730
--namespace devoops
2831
```
32+
- OpenAI API key is saved as secret in the `devoops` namespace:
33+
```
34+
kubectl create secret generic genai-secret \
35+
--from-literal=OPENAI_API_KEY=sk-... \
36+
--namespace devoops
37+
```
2938

3039
Once the three requirements are fulfilled, you can run the application:
3140
```

deployment/compose.aws.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@ services:
9898

9999
meetatmensa-genai:
100100
image: ghcr.io/aet-devops25/team-devoops/genai:latest
101+
environment:
102+
OPENAI_API_KEY: ${OPENAI_API_KEY}
101103
container_name: meetatmensa-genai
102104
labels:
103105
- traefik.enable=true

deployment/docker/compose.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ services:
4141
- "80"
4242
networks:
4343
- backend
44+
env_file:
45+
- .env
4446

4547
meetatmensa-client:
4648
build:

deployment/k8s/charts/genai/templates/deployment.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@ spec:
4040
{{- end }}
4141
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
4242
imagePullPolicy: {{ .Values.image.pullPolicy }}
43+
env:
44+
- name: OPENAI_API_KEY
45+
valueFrom:
46+
secretKeyRef:
47+
name: genai-secret
48+
key: OPENAI_API_KEY
4349
ports:
4450
- name: http
4551
containerPort: {{ .Values.service.port }}

infrastructure/ansible/playbooks/deploy.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,4 +105,5 @@
105105
remove_orphans: yes
106106
environment:
107107
DOCKER_BUILDKIT: 1
108-
EC2_PUBLIC_IP: "{{ ansible_host }}"
108+
EC2_PUBLIC_IP: "{{ ansible_host }}"
109+
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
42.7 KB
Binary file not shown.
42.7 KB
Binary file not shown.

server/gateway/src/main/resources/application.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,4 @@ spring:
4141
- id: genai_route
4242
uri: http://meetatmensa-genai:80
4343
predicates:
44-
- Path=/genai/**
44+
- Path=/api/v2/genai/**

0 commit comments

Comments
 (0)