Skip to content
Merged
Show file tree
Hide file tree
Changes from 72 commits
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
cfe6ee4
Added some more deployments/service for other microservices
justus-wendroth Jul 13, 2025
d42e2d4
Merge branch 'main' into fix-kubernetes-deployment
justus-wendroth Jul 14, 2025
1338d13
Updated deployment
justus-wendroth Jul 15, 2025
b168ebd
update host in client
justus-wendroth Jul 15, 2025
d937831
update e2e test
justus-wendroth Jul 15, 2025
ec243f6
added ollama deployment
justus-wendroth Jul 15, 2025
820bb35
update setting of client environment variables
justus-wendroth Jul 15, 2025
0c86e83
Update deployments
justus-wendroth Jul 17, 2025
40dee8c
Fixed some stuff regarding the deployment
justus-wendroth Jul 18, 2025
0bef91a
Merge branch 'main' into fix-kubernetes-deployment
justus-wendroth Jul 18, 2025
53c4191
Updated kubernetes deployment
justus-wendroth Jul 18, 2025
a4533e4
Update docker publishing of images
justus-wendroth Jul 18, 2025
8c9287a
test pull request workflow
justus-wendroth Jul 18, 2025
cae0df2
use sha instead
justus-wendroth Jul 18, 2025
3d51d2f
fixed kubernetes deployment
justus-wendroth Jul 18, 2025
0de6bde
fix workflows speliing
justus-wendroth Jul 18, 2025
db4f9ca
Updated readme
justus-wendroth Jul 18, 2025
7bf1317
Merge branch 'main' into fix-kubernetes-deployment
justus-wendroth Jul 18, 2025
0b10748
added some documentation
justus-wendroth Jul 18, 2025
3bc7e55
Updated documentation
justus-wendroth Jul 19, 2025
cea587d
test pull request workflow
justus-wendroth Jul 19, 2025
9ec385f
test kubernetes deployment
justus-wendroth Jul 19, 2025
6799105
test helm deployment
justus-wendroth Jul 19, 2025
0505641
test config setup
justus-wendroth Jul 19, 2025
d6c6444
test
justus-wendroth Jul 19, 2025
6e08c41
test
justus-wendroth Jul 19, 2025
b7ad145
test
justus-wendroth Jul 19, 2025
7bad07e
test
justus-wendroth Jul 19, 2025
d7c7815
test
justus-wendroth Jul 19, 2025
8d1679a
test
justus-wendroth Jul 19, 2025
55fa3f4
test
justus-wendroth Jul 19, 2025
82d835b
test
justus-wendroth Jul 19, 2025
0edf800
test
justus-wendroth Jul 19, 2025
7871da9
test
justus-wendroth Jul 19, 2025
d7ec078
test
justus-wendroth Jul 19, 2025
3591f08
setup config
justus-wendroth Jul 19, 2025
507b4da
Another attempt
Jul 19, 2025
9a316b7
get kubeconfig from secrets
justus-wendroth Jul 19, 2025
61b3920
test
justus-wendroth Jul 19, 2025
fcda220
test
justus-wendroth Jul 19, 2025
ec6044d
test
justus-wendroth Jul 19, 2025
f386c8d
test
justus-wendroth Jul 19, 2025
f51c7a1
test
justus-wendroth Jul 19, 2025
1d3d737
test
justus-wendroth Jul 19, 2025
3899d6b
Verify cluster access
Ahmad-Diab Jul 19, 2025
0f90488
Another attempt
Ahmad-Diab Jul 19, 2025
20bf620
remove --short
Ahmad-Diab Jul 19, 2025
0673c99
Revert "test"
Ahmad-Diab Jul 19, 2025
4b6baeb
Another attempt
Ahmad-Diab Jul 19, 2025
d354774
Another attempt
Ahmad-Diab Jul 19, 2025
bc02c69
Another attempt
Ahmad-Diab Jul 19, 2025
d1322ba
Another attempt
Ahmad-Diab Jul 19, 2025
6ce7b84
Another attempt
Ahmad-Diab Jul 19, 2025
b0e48fa
Revert "Another attempt"
Ahmad-Diab Jul 19, 2025
37010f4
Another attempt
Ahmad-Diab Jul 19, 2025
5ca22e3
Print decoded value
Ahmad-Diab Jul 19, 2025
56cf3b8
Check the existence of KUBECONFIG
Ahmad-Diab Jul 19, 2025
430ea81
Pass KUBECONF to helm chart workflow
Ahmad-Diab Jul 19, 2025
a9e28ed
Fix typo :(
Ahmad-Diab Jul 19, 2025
85f7822
Try to fix another typo
Ahmad-Diab Jul 19, 2025
cf0daf1
Add secret variable in ci-pull-request
Ahmad-Diab Jul 19, 2025
b026b4f
Remove printing of a secret variable
Ahmad-Diab Jul 19, 2025
cc4cffa
KUBECONFIG to KUBECONFIG
Ahmad-Diab Jul 19, 2025
52d8abd
KUBECONFIG to KUBECONFIG
Ahmad-Diab Jul 19, 2025
3c23045
KUBECONF to KUBECONFIG
Ahmad-Diab Jul 19, 2025
351187f
Revert "KUBECONF to KUBECONFIG"
Ahmad-Diab Jul 19, 2025
4bb1174
Revert "Revert "KUBECONF to KUBECONFIG""
Ahmad-Diab Jul 19, 2025
76eddae
Revert "KUBECONF to KUBECONFIG"
Ahmad-Diab Jul 19, 2025
c328ce1
Updated workflows
justus-wendroth Jul 20, 2025
6941f46
Merge branch 'fix-kubernetes-deployment' of github.com:AET-DevOps25/t…
justus-wendroth Jul 20, 2025
cbc8da8
changed sha
justus-wendroth Jul 20, 2025
173469f
update ci workflow
justus-wendroth Jul 20, 2025
abf2f08
Merge branch 'main' into fix-kubernetes-deployment
justus-wendroth Jul 20, 2025
6e74e19
Fix a few things
justus-wendroth Jul 20, 2025
cbb33e2
Merge branch 'fix-kubernetes-deployment' of github.com:AET-DevOps25/t…
justus-wendroth Jul 20, 2025
fa7791a
changed to only deploy on main
justus-wendroth Jul 20, 2025
ea18bbd
test
justus-wendroth Jul 20, 2025
967c837
Use kubernetes active profile for mentorship service
Ahmad-Diab Jul 20, 2025
cde83db
Add a flag for https or http
Ahmad-Diab Jul 20, 2025
0f1372c
Fix compilation error
Ahmad-Diab Jul 20, 2025
8a2ddae
Another attempt
Ahmad-Diab Jul 20, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .github/workflows/ci-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,10 @@ jobs:
- e2e-tests
- backend-tests
uses: ./.github/workflows/docker.yml
# TODO: add deployment as step
deploy-to-kubernetes:
needs:
- build-publish-images
uses: ./.github/workflows/helm.yml
secrets:
KUBECONF: ${{ secrets.KUBECONF }}
# TODO: maybe add deploy to aws step
2 changes: 1 addition & 1 deletion .github/workflows/ci-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ jobs:
needs:
- e2e-tests
- backend-tests
uses: ./.github/workflows/docker.yml
uses: ./.github/workflows/docker.yml
24 changes: 17 additions & 7 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,45 +30,55 @@ jobs:
with:
context: ./client
push: true
tags: ghcr.io/aet-devops25/team-the-merge-doctors/client:latest
tags: ghcr.io/aet-devops25/team-the-merge-doctors/client:${{ github.sha }}

- name: Build & push Client image (Kubernetes Production)
uses: docker/build-push-action@v4
with:
context: ./client
push: true
tags: ghcr.io/aet-devops25/team-the-merge-doctors/client-kubernetes-production:${{ github.sha }}
build-args: |
NODE_ENV=production-kubernetes

- name: Build & push GenAI image
uses: docker/build-push-action@v4
with:
context: ./genai
push: true
tags: ghcr.io/aet-devops25/team-the-merge-doctors/genai:latest
tags: ghcr.io/aet-devops25/team-the-merge-doctors/genai:${{ github.sha }}

- name: Build & push Ollama image
uses: docker/build-push-action@v4
with:
context: ./genai/ollama
push: true
tags: ghcr.io/aet-devops25/team-the-merge-doctors/ollama:latest
tags: ghcr.io/aet-devops25/team-the-merge-doctors/ollama:${{ github.sha }}

- name: Build & push User Service image
uses: docker/build-push-action@v4
with:
context: ./server/userservice
push: true
tags: ghcr.io/aet-devops25/team-the-merge-doctors/server/user-service:latest
tags: ghcr.io/aet-devops25/team-the-merge-doctors/server/user-service:${{ github.sha }}

- name: Build & push Mentorship Service image
uses: docker/build-push-action@v4
with:
context: ./server/mentorshipservice
push: true
tags: ghcr.io/aet-devops25/team-the-merge-doctors/server/mentorship-service:latest
tags: ghcr.io/aet-devops25/team-the-merge-doctors/server/mentorship-service:${{ github.sha }}

- name: Build & push Rating Service image
uses: docker/build-push-action@v4
with:
context: ./server/ratingservice
push: true
tags: ghcr.io/aet-devops25/team-the-merge-doctors/server/rating-service:latest
tags: ghcr.io/aet-devops25/team-the-merge-doctors/server/rating-service:${{ github.sha }}

- name: Build & push Gateway Service image
uses: docker/build-push-action@v4
with:
context: ./server/gateway
push: true
tags: ghcr.io/aet-devops25/team-the-merge-doctors/server/gateway-service:latest
tags: ghcr.io/aet-devops25/team-the-merge-doctors/server/gateway-service:${{ github.sha }}
4 changes: 0 additions & 4 deletions .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ jobs:
- uses: docker/setup-compose-action@v1
name: Setup Docker

- name: Setup .env
run: |
cp docker/backend_config_files/.env.template docker/backend_config_files/.env

- name: Generate JWT Key
run: |
./docker/backend_config_files/jwk-key-generator.sh
Expand Down
41 changes: 22 additions & 19 deletions .github/workflows/helm.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: Manual k8s (Helm) deployment
name: k8s (Helm) deployment

on:
workflow_dispatch:
inputs:
open_api_key:
description: "Your Open API key"
workflow_call:
secrets:
KUBECONF:
description: "Base64‑encoded kubeconfig file"
required: true

jobs:
Expand All @@ -15,10 +15,10 @@ jobs:
uses: actions/checkout@v4

- name: Set up kubectl
uses: azure/setup-kubectl@v3
uses: azure/setup-kubectl@v4

- name: Set up Helm
uses: azure/setup-helm@v3
uses: azure/setup-helm@v4

- name: Log in to GHCR
uses: docker/login-action@v2
Expand All @@ -29,22 +29,25 @@ jobs:

- name: Set up kubeconfig
run: |
mkdir $HOME/.kube
printf '%s' "${{ secrets.STUDENTKUBECONFIG }}" > $HOME/.kube/config
chmod 600 $HOME/.kube/config
mkdir -p ~/.kube
echo "${{ secrets.KUBECONF }}" | base64 --decode > ~/.kube/config
chmod 600 ~/.kube/config
echo "KUBECONF=~/.kube/config" >> $GITHUB_ENV

- name: Debug kubeconfig
run: |
kubectl config get-contexts
cat $HOME/.kube/config

# TODO: we are currently just using the latest containers without building them beforehand. Maybe add deployment as step of the pipeline on commits on the main branch
- name: Replace OPEN API key
- name: Set up kubeconfig
run: |
cp ./helm/values.yaml.template ./helm/values.yaml
sed -i 's/<YOUR_OPEN_API_KEY>/test/g' ./helm/values.yaml
mkdir -p ~/.kube
echo "$KUBECONF_B64" | base64 --decode > ~/.kube/config
chmod 600 ~/.kube/config
echo "KUBECONF=~/.kube/config" >> $GITHUB_ENV
env:
KUBECONF_B64: ${{ secrets.KUBECONF }}

- name: Deploy using Helm
env:
KUBECONF: ${{ runner.home }}/.kube/config
run: |
helm upgrade --install mentor-pulse ./helm/ \
--namespace team-the-merge-doctors \
--set tag=${{ github.sha }}} \
--debug
6 changes: 1 addition & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,6 @@ celerybeat.pid

# Environments
.secrets.env
.env
.venv
env/
venv/
Expand Down Expand Up @@ -377,7 +376,4 @@ sketch
### Vue ###
# gitignore template for Vue.js projects
#
# Recommended template: Node.gitignore

# Helm
values.yaml
# Recommended template: Node.gitignore
38 changes: 36 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,33 @@
# Mentor Pulse

TODO: short introduction what mentor pulse is

## Local Development Setup

TODO: documentation to add for project setup (e.g. how to start with docker)

```
docker compose up --build
```

```
docker compose down -v
```

### Loading Mock Data

TODO: add link to mock data scripts

## Deployment

TODO: add documentation about deployments

### Kubernetes

TODO: add link to kubernetes

### EC2

## Endpoint Documentation

The endpoints are documented using OpenAPI or Swagger schemas:
Expand All @@ -12,6 +40,12 @@ The endpoints are documented using OpenAPI or Swagger schemas:

Alternatively, you can also find the endpoints in the controllers of the services (e.g. [MentorProfileController](server/mentorshipservice/src/main/java/com/mentorpulse/mentorshipservice/controller/MentorProfileController.java), [GenAI](genai/controllers/api_controller.py)). Additionally, some are also documented in `.bru` files (see [mentor-pulse-bruno](/docs/mentor-pulse-bruno/)).

## Setup
## Generating Open API Schemas for Microservices

TODO: documentation to add for project setup (e.g. how to start with docker)
This is how you can generate schemas for the Java microservices. For [genai](/genai/README.md) the setup is different.

1. Start database via `docker compose up --build postgres-db`.
2. Start service via `docker compose up --build <service-name>` for which you want to generate the schema.
3. Navigate to service that you want to generate the schema for. Execute `./gradlew generateOpenApiDocs` in root
directory of service. Alternatively, open `http://<endpoint>/v3/api-docs.yaml` in a browser and move the schema to
the correct folder in the service.
1 change: 1 addition & 0 deletions client/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
MENTORSHIP_SERVICE_PROD_URL=http://mentorship-
6 changes: 6 additions & 0 deletions client/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ RUN pnpm install --frozen-lockfile

COPY . .

ARG NODE_ENV=development
ENV NODE_ENV=${NODE_ENV}

RUN pnpm run build

# Stage 2
Expand All @@ -27,6 +30,9 @@ COPY --from=build /app/dist ./dist

EXPOSE 3000

ARG NODE_ENV=development
ENV NODE_ENV=${NODE_ENV}

CMD ["serve", "-s", "dist", "-l", "3000"]


Expand Down
2 changes: 1 addition & 1 deletion client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ The client is tested using E2E/UI tests. We use playwright as the framework for
3. Run Tests: `pnpm exec playwright test`
4. Show Report: `pnpm exec playwright show-report`

## Execute tests with UI
### Execute tests with UI

Alternatively, you can also execute the tests using a UI.

Expand Down
8 changes: 8 additions & 0 deletions client/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,16 @@ declare module '@tanstack/react-router' {
}
}

if (process.env.NODE_ENV === 'production-kubernetes') {
axios.defaults.baseURL =
'https://mentor-pulse-devops25.student.k8s.aet.cit.tum.de';
} else {
axios.defaults.baseURL = 'http://localhost:80';
}

axios.interceptors.request.use(
(config) => {
console.log('Base URL:', axios.defaults.baseURL);
const token = localStorage.getItem('token');
if (token) {
const parsedToken = JSON.parse(token);
Expand Down
3 changes: 1 addition & 2 deletions compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,8 @@ services:
platform: linux/amd64
image: ghcr.io/aet-devops25/team-the-merge-doctors/ollama:latest
build:
context: ./genai/ollama
context: genai/ollama
dockerfile: Dockerfile
container_name: ollama
ports:
- "11434:11434"
volumes:
Expand Down
8 changes: 8 additions & 0 deletions docs/mentor-pulse-bruno/production-kubernetes/folder.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
meta {
name: production-kubernetes
seq: 5
}

auth {
mode: inherit
}
17 changes: 17 additions & 0 deletions docs/mentor-pulse-bruno/production-kubernetes/genai.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
meta {
name: genai
type: http
seq: 1
}

post {
url: https://mentor-pulse-devops25.student.k8s.aet.cit.tum.de/api/genai/summarize
body: json
auth: inherit
}

body:json {
{
"textToSummarize": 'test',
}
}
2 changes: 2 additions & 0 deletions genai/ollama/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ RUN ollama serve & \
ollama pull llama3.2 && \
pkill ollama

EXPOSE 11434

ENTRYPOINT ["ollama", "serve"]
2 changes: 1 addition & 1 deletion genai/utils/langchain_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
def _get_llm():
"""Get Ollama LLM instance"""
try:
base_url = os.getenv('OLLAMA_BASE_URL', 'http://localhost:11434')
base_url = os.getenv('OLLAMA_BASE_URL', 'http://ollama-service:11434')
return OllamaLLM(model="llama3.2", base_url=base_url)
except Exception as e:
logger.error(f"Failed to initialize Ollama LLM: {e}")
Expand Down
47 changes: 42 additions & 5 deletions helm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,51 @@
1. Download kube config file from cluster.
2. Place it at `~/.kube/config`

## Project Setup
## Deploy

1. Copy `values.yaml.template` and rename it to `values.yaml`.
Run the following commands in this directory to deploy the application to the cluster.
The first two commands only need to be executed once.

## Deploy
1. Generate JWT secret key

```
../docker/backend_config_files/jwk-key-generator.sh
```

2. Create Secret in Kubernetes

```
kubectl create secret generic jwt-secret \
--from-file=jwt-secret.key=</path/to/local>/jwt-secret.key \
-n <namespace>
```

3. Deploy to cluster

```
helm upgrade --install mentor-pulse . --namespace team-the-merge-doctors --set tag=<branch_name>
```

## Remove Deployment

To remove the deployment and delete everything from cluster, execute the following command.

```
kubectl delete all --all -n team-the-merge-doctors
```

## Debugging

Some helpful commands for debugging.

Inspect the logs of a pod.

```
kubectl logs <deployment name (see rancher)> -n team-the-merge-doctors
```

Run the following command in this directory to deploy the application to the cluster.
ssh into a pod.

```
helm upgrade --install mentor-pulse . --namespace team-the-merge-doctors
kubectl exec -it <deployment name (see rancher)> -n team-the-merge-doctors -- /bin/sh
```
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ metadata:
data:
FLASK_ENV: development
FLASK_APP: app.py
POSTGRES_HOST: db
POSTGRES_HOST: postgres-db
POSTGRES_PORT: "5432"
POSTGRES_GEN_AI_DB: genai_backend
Loading