An Employee Management Application built with React.js, Node.js, and MySQL, deployed on Amazon EKS using Jenkins as the CI/CD tool.
This Employee Management Application helps organizations streamline employee-related tasks(create,update, delete and view), utilizing a tech stack of React.js for the front end, Node.js for the backend, and MySQL for data storage.
- React.js
- Node.js
- MySQL
The application is deployed on Amazon EKS (Elastic Kubernetes Service) using Jenkins for continuous integration and continuous deployment (CI/CD).
-
Version Control:
- The source code is hosted on GitHub.
-
CI/CD with Jenkins:
- Jenkins automates the CI/CD pipeline, fetching the latest code from GitHub, performing Docker builds, and deploying the application on Amazon EKS.
-
Static Code Analysis:
- SonarQube is used for static code analysis, ensuring code quality by identifying and fixing issues.
-
Docker Build:
- The application is containerized using Docker. Jenkins initiates Docker builds to create a Docker image.
-
Image Scan with Trivy:
- Trivy is employed to scan the Docker image for vulnerabilities, enhancing security.
-
Docker Image Push:
- The Docker image is pushed to Docker Hub, making it available for deployment and sharing.
-
Helm Package for Deployment:
- Helm is used to package the application for easier deployment and management on Kubernetes clusters.
-
Monitoring with Prometheus and Grafana:
- EKS is monitored using Prometheus and Grafana to provide insights into the performance and health of the application.
-
Clone the repository:
- git clone https://github.com/selvanayaki678/employee-portal-crud.git
- cd employee-portal-crud
-
Prerequisites
- Mysql instance
- Reactjs,Npm
- java,maven
- Docker
-
Mysql setup
- Install mysql
- Login to mysql using mysql -u root -h localhost --password
- Create Database --> create database employee_management_system;
-
Build a Java Docker image
- To configure MySQL endpoint(username, and password) in source code , Go to employee-portal-crud/springboot-backend/src/main/resources/application.properties file and add mysql endpoint url.
- Best practice is to keep these as environment variables rather than hardcoding.
- To build a docker image; cd employee-portal-crud/springboot-backend/;Run mvn clean install;docker build -t dockerimagename:version .
-
Build a react image
- To congifure java endpoint in react source code, go to react-frontend/src/services/EmployeeService.js file and add javaendpoint url
- Build docker image : cd react-frontend; docker build -t <reactjs_docker_image:version> .
-
Running containers
- docker run -dit --name react-app -p 3000:3000
- docker run -dir --name java-app -p 8080:8081
Note:Mysql needs to allow connections from java endpoint(ip)
- To allow connections from a specific IP address to the MySQL local instance, execute the following commands inside the MySQL database:
- CREATE USER 'root'@'ip_address' IDENTIFIED BY 'some_pass';
- GRANT ALL PRIVILEGES ON . TO 'root'@'ip_address';
- SELECT user,host from mysql.user;
-
Create EKS and RDS instance
- Use the following GitHub link to create instances in AWS: https://github.com/selvanayaki678/terraform-aws
-
Deploying Nginx ingress controller,Prometheus and sonarqube in EKS
- Refer this following Github link to deploy Nginx ingress controller,Prometheus and Kube state metrics helm chart and sonarqube in EKS: https://github.com/selvanayaki678/k8s-infra-helm-charts
-
Deploying React and Java application in EKS using Jenkins
- Configured all build and deploy (CI/CD)steps in jenkinsfile to deploy application into EKS
-
Monitoring EKS using Prometheus and Grafana
-
Configured Prometheus in EKS using Helm chart, without downloading Prometheus from the official website. Followed the steps provided in this link for setting up Prometheus: https://devopscube.com/setup-prometheus-monitoring-on-kubernetes/.
-
Prometheus targets include kube state metrics and cAdvisor.
Grafana: -
Installed Grafana on the local machine.
-
Configured the datasource as Prometheus.
-
Grafana dashboard: 13332 - kube state metrics.
Developed custom queries to obtain the count of pods, running pods, and failed pods in a specific namespace.\
-
-
To access application publicly using custom url
- In Route 53, created a DNS entry to associate our custom URL with the IP address of the Nginx Ingress controller.