diff --git a/GitOps/Jenkinsfile b/GitOps/Jenkinsfile
deleted file mode 100644
index 7828a675..00000000
--- a/GitOps/Jenkinsfile
+++ /dev/null
@@ -1,95 +0,0 @@
-@Library('Shared') _
-pipeline {
- agent any
-
- parameters {
- string(name: 'DOCKER_TAG', defaultValue: '', description: 'Docker tag of the image built by the CI job')
- }
-
- stages {
- stage("Workspace cleanup"){
- steps{
- script{
- cleanWs()
- }
- }
- }
-
- stage('Git: Code Checkout') {
- steps {
- script{
- code_checkout("https://github.com/LondheShubham153/Springboot-BankApp.git","DevOps")
- }
- }
- }
-
- stage('Verify: Docker Image Tags') {
- steps {
- script{
- echo "DOCKER TAG RECEIVED: ${params.DOCKER_TAG}"
- }
- }
- }
-
-
- stage("Update: Kubernetes manifest"){
- steps{
- script{
- dir('kubernetes'){
- sh """
- sed -i -e 's|trainwithshubham/bankapp-eks:.*|trainwithshubham/bankapp-eks:${params.DOCKER_TAG}|g' bankapp-deployment.yaml
- """
- }
- }
- }
- }
-
- stage("Git: Code update and push to GitHub"){
- steps{
- script{
- withCredentials([gitUsernamePassword(credentialsId: 'Github-cred', gitToolName: 'Default')]) {
- sh '''
- echo "Checking repository status: "
- git status
-
- echo "Adding changes to git: "
- git add .
-
- echo "Commiting changes: "
- git commit -m "Updated K8s Deployment Docker Image Version"
-
- echo "Pushing changes to github: "
- git push https://github.com/LondheShubham153/Springboot-BankApp.git DevOps
- '''
- }
- }
- }
- }
- }
- post {
- always {
- script {
- emailext attachLog: true,
- from: 'trainwithshubham@gmail.com',
- subject: "BankApp Application has been updated and deployed - '${currentBuild.result}'",
- body: """
-
-
-
-
Project: ${env.JOB_NAME}
-
-
-
Build Number: ${env.BUILD_NUMBER}
-
-
-
URL: ${env.BUILD_URL}
-
-
-
- """,
- to: 'trainwithshubham@gmail.com',
- mimeType: 'text/html'
- }
- }
- }
-}
diff --git a/docker-compose.yml b/docker-compose.yml
index 34642a09..6118979f 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -1,15 +1,18 @@
version: "3.8"
+
services:
- mysql:
+ mysql:
image: mysql:latest
container_name: mysql
+ ports:
+ - 3306:3306
environment:
- - MYSQL_ROOT_PASSWORD=Test@123
- - MYSQL_DATABASE=BankDB
+ MYSQL_ROOT_PASSWORD: "Test@123"
+ MYSQL_DATABASE: "BankDB"
+ networks:
+ - banknet
volumes:
- - bankapp-volume:/var/lib/mysql
- networks:
- - bankapp
+ - mysqlvol:/var/lib/mysql
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
interval: 10s
@@ -17,20 +20,20 @@ services:
retries: 3
start_period: 30s
- mainapp:
- image: ${DUSER}/${IMAGE}
- container_name: Bankapp
- environment:
- - SPRING_DATASOURCE_USERNAME=root
- - SPRING_DATASOURCE_URL=jdbc:mysql://mysql:3306/BankDB?useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=UTC
- - SPRING_DATASOURCE_PASSWORD=Test@123
+ bankapp:
+ container_name: bankapplication
+ image: sharmaaakash170/springboot-bank-app:latest
ports:
- "8080:8080"
+ environment:
+ - SPRING_DATASOURCE_USERNAME= "root"
+ - SPRING_DATASOURCE_URL= "jdbc:mysql://mysql:3306/BankDB?useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=UTC"
+ - SPRING_DATASOURCE_PASSWORD= "Test@123"
+ networks:
+ - banknet
depends_on:
mysql:
condition: service_healthy
- networks:
- - bankapp
restart: always
healthcheck:
test: ["CMD-SHELL", "curl -f http://localhost:8080/actuator/health || exit 1"]
@@ -40,7 +43,7 @@ services:
start_period: 30s
networks:
- bankapp:
+ banknet:
volumes:
- bankapp-volume:
\ No newline at end of file
+ mysqlvol:
diff --git a/helm/README.md b/helm/README.md
deleted file mode 100644
index 22814095..00000000
--- a/helm/README.md
+++ /dev/null
@@ -1,49 +0,0 @@
-# HELM
-
-## Installing Helm
-```bash
-curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
-chmod 700 get_helm.sh
-./get_helm.sh
-```
-**NOTE** This Helm chart assumes that you already have installed Ingress Cotroller, Metrics Server and VPA CRD
-
-
-- Ingress Controller
- ```bash
- helm upgrade --install ingress-nginx ingress-nginx \
- --repo https://kubernetes.github.io/ingress-nginx \
- --namespace ingress-nginx --create-namespace
- ```
-- Metrics Server for HPA
- ```bash
- helm repo add metrics-server https://kubernetes-sigs.github.io/metrics-server/
- helm upgrade --install metrics-server metrics-server/metrics-server
- ```
- ```bash
- kubectl edit deployments.apps metrics-server
- ## add these two enteries at: spec.template.spec.containers[0].args
- # - --kubelet-insecure-tls
- # - --kubelet-preferred-address-types=InternalIP,Hostname,ExternalIP
- ```
-- VPA Custom Resource definition (CRD).
- ```bash
- kubectl apply -f https://raw.githubusercontent.com/kubernetes/autoscaler/vpa-release-1.0/vertical-pod-autoscaler/deploy/vpa-v1-crd-gen.yaml
-
- kubectl apply -f https://raw.githubusercontent.com/kubernetes/autoscaler/vpa-release-1.0/vertical-pod-autoscaler/deploy/vpa-rbac.yaml
- ```
-
-## Run the SpringBoot Bankapp using helm
-Install Bankapp from helm chart.
-```bash
-helm install bankapp bankapp/
-```
-
-You can install it for multiple environments by changing values in `values.yaml` file
-```bash
-helm install bankapp-dev bankapp/ --set namespace=dev-namespace --set bankapp_svc.nodePort=30081
-```
-
-Happy Helming!
-
-
diff --git a/helm/bankapp/Chart.yaml b/helm/bankapp/Chart.yaml
deleted file mode 100644
index d8c225e2..00000000
--- a/helm/bankapp/Chart.yaml
+++ /dev/null
@@ -1,24 +0,0 @@
-apiVersion: v2
-name: bankapp
-description: A Helm chart for Kubernetes
-
-# A chart can be either an 'application' or a 'library' chart.
-#
-# Application charts are a collection of templates that can be packaged into versioned archives
-# to be deployed.
-#
-# Library charts provide useful utilities or functions for the chart developer. They're included as
-# a dependency of application charts to inject those utilities and functions into the rendering
-# pipeline. Library charts do not define any templates and therefore cannot be deployed.
-type: application
-
-# This is the chart version. This version number should be incremented each time you make changes
-# to the chart and its templates, including the app version.
-# Versions are expected to follow Semantic Versioning (https://semver.org/)
-version: 0.1.0
-
-# This is the version number of the application being deployed. This version number should be
-# incremented each time you make changes to the application. Versions are not expected to
-# follow Semantic Versioning. They should reflect the version the application is using.
-# It is recommended to use it with quotes.
-appVersion: "1.16.0"
\ No newline at end of file
diff --git a/helm/bankapp/templates/NOTES.txt b/helm/bankapp/templates/NOTES.txt
deleted file mode 100644
index 664d510d..00000000
--- a/helm/bankapp/templates/NOTES.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-
-Now you can access Bankapp using NodePort service.
-
-open browser and hit the URL: HTTP://:{{ default "30080" .Values.bankapp_svc.nodePort}}
-
-Additionally, you can configure Ingress for better traffic routing
diff --git a/helm/bankapp/templates/configMap.yml b/helm/bankapp/templates/configMap.yml
deleted file mode 100644
index 095e4de5..00000000
--- a/helm/bankapp/templates/configMap.yml
+++ /dev/null
@@ -1,10 +0,0 @@
-apiVersion: v1
-kind: ConfigMap
-metadata:
- name: {{ .Values.configmap.name }}
- namespace: {{ default "bankapp-namespace" .Values.namespace }}
-data:
- MYSQL_DATABASE: {{ .Values.configmap.data.MYSQL_DATABASE }}
- SPRING_DATASOURCE_URL: jdbc:mysql://{{ .Values.db_statefulset.name }}-0.{{ .Values.db_statefulset.name }}-headless.{{ default "bankapp-namespace" .Values.namespace }}.svc.cluster.local:3306/{{ .Values.configmap.data.MYSQL_DATABASE }}?useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=UTC
- SPRING_DATASOURCE_USERNAME: {{ .Values.configmap.data.SPRING_DATASOURCE_USERNAME }}
-
diff --git a/helm/bankapp/templates/deployment.yml b/helm/bankapp/templates/deployment.yml
deleted file mode 100644
index 9501ac23..00000000
--- a/helm/bankapp/templates/deployment.yml
+++ /dev/null
@@ -1,61 +0,0 @@
-apiVersion: apps/v1
-kind: Deployment
-metadata:
- name: {{ .Values.app_deployment.name }}
- namespace: {{ default "bankapp-namespace" .Values.namespace }}
- labels:
- app: {{ .Values.app_deployment.name }}
-spec:
- replicas: 1
- selector:
- matchLabels:
- app: {{ .Values.app_deployment.name }}
- template:
- metadata:
- labels:
- app: {{ .Values.app_deployment.name }}
- spec:
- initContainers:
- - name: "wait-for-{{ .Values.db_statefulset.name }}"
- image: busybox:1.28
- command: ['sh', '-c', 'until nc -z {{ .Values.db_statefulset.name }}-0.{{ .Values.db_statefulset.name }}-headless 3306; do echo waiting for mysql; sleep 5; done;']
- containers:
- - name: {{ .Values.app_deployment.name }}
- image: {{ .Values.image.app }}
- ports:
- - containerPort: 8080
- env:
- - name: SPRING_DATASOURCE_URL
- valueFrom:
- configMapKeyRef:
- name: {{ .Values.configmap.name }}
- key: SPRING_DATASOURCE_URL
- - name: SPRING_DATASOURCE_USERNAME
- valueFrom:
- configMapKeyRef:
- name: {{ .Values.configmap.name }}
- key: SPRING_DATASOURCE_USERNAME
- - name: SPRING_DATASOURCE_PASSWORD
- valueFrom:
- secretKeyRef:
- name: mysql-secret
- key: SPRING_DATASOURCE_PASSWORD
- livenessProbe:
- httpGet:
- path: /actuator/health
- port: 8080
- initialDelaySeconds: 30
- periodSeconds: 10
- readinessProbe:
- httpGet:
- path: /actuator/health
- port: 8080
- initialDelaySeconds: 10
- periodSeconds: 5
- resources:
- requests:
- memory: {{ .Values.app_deployment.mem_req}}
- cpu: {{ .Values.app_deployment.cpu_req}}
- limits:
- memory: {{ .Values.app_deployment.mem_limit}}
- cpu: {{ .Values.app_deployment.cpu_limit}}
diff --git a/helm/bankapp/templates/hpa.yaml b/helm/bankapp/templates/hpa.yaml
deleted file mode 100644
index 44eebe9c..00000000
--- a/helm/bankapp/templates/hpa.yaml
+++ /dev/null
@@ -1,19 +0,0 @@
-apiVersion: autoscaling/v2
-kind: HorizontalPodAutoscaler
-metadata:
- name: "{{ .Values.app_deployment.name }}-hpa"
- namespace: {{ default "bankapp-namespace" .Values.namespace }}
-spec:
- scaleTargetRef:
- apiVersion: apps/v1
- kind: Deployment
- name: {{ .Values.app_deployment.name }}
- minReplicas: {{ .Values.hpa.min_replica }}
- maxReplicas: {{ .Values.hpa.max_replica }}
- metrics:
- - type: Resource
- resource:
- name: cpu
- target:
- type: Utilization
- averageUtilization: {{ .Values.hpa.cpu_utilizatoion }} # Average % of CPU utilization
diff --git a/helm/bankapp/templates/ingress.yml b/helm/bankapp/templates/ingress.yml
deleted file mode 100644
index 305f0c22..00000000
--- a/helm/bankapp/templates/ingress.yml
+++ /dev/null
@@ -1,20 +0,0 @@
-apiVersion: networking.k8s.io/v1
-kind: Ingress
-metadata:
- name: "{{ .Values.app_deployment.name }}-ingress"
- namespace: {{ default "bankapp-namespace" .Values.namespace }}
- annotations:
- nginx.ingress.kubernetes.io/rewrite-target: /
-spec:
- rules:
- - host: bankapp.local # add
- http:
- paths:
- - path: /
- pathType: Prefix
- backend:
- service:
- name: "{{ .Values.app_deployment.name }}-service"
- port:
- number: {{ default "8080" .Values.bankapp_svc.port}}
-
diff --git a/helm/bankapp/templates/mysqlService.yml b/helm/bankapp/templates/mysqlService.yml
deleted file mode 100644
index ddb566b6..00000000
--- a/helm/bankapp/templates/mysqlService.yml
+++ /dev/null
@@ -1,15 +0,0 @@
-apiVersion: v1
-kind: Service
-metadata:
- name: "{{ .Values.db_statefulset.name }}-headless"
- namespace: {{ default "bankapp-namespace" .Values.namespace }}
- labels:
- app: {{ .Values.db_statefulset.name }}
-spec:
- clusterIP: None
- selector:
- app: {{ .Values.db_statefulset.name }}
- ports:
- - protocol: TCP
- port: {{ default "3306" .Values.mysql_svc.port}}
- targetPort: {{ default "3306" .Values.mysql_svc.targetPort}}
\ No newline at end of file
diff --git a/helm/bankapp/templates/mysqlStatefulSet.yml b/helm/bankapp/templates/mysqlStatefulSet.yml
deleted file mode 100644
index ad094aa3..00000000
--- a/helm/bankapp/templates/mysqlStatefulSet.yml
+++ /dev/null
@@ -1,67 +0,0 @@
-apiVersion: apps/v1
-kind: StatefulSet
-metadata:
- name: {{ .Values.db_statefulset.name }}
- namespace: {{ default "bankapp-namespace" .Values.namespace }}
- labels:
- app: {{ .Values.db_statefulset.name }}
-spec:
- serviceName: "{{ .Values.db_statefulset.name }}-headless"
- replicas: 1
- selector:
- matchLabels:
- app: {{ .Values.db_statefulset.name }}
- template:
- metadata:
- labels:
- app: {{ .Values.db_statefulset.name }}
- spec:
- containers:
- - name: {{ .Values.db_statefulset.name }}
- image: {{ .Values.image.db }}
- ports:
- - containerPort: 3306
- env:
- - name: MYSQL_ROOT_PASSWORD
- valueFrom:
- secretKeyRef: ### CRITICAL
- name: mysql-secret ### CRITICAL
- key: MYSQL_ROOT_PASSWORD ### CRITICAL
- - name: MYSQL_DATABASE
- valueFrom:
- configMapKeyRef:
- name: {{ .Values.configmap.name }}
- key: MYSQL_DATABASE
- volumeMounts:
- - name: "{{ .Values.db_statefulset.name }}-data"
- mountPath: /var/lib/mysql
- livenessProbe:
- exec:
- command:
- - mysqladmin
- - ping
- - -h
- - localhost
- initialDelaySeconds: 30
- periodSeconds: 10
- readinessProbe:
- exec:
- command:
- - mysqladmin
- - ping
- - -h
- - localhost
- initialDelaySeconds: 10
- periodSeconds: 5
- volumeClaimTemplates:
- - metadata:
- name: "{{ .Values.db_statefulset.name }}-data"
- labels:
- app: {{ .Values.db_statefulset.name }}
- spec:
- accessModes:
- - ReadWriteOnce
- resources:
- requests:
- storage: {{ .Values.db_statefulset.storage }}
-
diff --git a/helm/bankapp/templates/namespace.yml b/helm/bankapp/templates/namespace.yml
deleted file mode 100644
index fb9e98c3..00000000
--- a/helm/bankapp/templates/namespace.yml
+++ /dev/null
@@ -1,8 +0,0 @@
-apiVersion: v1
-kind: Namespace
-metadata:
- name: {{ default "bankapp-namespace" .Values.namespace }}
- labels:
- name: {{ default "bankapp-namespace" .Values.namespace }}
-
-
\ No newline at end of file
diff --git a/helm/bankapp/templates/persistentVolume.yml b/helm/bankapp/templates/persistentVolume.yml
deleted file mode 100644
index 6bd04068..00000000
--- a/helm/bankapp/templates/persistentVolume.yml
+++ /dev/null
@@ -1,16 +0,0 @@
-apiVersion: v1
-kind: PersistentVolume
-metadata:
- name: "{{ .Values.app_deployment.name }}-{{ default "bankapp-namespace" .Values.namespace }}-pv"
- namespace: {{ default "bankapp-namespace" .Values.namespace }}
- labels:
- app: {{ .Values.app_deployment.name }}
-spec:
- capacity:
- storage: {{ .Values.db_statefulset.storage }}
- accessModes:
- - ReadWriteOnce
- persistentVolumeReclaimPolicy: Retain
- storageClassName: manual
- hostPath:
- path: "/tmp/bankapp-mysql" # This will be stored on the host machine running KIND
diff --git a/helm/bankapp/templates/persistentVolumeClaim.yml b/helm/bankapp/templates/persistentVolumeClaim.yml
deleted file mode 100644
index 758c1e43..00000000
--- a/helm/bankapp/templates/persistentVolumeClaim.yml
+++ /dev/null
@@ -1,15 +0,0 @@
-apiVersion: v1
-kind: PersistentVolumeClaim
-metadata:
- name: "{{ .Values.app_deployment.name }}-pvc"
- namespace: {{ default "bankapp-namespace" .Values.namespace }}
- labels:
- app: {{ .Values.app_deployment.name }}
-spec:
- accessModes:
- - ReadWriteOnce
- resources:
- requests:
- storage: {{ .Values.db_statefulset.storage }}
- storageClassName: manual
-
diff --git a/helm/bankapp/templates/secrets.yml b/helm/bankapp/templates/secrets.yml
deleted file mode 100644
index bfec7735..00000000
--- a/helm/bankapp/templates/secrets.yml
+++ /dev/null
@@ -1,9 +0,0 @@
-apiVersion: v1
-kind: Secret
-metadata:
- name: {{ .Values.secret.name }}
- namespace: {{ default "bankapp-namespace" .Values.namespace }}
-type: Opaque
-data:
- MYSQL_ROOT_PASSWORD: {{ .Values.secret.data.MYSQL_ROOT_PASSWORD | b64enc | quote }}
- SPRING_DATASOURCE_PASSWORD: {{ .Values.secret.data.SPRING_DATASOURCE_PASSWORD | b64enc | quote }}
diff --git a/helm/bankapp/templates/service.yml b/helm/bankapp/templates/service.yml
deleted file mode 100644
index c1017852..00000000
--- a/helm/bankapp/templates/service.yml
+++ /dev/null
@@ -1,16 +0,0 @@
-apiVersion: v1
-kind: Service
-metadata:
- name: "{{ .Values.app_deployment.name }}-service"
- namespace: {{ default "bankapp-namespace" .Values.namespace }}
- labels:
- app: {{ .Values.app_deployment.name }}
-spec:
- type: NodePort
- selector:
- app: {{ .Values.app_deployment.name }}
- ports:
- - protocol: TCP
- port: {{ default "8080" .Values.bankapp_svc.port}}
- targetPort: {{ default "8080" .Values.bankapp_svc.targetPort}}
- nodePort: {{ default "30080" .Values.bankapp_svc.nodePort}} # Exposes the app on this port of the host
\ No newline at end of file
diff --git a/helm/bankapp/templates/vpa.yaml b/helm/bankapp/templates/vpa.yaml
deleted file mode 100644
index e838ba38..00000000
--- a/helm/bankapp/templates/vpa.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-apiVersion: autoscaling.k8s.io/v1
-kind: VerticalPodAutoscaler
-metadata:
- name: "{{ .Values.app_deployment.name }}-vpa"
- namespace: {{ default "bankapp-namespace" .Values.namespace }}
-spec:
- targetRef:
- apiVersion: apps/v1
- kind: Deployment
- name: {{ .Values.app_deployment.name }}
- updatePolicy:
- updateMode: "Auto" # Options: "Off", "Initial", "Auto"
\ No newline at end of file
diff --git a/helm/bankapp/values.yaml b/helm/bankapp/values.yaml
deleted file mode 100644
index 58cf8483..00000000
--- a/helm/bankapp/values.yaml
+++ /dev/null
@@ -1,54 +0,0 @@
-# namespace
-namespace: bankapp-namespace
-
-# name of configmap, database and db user.
-configmap:
- name: bankapp-config
- data:
- MYSQL_DATABASE: BankDB
- SPRING_DATASOURCE_USERNAME: root
-
-## name, label and storage size for database
-db_statefulset:
- name: mysql
- storage: 5Gi
-
-## name and label of app deployment
-app_deployment:
- name: bankapp
- cpu_req: 80m
- cpu_limit: 800m
- mem_req: 150Mi
- mem_limit: 700Mi
-
-## image repository and tag of app and db.
-image:
- app: trainwithshubham/springboot-bankapp:latest
- db: mysql:latest
-
-# NodePort svc for bankapp
-bankapp_svc:
- port: 8080
- targetPort: 8080
- nodePort: 30080
-
-
-# headless svc configuration for db
-mysql_svc:
- port: 3306
- targetPort: 3306
-
-# HPA minimun and maximum pods and average cpu utilization
-hpa:
- min_replica: 1
- max_replica: 5
- cpu_utilizatoion: 40
-
-# Secret for Database connectivity
-
-secret:
- name: mysql-secret
- data:
- MYSQL_ROOT_PASSWORD: Test@123 # (Base64 encoded 'Test@123')
- SPRING_DATASOURCE_PASSWORD: Test@123 # (Base64 encoded 'Test@123')
-
diff --git a/kubernetes/README.md b/kubernetes/README.md
deleted file mode 100644
index 4db1d8b8..00000000
--- a/kubernetes/README.md
+++ /dev/null
@@ -1,245 +0,0 @@
-# End-to-End Setup for Deploying Applications with ArgoCD and EKS
-
-This README provides a complete step-by-step guide with all the commands required to set up ArgoCD on an AWS EKS cluster, deploy your applications, and configure GitOps.
-
----
-
-## **1. Create an EKS Cluster**
-
-### **Create the Cluster Without a Node Group**
-```bash
-eksctl create cluster --name=bankapp \
- --region=ap-south-1 \
- --version=1.31 \
- --without-nodegroup
-```
-
-### **Associate IAM OIDC Provider**
-```bash
-eksctl utils associate-iam-oidc-provider \
- --region ap-south-1 \
- --cluster bankapp \
- --approve
-```
-
-### **Create a Node Group**
-```bash
-eksctl create nodegroup --cluster=bankapp \
- --region=ap-south-1 \
- --name=bankapp \
- --node-type=t2.medium \
- --nodes=2 \
- --nodes-min=2 \
- --nodes-max=2 \
- --node-volume-size=29 \
- --ssh-access \
- --ssh-public-key=k8s-in-one-shot
-```
-
----
-
-## **2. Deploy ArgoCD**
-
-### **Create the ArgoCD Namespace**
-```bash
-kubectl create namespace argocd
-```
-
-### **Install ArgoCD Using Official Manifests**
-```bash
-kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
-```
-
-### **Verify ArgoCD Pods**
-```bash
-watch kubectl get pods -n argocd
-```
-
-### **Install ArgoCD CLI**
-```bash
-curl --silent --location -o /usr/local/bin/argocd https://github.com/argoproj/argo-cd/releases/download/v2.4.7/argocd-linux-amd64
-chmod +x /usr/local/bin/argocd
-argocd version
-```
-
-### **Change ArgoCD Server Service Type to NodePort**
-```bash
-kubectl patch svc argocd-server -n argocd -p '{"spec": {"type": "NodePort"}}'
-```
-
-### **Verify the NodePort Service**
-```bash
-kubectl get svc -n argocd
-```
-
-### **Expose the Port on Security Groups**
-- In the AWS Console, update the security group for your EKS worker nodes to allow inbound traffic on the NodePort assigned to the `argocd-server` service.
-
-### **Access the ArgoCD Web UI**
-- Open your browser and navigate to:
- ```
- http://:
- ```
-
----
-
-## **3. Configure ArgoCD for EKS**
-
-### **Login to ArgoCD Using CLI**
-```bash
-argocd login : --username admin
-```
-
-### **Retrieve the Default Admin Password**
-```bash
-kubectl get secret argocd-initial-admin-secret -n argocd -o jsonpath="{.data.password}" | base64 -d
-```
-
-### **Check Available Clusters in ArgoCD**
-```bash
-argocd cluster list
-```
-
-### **Get the EKS Cluster Context**
-```bash
-kubectl config get-contexts
-```
-
-### **Add EKS Cluster to ArgoCD**
-```bash
-argocd cluster add --name bankapp-eks-cluster
-```
-- Replace `` with your EKS cluster context name (e.g., `Madhup@bankapp.us-west-1.eksctl.io`).
-
----
-
-## **4. Deploy Applications Using ArgoCD**
-
-### **Prepare Kubernetes Manifests in a Git Repository**
-- Organize your manifests (e.g., `namespace.yaml`, `deployment.yaml`, `service.yaml`) in a Git repository.
-
-### **Create an Application in ArgoCD**
-```bash
-argocd app create bankapp \
- --repo \
- --path \
- --dest-server https://kubernetes.default.svc \
- --dest-namespace bankapp-namespace
-```
-
-### **Sync the Application**
-```bash
-argocd app sync bankapp
-```
-
-### **Monitor Application Status**
-```bash
-argocd app list
-```
-
----
-
-## **5. Deploy NGINX Ingress Controller**
-
-### **Install NGINX Ingress Controller Using Helm**
-```bash
-helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
-helm repo update
-helm install ingress-nginx ingress-nginx/ingress-nginx \
- --namespace ingress-nginx --create-namespace
-```
-
-### **Verify Installation**
-Check if the NGINX Ingress Controller pods are running:
-```bash
-kubectl get pods -n ingress-nginx
-```
-
-### **Retrieve the Load Balancer IP**
-Get the external IP assigned to the NGINX Ingress Controller:
-```bash
-kubectl get svc -n ingress-nginx
-```
-
-### **Update DNS**
-Point your domain (`junoon.trainwithshubham.com`) to the external IP of the NGINX Load Balancer.
-
----
-
-## **6. Enable HTTPS for the Application**
-
-### **Install Cert-Manager**
-```bash
-kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.13.1/cert-manager.yaml
-```
-
-### **Create Let's Encrypt ClusterIssuer**
-Save the following as `letsencrypt-clusterissuer.yaml`:
-```yaml
-apiVersion: cert-manager.io/v1
-kind: ClusterIssuer
-metadata:
- name: letsencrypt-prod
-spec:
- acme:
- server: https://acme-v02.api.letsencrypt.org/directory
- email: your-email@example.com
- privateKeySecretRef:
- name: letsencrypt-prod-key
- solvers:
- - http01:
- ingress:
- class: nginx
-```
-Apply the ClusterIssuer:
-```bash
-kubectl apply -f letsencrypt-clusterissuer.yaml
-```
-
-### **Update Ingress with TLS Configuration**
-- Modify your Ingress to include TLS and reference the `letsencrypt-prod` ClusterIssuer.
-- Apply the updated Ingress:
-```bash
-kubectl apply -f
-```
-
-### **Verify Certificate Issuance**
-```bash
-kubectl get certificate -n bankapp-namespace
-```
-
----
-
-## **7. Verify Deployment**
-
-### **Check Deployed Resources**
-```bash
-kubectl get all -n bankapp-namespace
-```
-
-### **Access the Application**
-- Open your browser and navigate to:
- ```
- https://junoon.trainwithshubham.com
- ```
-
----
-
-## **8. Add Autoscaling**
-
-### **Install the Metrics Server**
-```bash
-kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml
-```
-
-### **Get the Top Nodes and Pods**
-```bash
- kubectl top nodes
- kubectl top pods -n bankapp-namespace
-```
-### **Apply HPA**
-```bash
- kubectl apply -f bankapp-hpa.yml
-```
----
-
diff --git a/kubernetes/bankapp-deployment.yml b/kubernetes/bankapp-deployment.yml
deleted file mode 100644
index 45a35b6f..00000000
--- a/kubernetes/bankapp-deployment.yml
+++ /dev/null
@@ -1,63 +0,0 @@
-apiVersion: apps/v1
-kind: Deployment
-metadata:
- labels:
- app: bankapp-deploy
- name: bankapp-deploy
- namespace: bankapp-namespace
-spec:
- replicas: 2 # Keep replicas >= 2 for high availability
- selector:
- matchLabels:
- app: bankapp-deploy
- template:
- metadata:
- labels:
- app: bankapp-deploy
- spec:
- containers:
- - name: bankapp
- image: trainwithshubham/bankapp-eks:v2
- ports:
- - containerPort: 8080
- env:
- - name: SPRING_DATASOURCE_URL
- valueFrom:
- configMapKeyRef:
- name: bankapp-config
- key: SPRING_DATASOURCE_URL
- - name: SPRING_DATASOURCE_USERNAME
- valueFrom:
- configMapKeyRef:
- name: bankapp-config
- key: SPRING_DATASOURCE_USERNAME
- - name: MYSQL_DATABASE
- valueFrom:
- configMapKeyRef:
- name: bankapp-config
- key: MYSQL_DATABASE
- - name: SPRING_DATASOURCE_PASSWORD
- valueFrom:
- secretKeyRef:
- name: mysql-secret
- key: SPRING_DATASOURCE_PASSWORD
- # readinessProbe:
- # httpGet:
- # path: /actuator/health # Update this based on your app's health endpoint
- # port: 8080
- # initialDelaySeconds: 10
- # periodSeconds: 5
- # livenessProbe:
- # httpGet:
- # path: /actuator/health # Update this based on your app's health endpoint
- # port: 8080
- # initialDelaySeconds: 30
- # periodSeconds: 10
- resources:
- requests:
- memory: "512Mi"
- cpu: "250m"
- limits:
- memory: "1Gi"
- cpu: "500m"
-
diff --git a/kubernetes/bankapp-hpa.yml b/kubernetes/bankapp-hpa.yml
deleted file mode 100644
index 6c030161..00000000
--- a/kubernetes/bankapp-hpa.yml
+++ /dev/null
@@ -1,19 +0,0 @@
-apiVersion: autoscaling/v2
-kind: HorizontalPodAutoscaler
-metadata:
- name: bankapp-hpa
- namespace: bankapp-namespace
-spec:
- scaleTargetRef:
- apiVersion: apps/v1
- kind: Deployment
- name: bankapp-deploy
- minReplicas: 1
- maxReplicas: 5
- metrics:
- - type: Resource
- resource:
- name: cpu
- target:
- type: Utilization
- averageUtilization: 40
diff --git a/kubernetes/bankapp-ingress.yml b/kubernetes/bankapp-ingress.yml
deleted file mode 100644
index e1b8f06e..00000000
--- a/kubernetes/bankapp-ingress.yml
+++ /dev/null
@@ -1,28 +0,0 @@
-apiVersion: networking.k8s.io/v1
-kind: Ingress
-metadata:
- name: bankapp-ingress
- namespace: bankapp-namespace
- annotations:
- nginx.ingress.kubernetes.io/rewrite-target: /
- nginx.ingress.kubernetes.io/proxy-body-size: "50m"
- nginx.ingress.kubernetes.io/ssl-redirect: "true" # Force HTTPS
- cert-manager.io/cluster-issuer: letsencrypt-prod # Use Let's Encrypt
-spec:
- ingressClassName: nginx
- tls:
- - hosts:
- - megaproject.trainwithshubham.com
- secretName: bankapp-tls-secret # Cert-Manager will manage this
- rules:
- - host: megaproject.trainwithshubham.com
- http:
- paths:
- - path: /
- pathType: Prefix
- backend:
- service:
- name: bankapp-service
- port:
- number: 8080
-
diff --git a/kubernetes/bankapp-namespace.yaml b/kubernetes/bankapp-namespace.yaml
deleted file mode 100644
index 3a4a5170..00000000
--- a/kubernetes/bankapp-namespace.yaml
+++ /dev/null
@@ -1,6 +0,0 @@
-apiVersion: v1
-kind: Namespace
-metadata:
- name: bankapp-namespace
- labels:
- name: bankapp-namespace
diff --git a/kubernetes/bankapp-service.yaml b/kubernetes/bankapp-service.yaml
deleted file mode 100644
index c63175da..00000000
--- a/kubernetes/bankapp-service.yaml
+++ /dev/null
@@ -1,15 +0,0 @@
-apiVersion: v1
-kind: Service
-metadata:
- name: bankapp-service
- namespace: bankapp-namespace
- labels:
- app: bankapp
-spec:
- selector:
- app: bankapp-deploy
- ports:
- - protocol: TCP
- port: 8080
- targetPort: 8080
-
diff --git a/kubernetes/configmap.yaml b/kubernetes/configmap.yaml
deleted file mode 100644
index f2acc025..00000000
--- a/kubernetes/configmap.yaml
+++ /dev/null
@@ -1,9 +0,0 @@
-apiVersion: v1
-kind: ConfigMap
-metadata:
- name: bankapp-config
- namespace: bankapp-namespace
-data:
- MYSQL_DATABASE: BankDB
- SPRING_DATASOURCE_URL: jdbc:mysql://mysql-svc.bankapp-namespace.svc.cluster.local:3306/BankDB?useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=UTC
- SPRING_DATASOURCE_USERNAME: root
diff --git a/kubernetes/letsencrypt-clusterissuer.yaml b/kubernetes/letsencrypt-clusterissuer.yaml
deleted file mode 100644
index 959db1b9..00000000
--- a/kubernetes/letsencrypt-clusterissuer.yaml
+++ /dev/null
@@ -1,15 +0,0 @@
-apiVersion: cert-manager.io/v1
-kind: ClusterIssuer
-metadata:
- name: letsencrypt-prod
-spec:
- acme:
- server: https://acme-v02.api.letsencrypt.org/directory
- email: trainwithshubham@gmail.com
- privateKeySecretRef:
- name: letsencrypt-prod-key
- solvers:
- - http01:
- ingress:
- class: nginx
-
diff --git a/kubernetes/mysql-deployment.yml b/kubernetes/mysql-deployment.yml
deleted file mode 100644
index c9baa53a..00000000
--- a/kubernetes/mysql-deployment.yml
+++ /dev/null
@@ -1,42 +0,0 @@
-apiVersion: apps/v1
-kind: Deployment
-metadata:
- name: mysql
- namespace: bankapp-namespace
- labels:
- app: mysql
-spec:
- replicas: 1
- selector:
- matchLabels:
- app: mysql
- template:
- metadata:
- labels:
- app: mysql
- spec:
- containers:
- - name: mysql
- image: mysql:8.0 # Use a specific, stable version for production
- ports:
- - containerPort: 3306
- env:
- - name: MYSQL_ROOT_PASSWORD
- valueFrom:
- secretKeyRef:
- name: mysql-secret
- key: MYSQL_ROOT_PASSWORD
- - name: MYSQL_DATABASE
- valueFrom:
- configMapKeyRef:
- name: bankapp-config
- key: MYSQL_DATABASE
- volumeMounts:
- - name: mysql-pv-storage
- mountPath: /var/lib/mysql
- subPath: mysql-data # Optional: Ensure a subdirectory is used for better volume organization
- volumes:
- - name: mysql-pv-storage
- persistentVolumeClaim:
- claimName: mysql-pvc
-
diff --git a/kubernetes/mysql-service.yaml b/kubernetes/mysql-service.yaml
deleted file mode 100644
index 607a8ef2..00000000
--- a/kubernetes/mysql-service.yaml
+++ /dev/null
@@ -1,14 +0,0 @@
-apiVersion: v1
-kind: Service
-metadata:
- name: mysql-svc
- namespace: bankapp-namespace
- labels:
- app: mysql
-spec:
- selector:
- app: mysql
- ports:
- - protocol: TCP
- port: 3306
- targetPort: 3306
diff --git a/kubernetes/persistent-volume-claim.yaml b/kubernetes/persistent-volume-claim.yaml
deleted file mode 100644
index ff23dbd1..00000000
--- a/kubernetes/persistent-volume-claim.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-apiVersion: v1
-kind: PersistentVolumeClaim
-metadata:
- name: mysql-pvc
- namespace: bankapp-namespace
-spec:
- accessModes:
- - ReadWriteOnce
- resources:
- requests:
- storage: 10Gi
- storageClassName: standard
diff --git a/kubernetes/persistent-volume.yaml b/kubernetes/persistent-volume.yaml
deleted file mode 100644
index efbda4d3..00000000
--- a/kubernetes/persistent-volume.yaml
+++ /dev/null
@@ -1,16 +0,0 @@
-apiVersion: v1
-kind: PersistentVolume
-metadata:
- name: mysql-pv
- namespace: bankapp-namespace
-spec:
- capacity:
- storage: 10Gi
- volumeMode: Filesystem
- accessModes:
- - ReadWriteOnce
- persistentVolumeReclaimPolicy: Retain # Keeps the PV after the PVC is deleted
- storageClassName: standard # Make sure this matches your cluster's default storage class
- hostPath:
- path: /mnt/data/mysql
- type: DirectoryOrCreate
diff --git a/kubernetes/secrets.yaml b/kubernetes/secrets.yaml
deleted file mode 100644
index c6596fdb..00000000
--- a/kubernetes/secrets.yaml
+++ /dev/null
@@ -1,10 +0,0 @@
-apiVersion: v1
-kind: Secret
-metadata:
- name: mysql-secret
- namespace: bankapp-namespace
-type: Opaque
-data:
- MYSQL_ROOT_PASSWORD: VGVzdEAxMjM= # Base64 for "Test@123"
- SPRING_DATASOURCE_PASSWORD: VGVzdEAxMjM= # Base64 for "Test@123"
-
diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties
index 08663a63..5852360b 100644
--- a/src/main/resources/application.properties
+++ b/src/main/resources/application.properties
@@ -6,6 +6,8 @@ spring.datasource.password=Test@123
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
# JPA & Hibernate configuration
-spring.jpa.hibernate.ddl-auto=update
+spring.jpa.properties.hibernate.boot.allow_jdbc_metadata_access=false
+spring.jpa.hibernate.ddl-auto=none
+spring.sql.init.mode=never
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL8Dialect
spring.jpa.show-sql=true