From bf2f8cdeea1e04a93f13b067da320b18b7dffe2d Mon Sep 17 00:00:00 2001 From: Michael O'Brien Date: Sat, 14 Jun 2025 19:10:27 -0400 Subject: [PATCH] #34 - add biometric-nbi spring boot kubernetes yaml --- README.md | 3 ++ .../biometric-nbi-springboot-deployment.yaml | 28 +++++++++++++++++++ .../biometric-nbi-springboot-service.yaml | 15 ++++++++++ biometric-nbi/src/kubernetes/deploy.sh | 5 ++++ biometric-nbi/src/kubernetes/undeploy.sh | 2 ++ 5 files changed, 53 insertions(+) create mode 100644 biometric-nbi/src/kubernetes/biometric-nbi-springboot-deployment.yaml create mode 100644 biometric-nbi/src/kubernetes/biometric-nbi-springboot-service.yaml diff --git a/README.md b/README.md index d735ba9..b61d73c 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,9 @@ Biometric Backend #### Helm #### Kubernetes see https://github.com/ObrienlabsDev/biometric-backend/tree/main/biometric-nbi/src/kubernetes + +The following script runs both the mysql and biometric-nbi springboot containers + ``` kubernetes % ./deploy.sh (venv-t214) michaelobrien@mbp8 kubernetes % kubectl get pods -n mysql diff --git a/biometric-nbi/src/kubernetes/biometric-nbi-springboot-deployment.yaml b/biometric-nbi/src/kubernetes/biometric-nbi-springboot-deployment.yaml new file mode 100644 index 0000000..1b6d95c --- /dev/null +++ b/biometric-nbi/src/kubernetes/biometric-nbi-springboot-deployment.yaml @@ -0,0 +1,28 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: biometric-nbi + labels: + app: biometric-nbi +spec: + replicas: 1 + selector: + matchLabels: + app: biometric-nbi + template: + metadata: + labels: + app: biometric-nbi + spec: + containers: + - name: biometric-nbi + image: obrienlabs/biometric-nbi:latest + ports: + - containerPort: 8080 + env: + - name: SPRING_DATASOURCE_URL + value: jdbc:mysql://mysql.mysql.svc.cluster.local:3306/biometric + - name: SPRING_DATASOURCE_USERNAME + value: root + - name: SPRING_DATASOURCE_PASSWORD + value: password \ No newline at end of file diff --git a/biometric-nbi/src/kubernetes/biometric-nbi-springboot-service.yaml b/biometric-nbi/src/kubernetes/biometric-nbi-springboot-service.yaml new file mode 100644 index 0000000..0940f24 --- /dev/null +++ b/biometric-nbi/src/kubernetes/biometric-nbi-springboot-service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: biometric-nbi + labels: + app: biometric-nbi +spec: + type: NodePort + selector: + app: biometric-nbi + ports: + - protocol: TCP + port: 8080 + targetPort: 8080 + nodePort: 30888 \ No newline at end of file diff --git a/biometric-nbi/src/kubernetes/deploy.sh b/biometric-nbi/src/kubernetes/deploy.sh index 8da57a6..40d61d2 100755 --- a/biometric-nbi/src/kubernetes/deploy.sh +++ b/biometric-nbi/src/kubernetes/deploy.sh @@ -5,6 +5,11 @@ kubectl apply -f mysql-storage.yaml kubectl apply -f mysql-secret.yaml kubectl apply -f mysql-deployment.yaml kubectl apply -f mysql-service.yaml +# job to create and populated the database +kubectl apply -f biometric-nbi-springboot-deployment.yaml +kubectl apply -f biometric-nbi-springboot-service.yaml + + #kubectl get namespaces diff --git a/biometric-nbi/src/kubernetes/undeploy.sh b/biometric-nbi/src/kubernetes/undeploy.sh index c31ea53..e321dc4 100755 --- a/biometric-nbi/src/kubernetes/undeploy.sh +++ b/biometric-nbi/src/kubernetes/undeploy.sh @@ -1,5 +1,7 @@ #!/bin/bash +kubectl delete -f biometric-nbi-springboot-service.yaml +kubectl delete -f biometric-nbi-springboot-deployment.yaml kubectl delete -f mysql-service.yaml kubectl delete -f mysql-deployment.yaml kubectl delete -f mysql-secret.yaml