Skip to content

Commit fc1356e

Browse files
FlurinFlurin
Flurin
authored and
Flurin
committed
2 parents a045702 + a2d6d69 commit fc1356e

File tree

17 files changed

+203
-125
lines changed

17 files changed

+203
-125
lines changed

.github/workflows/azure-kubernetes-service.yml

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -23,30 +23,25 @@ jobs:
2323
- name: Checkout repository
2424
uses: actions/checkout@v3
2525

26-
- name: Azure login
27-
uses: azure/login@v1.4.6
28-
with:
29-
client-id: ${{ secrets.AZURE_CLIENT_ID }}
30-
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
31-
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
32-
33-
- name: Setup kubectl
34-
uses: azure/setup-kubectl@v2.0
26+
- name: Get Short Commit SHA
27+
run: |
28+
echo "COMMIT_SHA_SHORT=$(echo ${{ github.sha }} | cut -c1-7)"
29+
echo "COMMIT_SHA_SHORT=$(echo ${{ github.sha }} | cut -c1-7)" >> $GITHUB_ENV
3530
3631
- name: Build docker images
3732
run: |
3833
echo "Building images"
39-
docker build -t z100/soemi-woeb:0.0.1 ./soemi-woeb
40-
docker build -t z100/soemi-woers:0.0.1 ./soemi-woers
34+
docker build -t z100/soemi-woeb:${{ env.COMMIT_SHA_SHORT }} ./soemi-woeb
35+
docker build -t z100/soemi-woers:${{ env.COMMIT_SHA_SHORT }} ./soemi-woers
4136
4237
- name: Push docker images
4338
run: |
4439
echo "Login to dockerhub"
4540
docker login -u ${{ secrets.DOCKERHUB_U }} -p ${{ secrets.DOCKERHUB_T }}
4641
4742
echo "Pushing images"
48-
docker push z100/soemi-woeb:0.0.1
49-
docker push z100/soemi-woers:0.0.1
43+
docker push z100/soemi-woeb:${{ env.COMMIT_SHA_SHORT }}
44+
docker push z100/soemi-woers:${{ env.COMMIT_SHA_SHORT }}
5045
5146
deploy-services:
5247
permissions:
@@ -60,6 +55,16 @@ jobs:
6055
- name: Checkout repository
6156
uses: actions/checkout@v3
6257

58+
- name: Get Short Commit SHA
59+
run: |
60+
echo "COMMIT_SHA_SHORT=$(echo ${{ github.sha }} | cut -c1-7)"
61+
echo "COMMIT_SHA_SHORT=$(echo ${{ github.sha }} | cut -c1-7)" >> $GITHUB_ENV
62+
63+
- name: Populate deployment.yaml with vars
64+
run: |
65+
sed -i "s|\$IMAGE_TAG|${{ env.COMMIT_SHA_SHORT }}|g" ./soemi-woeb/k8s/deployment.yaml
66+
sed -i "s|\$IMAGE_TAG|${{ env.COMMIT_SHA_SHORT }}|g" ./soemi-woers/k8s/deployment.yaml
67+
6368
- name: Azure login
6469
uses: azure/login@v1.4.6
6570
with:
@@ -71,16 +76,15 @@ jobs:
7176
uses: azure/setup-kubectl@v2.0
7277

7378
- name: Set AKS credentials
74-
run: az aks get-credentials --resource-group ${{ secrets.RESOURCE_GROUP }} --name ${{ secrets.CLUSTER_NAME }} --overwrite-existing
79+
run: |
80+
az aks get-credentials --resource-group ${{ secrets.RESOURCE_GROUP }} --name ${{ secrets.CLUSTER_NAME }} --overwrite-existing
7581
7682
- name: Set kubectl context
77-
run: kubectl config use-context ${{ secrets.CLUSTER_NAME }}
83+
run: |
84+
kubectl config use-context ${{ secrets.CLUSTER_NAME }}
7885
7986
- name: Deploy microservices to AKS
8087
run: |
8188
echo "Deploying services"
82-
kubectl get pods
83-
kubectl delete -f ./soemi-woeb/k8s
84-
kubectl delete -f ./soemi-woers/k8s
85-
kubectl apply -f ./soemi-woeb/k8s
86-
kubectl apply -f ./soemi-woers/k8s
89+
kubectl replace --force -f ./soemi-woeb/k8s
90+
kubectl replace --force -f ./soemi-woers/k8s

README.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,19 @@
22

33
Camünda gold
44

5-
![](img/component-diagram.png)
5+
![Just don't use light mode](img/actual-component-diagram.svg)
66

7-
https://github.com/camunda/docker-camunda-bpm-platform \
8-
https://hub.docker.com/r/camunda/camunda-bpm-platform
7+
## Some words by the authors
8+
9+
So basically this entire project was a mistake.
10+
11+
### Some more words by the authors
12+
13+
Apart from that: It has (had depending on the time you're reading this) a fully functional AKS cluster in the Azure
14+
cloud (as implied by the name **A**zure **K**ubernetes **S**ervice...), a really fancy fully functional and perfect
15+
React web app (done in javascript obv.), a really nice and well planned and implemented ktor backend and [...] did we
16+
forget to mention anything?
17+
18+
> Oh, right. We did forget to mention something: This entire project is a dedicated joke on camunda, as we both very
19+
> much dislike it. So what better way to joke on a project we were forced to implement in camunda than to just make the
20+
> entire project _not_ about camunda at all! (Great humour and funny joke, we know).

img/actual-component-diagram.svg

Lines changed: 21 additions & 0 deletions
Loading
File renamed without changes.

soemi-woeb/k8s/deployment.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ spec:
1414
spec:
1515
containers:
1616
- name: soemi-woeb
17-
image: z100/soemi-woeb:0.0.1
17+
image: z100/soemi-woeb:$IMAGE_TAG
1818
ports:
1919
- containerPort: 3000

soemi-woeb/k8s/ingress.yaml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@ kind: Ingress
33
metadata:
44
name: soemi-woeb-ingress
55
annotations:
6-
ingressClassName: "k8s.io/ingress-nginx"
6+
kubernetes.io/ingress.class: "nginx"
7+
nginx.ingress.kubernetes.io/rewrite-target: /
78
spec:
89
rules:
9-
# - host: sömi-weather.ch
10-
- http:
10+
- host: xn--smi-weather-rfb.ch
11+
http:
1112
paths:
1213
- path: /
13-
pathType: Exact
14+
pathType: Prefix
1415
backend:
1516
service:
1617
name: soemi-woeb

soemi-woeb/k8s/service.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ metadata:
66
app: soemi-woeb
77
spec:
88
type: LoadBalancer
9+
selector:
10+
app: soemi-woeb
911
ports:
1012
- port: 3000
1113
targetPort: 3000
1214
protocol: TCP
1315
nodePort: 31000
14-
selector:
15-
app: soemi-woeb

soemi-woeb/public/index.html

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,22 @@
22
<html lang="en">
33
<head>
44
<meta charset="utf-8" />
5+
56
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
7+
68
<meta name="viewport" content="width=device-width, initial-scale=1" />
79
<meta name="theme-color" content="#000000" />
810
<meta
911
name="description"
1012
content="Ever wondered what star wars planet matches your current location by temperature?"
1113
/>
14+
1215
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
1316
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
1417

15-
<title>Best weather app ever <3</title>
18+
<title>Best weather app ever</title>
19+
20+
<script>let FF_FOUC_FIX;</script>
1621
</head>
1722
<body>
1823
<noscript>You need to enable JavaScript to run this app.</noscript>

soemi-woeb/src/App.js

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,10 @@ function App() {
66
const [planet, setPlanet] = useState(null)
77

88
const handleRestCall = () => {
9-
fetch(`https://soemi-woers:8089/soemi-woers/get-the-star-wars-planets-mapping-for-the-current-temperature-completely-and-utterly-accurate?temp=${location}`)
9+
fetch(`http://sömi-weather.ch/api/get-the-star-wars-planets-mapping-for-the-current-temperature-completely-and-utterly-accurate?temp=${location}`)
1010
.then((response) => response.json())
11-
.then((data) => {
12-
console.log(data);
13-
setPlanet(data)
14-
})
15-
.catch((error) => {
16-
console.error(error);
17-
});
11+
.then((data) => setPlanet(data))
12+
.catch((error) => console.error(error));
1813
};
1914

2015
return (
@@ -25,10 +20,21 @@ function App() {
2520
value={location}
2621
onChange={(e) => setLocation(e.target.value)}
2722
/>
28-
<button onClick={handleRestCall}>Get Weather</button>
29-
<p>Planet name: {planet?.name}</p>
23+
<button onClick={handleRestCall}>Search</button>
24+
{planet !== null ? <Planet planet={planet}/> : <p>Please search for a location.</p>}
3025
</div>
3126
);
3227
}
3328

29+
export function Planet({ planet }) {
30+
const {name, image} = planet
31+
32+
return (
33+
<>
34+
<h1>Name: {name}</h1>
35+
<img src={image} alt="Star Wars Planet"/>
36+
</>
37+
);
38+
}
39+
3440
export default App;

soemi-woers/build.gradle.kts

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,7 @@ val logback_version: String by project
55
plugins {
66
kotlin("jvm") version "1.9.21"
77
id("io.ktor.plugin") version "2.3.7"
8-
}
9-
10-
ktor {
11-
docker {
12-
localImageName.set("soemi-woers")
13-
imageTag.set("0.0.1")
14-
jreVersion.set(JavaVersion.VERSION_11)
15-
portMappings.set(listOf(
16-
io.ktor.plugin.features.DockerPortMapping(
17-
80,
18-
8089,
19-
io.ktor.plugin.features.DockerPortMappingProtocol.TCP
20-
)
21-
))
22-
}
8+
kotlin("plugin.serialization") version "1.5.31"
239
}
2410

2511
group = "ch.soemiweather"
@@ -37,5 +23,7 @@ dependencies {
3723
implementation("io.ktor:ktor-server-core-jvm")
3824
implementation("io.ktor:ktor-server-netty-jvm")
3925
implementation("ch.qos.logback:logback-classic:$logback_version")
26+
implementation("io.ktor:ktor-server-cors:$ktor_version")
27+
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.0")
4028
testImplementation("io.ktor:ktor-server-tests-jvm")
4129
}

soemi-woers/k8s/deployment.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@ kind: Deployment
33
metadata:
44
name: soemi-woers
55
spec:
6+
replicas: 1
67
selector:
78
matchLabels:
89
app: soemi-woers
9-
replicas: 1
1010
template:
1111
metadata:
1212
labels:
1313
app: soemi-woers
1414
spec:
1515
containers:
1616
- name: soemi-woers
17-
image: z100/soemi-woers:0.0.1
17+
image: z100/soemi-woers:$IMAGE_TAG
1818
ports:
1919
- containerPort: 8089
2020
livenessProbe:

soemi-woers/k8s/ingress.yaml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,14 @@ kind: Ingress
33
metadata:
44
name: soemi-woers-ingress
55
annotations:
6-
ingressClassName: "k8s.io/ingress-nginx"
6+
kubernetes.io/ingress.class: "nginx"
7+
nginx.ingress.kubernetes.io/rewrite-target: /$2
78
spec:
89
rules:
9-
- http:
10+
- host: xn--smi-weather-rfb.ch
11+
http:
1012
paths:
11-
- path: /api
13+
- path: /api(|$)(.*)
1214
pathType: Prefix
1315
backend:
1416
service:

soemi-woers/k8s/service.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@ metadata:
55
labels:
66
app: soemi-woers
77
spec:
8-
type: NodePort
8+
type: ClusterIP
99
selector:
1010
app: soemi-woers
1111
ports:
1212
- protocol: TCP
1313
port: 8089
14+
targetPort: 8089
1415
name: http

0 commit comments

Comments
 (0)