3-Tier Application Deployment on AWS EKS
This project demonstrates a production-style 3-tier architecture deployed on AWS EKS, fully automated using Terraform, GitHub Actions, Docker, Helm, and Kubernetes.
It follows real-world GitOps & CI/CD best practices, including:
Infrastructure as Code (IaC)
Pull Request–based approvals
Separate CI & CD workflows
Containerized microservices
Kubernetes orchestration with Helm
Architecture Overview 🔹 3-Tier Architecture
Web Tier – Nginx
Application Tier – Java Spring Application
Data Tier – MySQL, Memcached, RabbitMQ, Elasticsearch
Platform & Tools
- AWS EKS
- Docker & Amazon ECR
- Kubernetes & Helm
- Terraform (staging environment)
- GitHub Actions
- SonarQube
- Maven
- Prometheus (Monitoring & Metrics)
- Grafana (Visualization & Dashboards)
This repository follows a two-branch strategy to ensure safe testing and controlled production releases.
-
staging branch
- Used for development, testing, and validation
- All feature changes are merged here first
- CI workflows (build, test, SonarQube) run on this branch
- No production changes are applied from this branch
-
main branch
- Represents the production-ready state
- Protected branch with required Pull Request approvals
- Only approved and tested changes are merged here
- Developers push changes to the
stagingbranch - CI pipeline runs:
- Build & unit tests
- SonarQube quality checks
- Docker image build
- If all checks pass, a Pull Request is raised from
staging→main - Pull Request requires manual approval
- After approval and merge:
- Terraform
applyruns only onmain - Application is deployed to production EKS using Helm
- Terraform
- Runs terraform plan on Pull Requests
- Requires Pull Request approval
- Runs terraform apply only on the main branch
- Maven build & unit tests
- SonarQube code quality scan
- Docker image build
- Push Docker image to Amazon ECR
- Deploy application to AWS EKS using Helm
This project includes full-stack monitoring and observability using Prometheus and Grafana, deployed on AWS EKS.
- Prometheus
- Collects Kubernetes and application metrics
- Scrapes metrics from pods, nodes, and services
- Provides time-series monitoring for cluster health
- Grafana
- Visualizes Prometheus metrics using dashboards
- Provides real-time insights into application and cluster performance
- Used for monitoring:
- CPU & memory usage
- Pod and node health
- Application performance metrics
- Prometheus and Grafana are deployed inside the EKS cluster
- Metrics are collected from Kubernetes workloads and infrastructure
- Dashboards help in proactive monitoring and troubleshooting
- Enables production-grade observability and alert readiness
- PR-based infrastructure changes
- Manual approval before production changes
- Separate CI and CD pipelines
- No direct terraform apply from feature branches
- Immutable Docker images
- Kubernetes secrets managed via manifests
- Monitoring with Prometheus
- Visualization with Grafana
.
├── .github/
│ └── workflows/
│ ├── terraform-infra.yml # Terraform CI/CD (plan on PR, apply on main)
│ └── deploy.yml # App CI/CD (test, build, SonarQube, ECR, Helm)
│
├── terraform/ # Infrastructure as Code (AWS)
│ ├── eks-cluster.tf # EKS cluster and node groups
│ ├── vpc.tf # VPC, subnets, routing
│ ├── main.tf # Core Terraform configuration
│ ├── terraform.tf # Terraform backend & providers
│ ├── variables.tf # Input variable definitions
│ ├── outputs.tf # Terraform outputs
│ ├── main.tfvars # Default variable values
│ └── staging.tfvars # Staging environment variables
│
├── Docker-files/ # Dockerfiles per application tier
│ ├── app/
│ │ └── Dockerfile # Java application image
│ ├── web/
│ │ ├── Dockerfile # Nginx web tier image
│ │ └── nginvproapp.conf # Nginx configuration
│ └── db/
│ ├── Dockerfile # Database image
│ └── db_backup.sql # Initial database data
│
├── helm/ # Helm charts for EKS deployment
│ └── vprofilecharts/
│ ├── Chart.yaml # Helm chart metadata
│ ├── values.yaml # Default Helm values
│ └── templates/ # Kubernetes resource templates
│ ├── vproappdep.yml # Application deployment
│ ├── vproapp-service.yml # Application service
│ ├── vprodbdep.yml # Database deployment
│ ├── db-CIP.yml # Database ClusterIP service
│ ├── rmq-dep.yml # RabbitMQ deployment
│ ├── rmq-CIP-service.yml # RabbitMQ service
│ ├── mcdep.yml # Memcached deployment
│ ├── mc-CIP.yml # Memcached service
│ ├── app-secret.yml # Application secrets
│ └── vproingress.yaml # Ingress configuration
│
├── kubernetes/ # Kubernetes manifests
│ └── vpro-app/
│ ├── vproappdep.yml # Application deployment
│ ├── vproapp-service.yml # Application service
│ ├── vprodbdep.yml # Database deployment
│ ├── db-CIP.yml # Database service
│ ├── rmq-dep.yml # RabbitMQ deployment
│ ├── rmq-CIP-service.yml # RabbitMQ service
│ ├── mcdep.yml # Memcached deployment
│ ├── mc-CIP.yml # Memcached service
│ ├── app-secret.yml # Secrets
│ └── vproingress.yaml # Ingress
│
├── src/ # Java application source code
├── images/ # Architecture & pipeline screenshots
├── Dockerfile # Root application Dockerfile
├── compose.yaml # Local Docker Compose setup
└── README.md
VProfile – Local Setup (Docker)
This project runs a 3-tier Java application (Nginx + Tomcat + MySQL) using Docker Compose.
Prerequisites
Docker ≥ 20.x
Docker Compose v2
step 1)Clone the repository
git clone https://github.com/tabarak23/eks-java.git
cd eks-java
Step 2) Build Docker images
command = docker compose build
Step 3) Start the application
command = docker compose up -d
Step 4) Access the Application
Step 5) Stop & Clean Up
command = docker compose down
Notes
(i)Application containers run as non-root users
(ii)Images are production-ready and Kubernetes/EKS compatible
-
Each tier has its own Dockerfile:
- Docker-files/app – Java application
- Docker-files/web – Nginx web tier
- Docker-files/db – Database image
-
Docker images are versioned and pushed to Amazon ECR
- Kubernetes resources are managed using Helm
-
Deployments
-
Services
-
Secrets
-
Ingress
-
ConfigMaps
-
Helm charts are located at: helm/vprofilecharts/
-
Versioned deployments
-
Easy rollbacks
-
Environment-specific configuration
Follow the steps below to integrate SonarCloud with this repository.
-
Go to https://sonarcloud.io

-
Select the previous version (if prompted) Click Create Project

- Navigate to My Organizations
Select your organization

- Go to Security
- Enter a name for the token
- Click Generate Token
- Copy the generated token

- Go to your GitHub repository
- Navigate to Settings → Secrets and variables → Actions
- Click New repository secret
- Add the SonarCloud token:
- Name:
SONAR_TOKEN - Value: (Paste the copied token)
- Name:
- Save the secret
SUCCESS





















