Skip to content

Mayurhatte09/cloud-native-chat-app-devops

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

10 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation


Cloud Native Chat App DevOps

A production-ready full-stack chat application built using modern DevOps practices.


Table of Contents


Introduction

This is a production-ready cloud-native chat application demonstrating real-world DevOps practices including CI/CD, containerization, and Kubernetes orchestration.


Features

  • Real-time messaging using Socket.IO
  • User authentication (JWT)
  • Profile management
  • Online/offline user status
  • Dockerized frontend & backend
  • Kubernetes deployment with Ingress
  • MongoDB persistent storage
  • CI/CD pipeline using Jenkins

Tech Stack

  • Frontend: React, TailwindCSS, Zustand
  • Backend: Node.js, Express, Socket.IO
  • Database: MongoDB
  • Containerization: Docker
  • Orchestration: Kubernetes
  • CI/CD: Jenkins
  • Ingress: NGINX

Architecture Overview

User β†’ Browser
       ↓
   Ingress (NGINX)
       ↓
 β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
 β”‚   Frontend    β”‚
 β”‚   React App   β”‚
 β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
        ↓ API Calls
 β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
 β”‚   Backend     β”‚
 β”‚ Node + Socket β”‚
 β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
        ↓
     MongoDB

CI/CD:
GitHub β†’ Jenkins β†’ Docker β†’ Kubernetes

Project Structure

full-stack_chatApp/
β”œβ”€β”€ backend/            # Node.js backend
β”œβ”€β”€ frontend/           # React frontend
β”œβ”€β”€ kubernetes/         # Kubernetes manifests (deployments, services, ingress)
β”œβ”€β”€ docker-compose.yml  # Optional local Docker Compose setup
β”œβ”€β”€ Jenkinsfile
└── README.md


Prerequisites

  • Docker Desktop (Kubernetes enabled)
  • kubectl
  • Node.js >= 18 (optional)
  • Git
  • Browser

Setup .env

cd backend

Create .env:

MONGODB_URI=mongodb://mongoadmin:secret@mongodb:27017/dbname?authSource=admin
JWT_SECRET=your_jwt_secret_key
PORT=5001

Step 1: Build Docker Images

cd backend
docker build -t your-dockerhub/chatapp-backend:latest .

cd ../frontend
docker build -t your-dockerhub/chatapp-frontend:latest .

Push images to Docker Hub:

docker push mayrhatte09/chatapp-backend:latest
docker push mayrhatte09/chatapp-frontend:latest

Step 2: Apply Kubernetes Manifests

  1. Apply namespace:
kubectl apply -f kubernetes/namespace.yaml
  1. Apply Persistent Volume & PVC for MongoDB
kubectl apply -f kubernetes/mongodb-pv.yaml
kubectl apply -f kubernetes/mongodb-pvc.yaml
  1. Apply MongoDB deployment & service:
kubectl apply -f kubernetes/mongodb-deployment.yaml
kubectl apply -f kubernetes/mongodb-service.yaml
  1. Apply backend deployment & service:
kubectl apply -f kubernetes/backend-deployment.yaml
kubectl apply -f kubernetes/backend-service.yaml
  1. Apply frontend deployment & service:
kubectl apply -f kubernetes/frontend-deployment.yaml
kubectl apply -f kubernetes/frontend-service.yaml
  1. Apply secrets (JWT secret):
kubectl apply -f kubernetes/secrets.yaml
  1. Apply Ingress to route chatapp.com:
kubectl apply -f kubernetes/ingress.yaml

Step 3: Verify Deployments

Check pods:

kubectl get pods -n kubernetes

Check services:

kubectl get svc -n kubernetes

Check ingress:

kubectl get ingress -n kubernetes

Ensure NGINX ingress controller is running:

kubectl get pods -n ingress-nginx
kubectl get svc -n ingress-nginx

(Optional) Port-forwarding:

kubectl port-forward service/backend -n kubernetes 5001:5001
kubectl port-forward service/frontend -n kubernetes 80:80

Step 4: Configure Hosts File

Ingress uses a custom host (chatapp.com). You need to map it to localhost.

  1. Open Notepad as Administrator:
Press Windows Key β†’ type Notepad β†’ Right Click β†’ Run as administrator
  1. Open the hosts file:
C:\Windows\System32\drivers\etc\hosts
  1. Add the line:
127.0.0.1 chatapp.com
  1. Save and flush DNS:
ipconfig /flushdns
  1. Verify:
ping chatapp.com
# Should return 127.0.0.1

Step 5: Access the App (Important for Ingress)


CI/CD (Jenkins)

Pipeline Flow

  1. Push code to GitHub
  2. Jenkins pulls code
  3. Builds Docker images
  4. Pushes to Docker Hub
  5. Deploys to Kubernetes

Step 6: Common Issues & Fixes

Issue Fix
chatapp.com not working Check hosts file and run ipconfig /flushdns
Ingress no address Install ingress controller
Backend not running Check pod logs
Ingress shows <none> for ADDRESS Ensure NGINX ingress controller is installed and running
Backend not working Verify backend service exposes port 5001 and pod is running
Frontend not loading Check frontend service and pod status
Secret not found Apply secrets.yaml before backend deployment
MongoDB connection error Verify MONGODB_URI and MongoDB pod status
Pods stuck in Pending Check PVC/PV and cluster resources
ImagePullBackOff Verify image name and push to Docker Hub
CrashLoopBackOff Check logs and environment variables
Port not accessible Verify service ports and configuration
Ingress not routing Check ingress rules and service names
DNS not resolving Verify hosts file entry
Jenkins pipeline failed Check Jenkins console logs
Docker build failed Check Dockerfile and dependencies
Wrong namespace issue Use -n kubernetes in commands
Socket.IO not working Check backend port and WebSocket config
CORS error Enable CORS in backend
Backend API not reachable Verify backend service and endpoints
MongoDB pod restarting Check storage and logs
Deployment not updating Reapply manifests or check image tag
High response time Check pod resources and scaling
Service not found Verify service name in configs
Env variables not working Check .env or Kubernetes secrets
Ingress 502 error Backend service may be down
Permission denied (Docker/Jenkins) Check Docker socket permissions

Project Notes

  • MongoDB uses Persistent Volume and PVC to persist data.
  • JWT secret stored in Kubernetes Secret and injected into backend.
  • Frontend communicates with backend via /api/ routed through Ingress.
  • Docker Desktop Kubernetes is for local development; for production, use cloud K8s.

πŸ‘€ About the Architect

Mayur Hatte

DevOps & Cloud Infrastructure Engineer

Focused on building self-healing, automated infrastructure. This playbook is a verified asset of MayurHatte09.

Β© 2026 | Mayur Hatte Design System

About

Production-ready real-time chat application built using microservices architecture. Deployed on Kubernetes with CI/CD pipelines and AWS for scalable, high-availability infrastructure.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors