Skip to content

Commit 4ef1e93

Browse files
committed
Merge remote-tracking branch 'origin/main' into feature/setup-ansible-for-aws
# Conflicts: # .gitignore
2 parents 4e5462c + 759785e commit 4ef1e93

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+609
-131
lines changed

.github/workflows/ci-main.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,9 @@ jobs:
1717
- e2e-tests
1818
- backend-tests
1919
uses: ./.github/workflows/docker.yml
20-
# TODO: add deployment as step
20+
deploy-to-kubernetes:
21+
needs:
22+
- build-publish-images
23+
uses: ./.github/workflows/helm.yml
24+
secrets:
25+
KUBECONF: ${{ secrets.KUBECONF }}

.github/workflows/ci-pull-request.yml

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,18 @@ on:
77
permissions: write-all
88

99
jobs:
10-
e2e-tests:
11-
uses: ./.github/workflows/e2e-tests.yml
12-
backend-tests:
13-
uses: ./.github/workflows/backend-tests.yml
10+
# e2e-tests:
11+
# uses: ./.github/workflows/e2e-tests.yml
12+
# backend-tests:
13+
# uses: ./.github/workflows/backend-tests.yml
1414
build-publish-images:
15-
needs:
16-
- e2e-tests
17-
- backend-tests
15+
# needs:
16+
# - e2e-tests
17+
# - backend-tests
1818
uses: ./.github/workflows/docker.yml
19+
deploy-to-kubernetes:
20+
needs:
21+
- build-publish-images
22+
uses: ./.github/workflows/helm.yml
23+
secrets:
24+
KUBECONF: ${{ secrets.KUBECONF }}

.github/workflows/docker.yml

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,45 +30,55 @@ jobs:
3030
with:
3131
context: ./client
3232
push: true
33-
tags: ghcr.io/aet-devops25/team-the-merge-doctors/client:latest
33+
tags: ghcr.io/aet-devops25/team-the-merge-doctors/client:${{ github.sha }}
34+
35+
- name: Build & push Client image (Kubernetes Production)
36+
uses: docker/build-push-action@v4
37+
with:
38+
context: ./client
39+
push: true
40+
tags: ghcr.io/aet-devops25/team-the-merge-doctors/client-kubernetes-production:${{ github.sha }}
41+
build-args: |
42+
NODE_ENV=production-kubernetes
3443
3544
- name: Build & push GenAI image
3645
uses: docker/build-push-action@v4
3746
with:
3847
context: ./genai
3948
push: true
40-
tags: ghcr.io/aet-devops25/team-the-merge-doctors/genai:latest
49+
tags: ghcr.io/aet-devops25/team-the-merge-doctors/genai:${{ github.sha }}
4150

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

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

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

6372
- name: Build & push Rating Service image
6473
uses: docker/build-push-action@v4
6574
with:
6675
context: ./server/ratingservice
6776
push: true
68-
tags: ghcr.io/aet-devops25/team-the-merge-doctors/server/rating-service:latest
77+
tags: ghcr.io/aet-devops25/team-the-merge-doctors/server/rating-service:${{ github.sha }}
78+
6979
- name: Build & push Gateway Service image
7080
uses: docker/build-push-action@v4
7181
with:
7282
context: ./server/gateway
7383
push: true
74-
tags: ghcr.io/aet-devops25/team-the-merge-doctors/server/gateway-service:latest
84+
tags: ghcr.io/aet-devops25/team-the-merge-doctors/server/gateway-service:${{ github.sha }}

.github/workflows/e2e-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818

1919
- uses: docker/setup-compose-action@v1
2020
name: Setup Docker
21-
21+
2222
- name: Generate JWT Key
2323
run: |
2424
./docker/backend_config_files/jwk-key-generator.sh

.github/workflows/helm.yml

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
name: Manual k8s (Helm) deployment
1+
name: k8s (Helm) deployment
22

33
on:
4-
workflow_dispatch:
5-
inputs:
6-
open_api_key:
7-
description: "Your Open API key"
4+
workflow_call:
5+
secrets:
6+
KUBECONF:
7+
description: "Base64‑encoded kubeconfig file"
88
required: true
99

1010
jobs:
@@ -15,10 +15,10 @@ jobs:
1515
uses: actions/checkout@v4
1616

1717
- name: Set up kubectl
18-
uses: azure/setup-kubectl@v3
18+
uses: azure/setup-kubectl@v4
1919

2020
- name: Set up Helm
21-
uses: azure/setup-helm@v3
21+
uses: azure/setup-helm@v4
2222

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

3030
- name: Set up kubeconfig
3131
run: |
32-
mkdir $HOME/.kube
33-
printf '%s' "${{ secrets.STUDENTKUBECONFIG }}" > $HOME/.kube/config
34-
chmod 600 $HOME/.kube/config
32+
mkdir -p ~/.kube
33+
echo "${{ secrets.KUBECONF }}" | base64 --decode > ~/.kube/config
34+
chmod 600 ~/.kube/config
35+
echo "KUBECONF=~/.kube/config" >> $GITHUB_ENV
3536
36-
- name: Debug kubeconfig
37-
run: |
38-
kubectl config get-contexts
39-
cat $HOME/.kube/config
40-
41-
# 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
42-
- name: Replace OPEN API key
37+
- name: Set up kubeconfig
4338
run: |
44-
cp ./helm/values.yaml.template ./helm/values.yaml
45-
sed -i 's/<YOUR_OPEN_API_KEY>/test/g' ./helm/values.yaml
39+
mkdir -p ~/.kube
40+
echo "$KUBECONF_B64" | base64 --decode > ~/.kube/config
41+
chmod 600 ~/.kube/config
42+
echo "KUBECONF=~/.kube/config" >> $GITHUB_ENV
43+
env:
44+
KUBECONF_B64: ${{ secrets.KUBECONF }}
4645

4746
- name: Deploy using Helm
47+
env:
48+
KUBECONF: ${{ runner.home }}/.kube/config
4849
run: |
4950
helm upgrade --install mentor-pulse ./helm/ \
5051
--namespace team-the-merge-doctors \
52+
--set tag=${{ github.sha }} \
53+
--debug

README.md

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,33 @@
11
# Mentor Pulse
22

3+
TODO: short introduction what mentor pulse is
4+
5+
## Local Development Setup
6+
7+
TODO: documentation to add for project setup (e.g. how to start with docker)
8+
9+
```
10+
docker compose up --build
11+
```
12+
13+
```
14+
docker compose down -v
15+
```
16+
17+
### Loading Mock Data
18+
19+
TODO: add link to mock data scripts
20+
21+
## Deployment
22+
23+
TODO: add documentation about deployments
24+
25+
### Kubernetes
26+
27+
TODO: add link to kubernetes
28+
29+
### EC2
30+
331
## Endpoint Documentation
432

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

1341
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/)).
1442

15-
## Setup
43+
## Generating Open API Schemas for Microservices
1644

17-
TODO: documentation to add for project setup (e.g. how to start with docker)
45+
This is how you can generate schemas for the Java microservices. For [genai](/genai/README.md) the setup is different.
46+
47+
1. Start database via `docker compose up --build postgres-db`.
48+
2. Start service via `docker compose up --build <service-name>` for which you want to generate the schema.
49+
3. Navigate to service that you want to generate the schema for. Execute `./gradlew generateOpenApiDocs` in root
50+
directory of service. Alternatively, open `http://<endpoint>/v3/api-docs.yaml` in a browser and move the schema to
51+
the correct folder in the service.

client/.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
MENTORSHIP_SERVICE_PROD_URL=http://mentorship-

client/Dockerfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ RUN pnpm install --frozen-lockfile
1313

1414
COPY . .
1515

16+
ARG NODE_ENV=development
17+
ENV NODE_ENV=${NODE_ENV}
18+
1619
RUN pnpm run build
1720

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

2831
EXPOSE 3000
2932

33+
ARG NODE_ENV=development
34+
ENV NODE_ENV=${NODE_ENV}
35+
3036
CMD ["serve", "-s", "dist", "-l", "3000"]
3137

3238

client/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ The client is tested using E2E/UI tests. We use playwright as the framework for
3131
3. Run Tests: `pnpm exec playwright test`
3232
4. Show Report: `pnpm exec playwright show-report`
3333

34-
## Execute tests with UI
34+
### Execute tests with UI
3535

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

client/src/main.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,16 @@ declare module '@tanstack/react-router' {
2424
}
2525
}
2626

27+
if (process.env.NODE_ENV === 'production-kubernetes') {
28+
axios.defaults.baseURL =
29+
'https://mentor-pulse-devops25.student.k8s.aet.cit.tum.de';
30+
} else {
31+
axios.defaults.baseURL = 'http://localhost:80';
32+
}
33+
2734
axios.interceptors.request.use(
2835
(config) => {
36+
console.log('Base URL:', axios.defaults.baseURL);
2937
const token = localStorage.getItem('token');
3038
if (token) {
3139
const parsedToken = JSON.parse(token);

0 commit comments

Comments
 (0)