Skip to content

Mayurhatte09/WebCal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

13 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

WebCal DevOps Project

A production-ready Java web calculator application demonstrating real-world DevOps practices, including CI/CD with Jenkins, Docker containerization, and Kubernetes orchestration.

Table of Contents


Introduction

This project is a Java Servlet + JSP calculator application, containerized with Docker, deployed on Kubernetes with ClusterIP + Ingress, and automated via Jenkins CI/CD pipeline. It demonstrates full DevOps best practices including automated deployments, rollback on failures, and namespace isolation.


Features

  • Simple web-based calculator (addition, subtraction, multiplication, division)
  • Dockerized Java application
  • Kubernetes deployment with ClusterIP Service and Ingress
  • CI/CD pipeline with Jenkins
  • Fully namespaced Kubernetes resources
  • Automatic image tagging using Git commit hash
  • Rollback support on failed deployments

Screenshot

alt text alt text

Tech Stack

  • Backend: Java Servlets + JSP
  • Build Tool: Maven
  • Containerization: Docker
  • Orchestration: Kubernetes (ClusterIP + Ingress)
  • CI/CD: Jenkins
  • Registry: Docker Hub (mayrhatte09)

Architecture Overview


User β†’ Browser
↓
Ingress (NGINX)
↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ WebCal App  β”‚
β”‚ Java Servletβ”‚
β””β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜
↓
Kubernetes Cluster
(Namespace: k8s)
↓
Docker Containers

CI/CD Flow:


GitHub β†’ Jenkins β†’ Docker β†’ Docker Hub β†’ Kubernetes (EKS/Minikube)


Project Structure


webcal-project/
β”œβ”€β”€ Jenkinsfile
β”œβ”€β”€ dockerfile
β”œβ”€β”€ pom.xml
└── kubernetes/
β”œβ”€β”€ namespace.yaml
β”œβ”€β”€ deployment.yaml
β”œβ”€β”€ service.yaml
└── ingress.yaml
└── src/
└── main/
β”œβ”€β”€ java/com/example/CalculatorServlet.java
└── webapp/
β”œβ”€β”€ WEB-INF/web.xml
β”œβ”€β”€ index.jsp
└── result.jsp


Prerequisites

  • Java 11+
  • Maven
  • Docker & Docker Hub account (mayrhatte09)
  • Kubernetes cluster (Minikube, Kind, or AWS EKS)
  • kubectl configured
  • Jenkins server with Docker access
  • NGINX Ingress Controller for routing

Step 1: Build Maven Project

mvn clean package

Generates target/webcal.war file.


Step 2: Build Docker Image

docker build -t mayrhatte09/webcal:latest .
docker tag mayrhatte09/webcal:latest mayrhatte09/webcal:<git-commit-hash>
docker push mayrhatte09/webcal:latest
docker push mayrhatte09/webcal:<git-commit-hash>

Step 3: Apply Kubernetes Manifests

  1. Apply namespace:
kubectl apply -f kubernetes/namespace.yaml
  1. Apply deployment, service, and ingress:
kubectl apply -f kubernetes/deployment.yaml -n k8s
kubectl apply -f kubernetes/service.yaml -n k8s
kubectl apply -f kubernetes/ingress.yaml -n k8s

Step 4: Verify Deployments

Check pods:

kubectl get pods -n k8s

Check services:

kubectl get svc -n k8s

Check ingress:

kubectl get ingress -n k8s

Example output:

NAME      CLASS    HOSTS           ADDRESS        PORTS   AGE
webcal    <none>   webcal.local    127.0.0.1     80      1m

Tip for Minikube users: If ADDRESS is <pending>, run:

minikube ip

Use the Minikube IP in the hosts file instead of 127.0.0.1.


Step 5: Configure Hosts File

Map ingress host webcal.local to localhost.

Windows

  • Open C:\Windows\System32\drivers\etc\hosts as Administrator
  • Add line:
127.0.0.1 webcal.local
  • Flush DNS:
ipconfig /flushdns

Mac

  • Edit /etc/hosts:
sudo nano /etc/hosts
  • Add line:
127.0.0.1 webcal.local
  • Flush DNS:
sudo dscacheutil -flushcache

Linux / Ubuntu

  • Edit hosts file:
sudo nano /etc/hosts
  • Add line:
127.0.0.1 webcal.local

If using Minikube:

<minikube-ip> webcal.local
  • Flush DNS if caching is enabled:

Systemd DNS (Ubuntu 18.04+):

sudo systemd-resolve --flush-caches

NSCD (if installed):

sudo service nscd restart
  • Verify mapping:
ping webcal.local
# Should return 127.0.0.1 (or Minikube IP)

Step 6: Access the App (Ingress)


CI/CD (Jenkins)

Pipeline Flow

  1. Git push triggers Jenkins pipeline
  2. Jenkins builds Maven project & runs tests
  3. Docker image is built & pushed to Docker Hub
  4. Kubernetes namespace is created if not exists
  5. Deployment, Service, and Ingress applied
  6. Rollback occurs automatically if deployment fails

Step 7: Common Issues & Fixes

Issue Fix
Pod not running Check kubectl get pods -n k8s and logs
Ingress not working Ensure NGINX Ingress controller installed
ImagePullBackOff Verify Docker image exists in Docker Hub
Wrong namespace Use -n k8s in all kubectl commands
Port not accessible Verify containerPort in deployment and service
Jenkins pipeline failed Check Jenkins console logs
Hosts not resolving Update /etc/hosts or flush DNS
Deployment not updating Check image tag in deployment.yaml

Project Notes

  • All Kubernetes resources are namespaced under k8s
  • Docker image tagging uses Git commit hash + latest
  • Rollback enabled in Jenkins pipeline
  • Fully modular for local (Minikube) or cloud (EKS) deployment

πŸ‘€ About the Architect

Mayur Hatte DevOps & Cloud Infrastructure Engineer

Focused on building self-healing, automated infrastructure. Verified asset of MayurHatte09.

Β© 2026 | Mayur Hatte DevOps Projects
```

About

Java-based web application containerized using Docker and deployed on Kubernetes. Implements CI/CD pipeline with automated deployment, rollback, and system reliability.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages