Skip to content

Latest commit

 

History

185 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Realtime Auction System

Elevating Digital Auctions with Dynamic Bidding, Instant Notifications, and Unparalleled Scalability

Build Issues Contributions License

Table of Contents

⭐ Overview

The Realtime Auction System is a robust, scalable platform designed to facilitate dynamic online auctions with immediate user feedback. Built as a comprehensive microservices ecosystem with Spring Boot, React, and MySQL, the entire system is architected exclusively for Kubernetes deployment.

Important Note: This project relies on Kubernetes StatefulSet resources and PersistentVolumeClaims to guarantee database persistence across pod restarts. Standalone local execution (e.g., running services directly via Maven) is not fully supported, as data will not persist effectively outside of the orchestrated cluster environment.

✨ Key Features

  • Real-time Bidding & Notifications: Powered by WebSockets for instant client updates.
  • Microservices Architecture: Independent services (auction-service, bidding-service, auth-service) managed by Eureka and an API Gateway.
  • Persistent Data: MySQL databases running as Kubernetes StatefulSets.
  • Automated Infrastructure: Full deployment orchestration via Ansible playbooks.

🛠️ Architecture & Requirements

Tech Stack

  • Backend: Java 21, Spring Boot 3.4, Spring Cloud, Maven
  • Frontend: React 19, Vite, Tailwind CSS
  • Database: MySQL 8.4
  • DevOps: Docker, Kubernetes (Minikube), Ansible

Prerequisites

Ensure you have the following installed on your Linux machine (tested on Fedora/RHEL):

  1. Java Development Kit (JDK) 21 (Must be set as default compiler via alternatives)
  2. Apache Maven 3.9+
  3. Docker Engine
  4. Minikube (Using the docker driver)
  5. Ansible & Ansible Kubernetes Collection
    pip3 install kubernetes
    ansible-galaxy collection install kubernetes.core

🚀 Local Deployment (Minikube & Ansible)

Follow these steps exactly to deploy the entire ecosystem to your local Minikube cluster.

Step 1: Start Minikube

We use the Docker driver to avoid complex KVM firewall restrictions, ensuring the cluster has internet access for pulling base images.

# Start Minikube with required resources
minikube start --memory=6144 --cpus=4 --driver=docker

# Enable required addons for networking and scaling
minikube addons enable ingress
minikube addons enable metrics-server

Step 2: Build Backend JARs

Compile all Spring Boot microservices.

cd backend
mvn clean package -DskipTests
cd ..

(Note: Ensure your JAVA_HOME or default javac points to Java 21, otherwise Lombok compilation will fail).

Step 3: Build Docker Images (Inside Minikube)

Instead of pushing images to Docker Hub, we point our local Docker CLI directly to Minikube's internal Docker daemon. This allows Kubernetes to immediately see our newly built images.

# Point shell to Minikube's Docker daemon
eval $(minikube docker-env)

# Build Backend Images
docker build -t ankur2k19/eureka-server:latest   backend/eureka-server/
docker build -t ankur2k19/api-gateway:latest     backend/api-gateway/
docker build -t ankur2k19/auth-service:latest    backend/auth-service/
docker build -t ankur2k19/auction-service:latest backend/auction-service/
docker build -t ankur2k19/bidding-service:latest backend/bidding-service/

# Build Frontend Image
docker build -t ankur2k19/auction-system-frontend:latest frontend/

Step 4: Ansible Vault & Credentials

All secure credentials (database passwords, JWT secrets) are safely stored in an encrypted Ansible Vault. The default vault already contains development credentials (e.g., username ankur). When you run the deployment in the next step, Ansible will decrypt this vault, create a Kubernetes Secret (auth-service-secrets, etc.), and the Spring Boot applications will automatically use those credentials instead of their local application.yml defaults.

To view the existing vault credentials:

cd devops
ansible-vault view ansible/backend/vault/secrets.yml --vault-password-file ansible/backend/vault_pass.txt
cd ..

Step 5: Deploy Using Ansible

The project includes automated Ansible playbooks that create the Kubernetes namespace, configure secrets, deploy StatefulSets for MySQL, and spin up all microservices and Ingress controllers.

1. Deploy Backend & Databases:

cd devops
ansible-playbook -i ansible/backend/inventory \
  ansible/backend/deploy.yml \
  --vault-password-file ansible/backend/vault_pass.txt

2. Deploy Frontend:

cd devops
ansible-playbook -i ansible/frontend/inventory ansible/frontend/ansible_playbook.yml

Step 5: Verify Deployment

Monitor the pods until they are all in the Running state. The MySQL pods may take a few minutes to initialize their Persistent Volumes.

kubectl get pods -n auction-system -w

🔧 Usage

Once all pods are running successfully, you can access the application via Minikube's networking.

Accessing the Application

Option A: Minikube Service (Easiest)

minikube service frontend-service -n auction-system

Option B: Host File Routing (For Ingress) To use the configured DNS names, add the Minikube IP to your /etc/hosts file:

# Get the IP
minikube ip

# Add this line to /etc/hosts (replace MINIKUBE_IP with the actual IP)
# MINIKUBE_IP api.local frontend.auction.com

You can then access the app at http://frontend.auction.com and the APIs at http://api.local.

Testing Data Persistence

Because we use Kubernetes StatefulSet with PersistentVolumeClaims, your database data is safe. You can test this by deleting a MySQL pod:

kubectl delete pod mysql-auth-0 -n auction-system

Kubernetes will immediately recreate the pod, and your previously created users/auctions will still exist because the new pod automatically reattaches to the Persistent Volume.

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages