Skip to content
Snippets Groups Projects
Commit 583a662f authored by Abdullah Kiran's avatar Abdullah Kiran
Browse files

too much shit

parent ae697b29
No related branches found
No related tags found
No related merge requests found
......@@ -15,5 +15,15 @@ COPY . .
RUN npm run build
# stage 2: move static frontend stuff to caddys root folder to make caddy serve our frontend instead of spring
FROM caddy:alpine
COPY --from=build-frontend /app/dist /usr/share/caddy
\ No newline at end of file
FROM node:20-alpine
WORKDIR /app
RUN npm install -g http-server
COPY --from=build-frontend /app/dist /app
EXPOSE 80
# einfacher http-server
CMD ["http-server", "/app", "-p", "80"]
\ No newline at end of file
......@@ -14,7 +14,8 @@ spec:
spec:
containers:
- name: backend-container
image: backend-image
image: backend-image:latest
imagePullPolicy: IfNotPresent
ports:
- containerPort: 9876
env:
......@@ -23,7 +24,7 @@ spec:
- name: MONGO_PASSWORD
value: tododbadminpassword
- name: MONGO_HOST
value: mongodb-servicevice in Kubernetes.
value: mongodb-service
- name: MONGO_PORT
value: "27017"
- name: MONGO_DB
......
apiVersion: apps/v1
kind: Deployment
metadata:
name: caddy-deployment
spec:
replicas: 1
selector:
matchLabels:
app: caddy-server
template:
metadata:
labels:
app: caddy-server
spec:
containers:
- name: caddy-container
image: caddy:alpine
ports:
- containerPort: 80
volumeMounts:
- mountPath: /usr/share/caddy
name: frontend-files
- mountPath: /etc/caddy/Caddyfile
subPath: Caddyfile
name: caddy-config
volumes:
- name: frontend-files
persistentVolumeClaim:
claimName: caddy-pvc
- name: caddy-config
configMap:
name: caddy-config
---
apiVersion: v1
kind: ConfigMap
metadata:
name: caddy-config
data:
Caddyfile: |
:80 {
root * /usr/share/caddy
file_server
reverse_proxy /user* backend-service:9876 {
health_uri /health
health_interval 10s
health_timeout 1s
}
}
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: caddy-pvc
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
---
apiVersion: v1
kind: Service
metadata:
name: caddy-service
spec:
selector:
app: caddy-server
ports:
- protocol: TCP
port: 80
targetPort: 80
type: LoadBalancer
apiVersion: apps/v1
kind: Deployment
metadata:
name: frontend-deployment
spec:
replicas: 1
selector:
matchLabels:
app: frontend
template:
metadata:
labels:
app: frontend
spec:
containers:
- name: frontend-container
image: frontend-image
imagePullPolicy: IfNotPresent # ohne diesen wert versucht minikube wieso auch immer images von dockerhub zu ziehen
ports:
- containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
name: frontend-service
spec:
selector:
app: frontend
ports:
- protocol: TCP
port: 80
targetPort: 80
type: LoadBalancer
apiVersion: v1
kind: PersistentVolume
metadata:
name: mongo-pv
spec:
capacity:
storage: 1Gi
accessModes:
- ReadWriteOnce
hostPath:
path: /data/mongo
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: mongo-pvc
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
......@@ -13,11 +13,12 @@ import java.util.List;
/*
* 1. eval $(minikube docker-env) (docker-befehle werden dadurch in minikube ausgeführt) |
* windows: Invoke-Expression (minikube docker-env) // minikube muss dafür laufen auf windows, also erst 2. dann 1.
* windows: & minikube -p minikube docker-env --shell powershell | Invoke-Expression
* minikube muss dafür laufen auf windows, also erst 2. dann 1.
* 2. minikube starten
* 3. docker build -t <name> (einmal für jedes dockerfile um images zu erstellen)
* 4.
* 4. lokale images in minikube laden mit minikube image load <name>
* 5. .yaml dateien mit kubectl apply -f <pfad-zur-yaml-datei>
*/
@RestController
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment