Skip to content

Commit 16ca4a3

Browse files
Merge branch 'refactor/ui-cleanup' of github.com:AET-DevOps25/team-devoops into feature/monitoring-with-best-practices
2 parents 74cadf1 + 1f032f8 commit 16ca4a3

44 files changed

Lines changed: 1561 additions & 1006 deletions

Some content is hidden

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

.github/workflows/cd_kubernetes.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ jobs:
2222
- name: Checkout
2323
uses: actions/checkout@v4
2424

25+
# Get current commit hash
26+
- name: Get Tag
27+
id: tag
28+
run: echo "SHORT_SHA=sha-$(git rev-parse --short HEAD)" >> $GITHUB_ENV
29+
2530
# Use Azure's kubectl installation action
2631
- name: Install Kubectl
2732
uses: azure/setup-kubectl@v4
@@ -43,4 +48,11 @@ jobs:
4348
# Run helm upgrade to upgrade deployment
4449
- name: Upgrade Deployment with Helm
4550
run: |
46-
helm upgrade --install meetatmensa ./deployment/k8s -n devoops
51+
helm upgrade --install meetatmensa ./deployment/k8s -n devoops \
52+
--set client.image.tag=${SHORT_SHA} \
53+
--set gateway.image.tag=${SHORT_SHA} \
54+
--set genai.image.tag=${SHORT_SHA} \
55+
--set matchdb.image.tag=${SHORT_SHA} \
56+
--set matching.image.tag=${SHORT_SHA} \
57+
--set user.image.tag=${SHORT_SHA} \
58+
--set userdb.image.tag=${SHORT_SHA}

.github/workflows/terraform-deploy.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
runs-on: ubuntu-latest
2222
environment:
2323
name: AWS
24-
url: "https://client.${{ steps.terraform.outputs.public_ip }}.nip.io"
24+
url: "https://client.${{ steps.terraform.outputs.public_ip }}.sslip.io"
2525

2626
steps:
2727
- name: Checkout Code
@@ -71,4 +71,4 @@ jobs:
7171
echo "=== Testing SSH Connection ==="
7272
ssh -i vockey.pem -o StrictHostKeyChecking=no ubuntu@${{ steps.terraform.outputs.public_ip }} "echo 'SSH connection successful'"
7373
echo "=== Running Ansible Playbook ==="
74-
ANSIBLE_HOST_KEY_CHECKING=False ANSIBLE_DEBUG=1 ansible-playbook -i inventory.yml playbooks/deploy.yml -vvv --extra-vars "ansible_host=${{ steps.terraform.outputs.public_ip }}" --start-at-task="Test connection"
74+
ANSIBLE_HOST_KEY_CHECKING=False ANSIBLE_DEBUG=1 ansible-playbook -i inventory.yml playbooks/deploy.yml -vvv --extra-vars "ansible_host=${{ steps.terraform.outputs.public_ip }} EC2_PUBLIC_IP=${{ steps.terraform.outputs.public_ip }}" --start-at-task="Test connection"

client/Dockerfile

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,22 @@ RUN npm install
1010
# Copy source code
1111
COPY . .
1212

13-
# Hardcode API URL for Docker deployment
14-
ENV VITE_API_BASE_URL=http://localhost:8080
13+
# Remove build-time VITE_API_BASE_URL and VITE_USE_MOCK_DATA
14+
# ARG VITE_API_BASE_URL=https://api.meetatmensa.com
15+
# ARG VITE_USE_MOCK_DATA=false
16+
# ENV VITE_API_BASE_URL=$VITE_API_BASE_URL
17+
# ENV VITE_USE_MOCK_DATA=$VITE_USE_MOCK_DATA
1518

1619
RUN npm run build
1720

1821
FROM nginx:alpine
1922

2023
COPY --from=build /app/dist /usr/share/nginx/html
24+
COPY public/config.template.js /usr/share/nginx/html/config.template.js
25+
COPY entrypoint.sh /entrypoint.sh
26+
RUN chmod +x /entrypoint.sh
2127

2228
EXPOSE 80
2329

30+
ENTRYPOINT ["/entrypoint.sh"]
2431
CMD ["nginx", "-g", "daemon off;"]

client/README.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ Then edit `.env.local` with your local settings:
2525

2626
```
2727
VITE_API_BASE_URL=http://localhost:8080
28+
VITE_USE_MOCK_DATA=false
2829
```
30+
If mock data usage is set to true, no requests will be sent to the Gateway.
2931

3032
### Docker Compose Deployment
3133

@@ -48,6 +50,41 @@ env:
4850
VITE_API_BASE_URL: 'http://gateway-service:80'
4951
```
5052

53+
### AWS Deployment
54+
55+
Environment variables are configured in `deployment/compose.aws.yml`
56+
57+
```yaml
58+
client:
59+
image: ghcr.io/aet-devops25/team-devoops/client:latest
60+
environment:
61+
- API_BASE_URL=https://api.${EC2_PUBLIC_IP}.nip.io
62+
```
63+
64+
---
65+
66+
## Local Deployment with Docker
67+
68+
```
69+
# Build and tag the Docker image
70+
docker build -t ghcr.io/aet-devops25/team-devoops/client .
71+
72+
# Push the image to GHCR (latest tag by default, access needed)
73+
docker push ghcr.io/aet-devops25/team-devoops/client
74+
75+
# Run the Docker container on port 80
76+
docker run --name client-service -p 80:80 ghcr.io/aet-devops25/team-devoops/client
77+
78+
# List running containers (if needed)
79+
docker ps
80+
81+
# Stop the container
82+
docker stop client-service
83+
84+
# Remove the container
85+
docker rm client-service
86+
```
87+
5188
## Build
5289
5390
```bash

client/entrypoint.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/sh
2+
set -e
3+
API_BASE_URL=${API_BASE_URL:-https://api.meetatmensa.com/api/v2}
4+
sed "s|__API_BASE_URL__|$API_BASE_URL|g" /usr/share/nginx/html/config.template.js > /usr/share/nginx/html/config.js
5+
exec "$@"

client/env.example

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
11
# API Configuration for local development
2-
VITE_API_BASE_URL=http://localhost:8082
3-
4-
# Auth0 Configuration (if needed)
5-
# VITE_AUTH0_DOMAIN=your-domain.auth0.com
6-
# VITE_AUTH0_CLIENT_ID=your-client-id
2+
VITE_API_BASE_URL=http://localhost:8080
3+
VITE_USE_MOCK_DATA=false

client/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
</head>
99
<body>
1010
<div id="root"></div>
11+
<script src="/config.js"></script>
1112
<script type="module" src="/src/main.tsx"></script>
1213
</body>
1314
</html>

client/public/config.template.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
window.RUNTIME_CONFIG = {
2+
API_BASE_URL: "__API_BASE_URL__"
3+
};

client/src/App.tsx

Lines changed: 73 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import MatchRequests from './components/MatchRequests';
77
import Matches from './components/Matches';
88
import { useAuth0 } from '@auth0/auth0-react';
99
import Profile from './components/Profile';
10+
import { UserIDProvider } from './contexts/UserIDContext';
1011

1112
interface AppProps {
1213
toggleColorMode: () => void;
@@ -40,79 +41,81 @@ const ProtectedRoute = ({ children }: { children: React.ReactNode }) => {
4041

4142
const App = ({ toggleColorMode, mode }: AppProps) => {
4243
return (
43-
<Router>
44-
<Routes>
45-
{/* Public routes */}
46-
<Route path="/login" element={<Login />} />
44+
<UserIDProvider>
45+
<Router>
46+
<Routes>
47+
{/* Public routes */}
48+
<Route path="/login" element={<Login />} />
4749

48-
{/* Protected routes - all require authentication */}
49-
<Route
50-
path="/"
51-
element={
52-
<ProtectedRoute>
53-
<Layout toggleColorMode={toggleColorMode} mode={mode}>
54-
<Dashboard />
55-
</Layout>
56-
</ProtectedRoute>
57-
}
58-
/>
59-
<Route
60-
path="/dashboard"
61-
element={
62-
<ProtectedRoute>
63-
<Layout toggleColorMode={toggleColorMode} mode={mode}>
64-
<Dashboard />
65-
</Layout>
66-
</ProtectedRoute>
67-
}
68-
/>
69-
<Route
70-
path="/preferences"
71-
element={
72-
<ProtectedRoute>
73-
<Layout toggleColorMode={toggleColorMode} mode={mode}>
74-
<MatchRequests />
75-
</Layout>
76-
</ProtectedRoute>
77-
}
78-
/>
79-
<Route
80-
path="/matches"
81-
element={
82-
<ProtectedRoute>
83-
<Layout toggleColorMode={toggleColorMode} mode={mode}>
84-
<Matches />
85-
</Layout>
86-
</ProtectedRoute>
87-
}
88-
/>
89-
<Route
90-
path="/profile"
91-
element={
92-
<ProtectedRoute>
93-
<Layout toggleColorMode={toggleColorMode} mode={mode}>
94-
<Profile />
95-
</Layout>
96-
</ProtectedRoute>
97-
}
98-
/>
50+
{/* Protected routes - all require authentication */}
51+
<Route
52+
path="/"
53+
element={
54+
<ProtectedRoute>
55+
<Layout toggleColorMode={toggleColorMode} mode={mode}>
56+
<Dashboard />
57+
</Layout>
58+
</ProtectedRoute>
59+
}
60+
/>
61+
<Route
62+
path="/dashboard"
63+
element={
64+
<ProtectedRoute>
65+
<Layout toggleColorMode={toggleColorMode} mode={mode}>
66+
<Dashboard />
67+
</Layout>
68+
</ProtectedRoute>
69+
}
70+
/>
71+
<Route
72+
path="/matchrequests"
73+
element={
74+
<ProtectedRoute>
75+
<Layout toggleColorMode={toggleColorMode} mode={mode}>
76+
<MatchRequests />
77+
</Layout>
78+
</ProtectedRoute>
79+
}
80+
/>
81+
<Route
82+
path="/matches"
83+
element={
84+
<ProtectedRoute>
85+
<Layout toggleColorMode={toggleColorMode} mode={mode}>
86+
<Matches />
87+
</Layout>
88+
</ProtectedRoute>
89+
}
90+
/>
91+
<Route
92+
path="/profile"
93+
element={
94+
<ProtectedRoute>
95+
<Layout toggleColorMode={toggleColorMode} mode={mode}>
96+
<Profile />
97+
</Layout>
98+
</ProtectedRoute>
99+
}
100+
/>
99101

100-
{/* Account settings route */}
101-
<Route
102-
path="/account"
103-
element={
104-
<ProtectedRoute>
105-
<Layout toggleColorMode={toggleColorMode} mode={mode}>
106-
<div>Account Settings (Coming Soon)</div>
107-
</Layout>
108-
</ProtectedRoute>
109-
}
110-
/>
102+
{/* Account settings route */}
103+
<Route
104+
path="/account"
105+
element={
106+
<ProtectedRoute>
107+
<Layout toggleColorMode={toggleColorMode} mode={mode}>
108+
<div>Account Settings (Coming Soon)</div>
109+
</Layout>
110+
</ProtectedRoute>
111+
}
112+
/>
111113

112-
{/* Catch all route */}
113-
<Route path="*" element={<Navigate to="/" replace />} />
114-
</Routes>
115-
</Router>
114+
{/* Catch all route */}
115+
<Route path="*" element={<Navigate to="/" replace />} />
116+
</Routes>
117+
</Router>
118+
</UserIDProvider>
116119
);
117120
};
118121

client/src/__tests__/utils/mocks.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ export const mockMatchRequest = {
44
userID: 'user1',
55
groupID: 'group1',
66
date: '2024-01-15',
7-
location: 'garching',
7+
location: 'GARCHING',
88
preferences: {
99
degreePref: true,
1010
agePref: false,
1111
genderPref: true,
1212
},
13-
timeslots: [9, 10, 11],
13+
timeslot: [9, 10, 11],
1414
status: 'PENDING' as const,
1515
};
1616

@@ -25,7 +25,7 @@ export const mockMatchRequests = [
2525
{
2626
...mockMatchRequest,
2727
requestID: '124',
28-
location: 'arcisstr',
28+
location: 'ARCISSTR',
2929
status: 'MATCHED' as const,
3030
},
3131
];

0 commit comments

Comments
 (0)