# Start all services
docker-compose up -d
# Verify services are running
docker-compose ps
# View logs
docker-compose logs -f backendAccess Points:
- Frontend: http://localhost:3000
- Backend API: http://localhost:4000
- Backend Health: http://localhost:4000/health
- API Docs: http://localhost:4000/api/docs
- Kafka UI: http://localhost:8080
- MongoDB: localhost:27017
- MySQL: localhost:3306
# Deploy everything
kubectl apply -f k8s/
# Check deployment status
kubectl get all -n airbnb
# Wait for all pods to be ready
kubectl wait --for=condition=ready pod --all -n airbnb --timeout=300s
# Port forward frontend
kubectl port-forward service/frontend-service 3000:80 -n airbnb &
# Port forward backend
kubectl port-forward service/backend-service 4000:4000 -n airbnb &# Start Kafka infrastructure only
docker-compose -f docker-compose.kafka.yml up -d
# Start backend separately
cd backend && npm start- DOCKER_KUBERNETES_SETUP.md - Complete Docker & K8s guide
- KAFKA_SETUP.md - Kafka integration guide
- JMETER_SETUP.md - Performance testing guide
- LAB2_FINAL_STATUS.md - Final completion report
- LAB2_KAFKA_STATUS.md - Kafka implementation details
- LAB2_PROGRESS.md - Development progress
- LAB2_COMPLETION_SUMMARY.md - Summary report
- All services containerized (Backend, Frontend, MySQL, MongoDB, Kafka, Zookeeper)
- Production-ready Dockerfiles with multi-stage builds
- Complete docker-compose.yml with 7 services
- 8 Kubernetes deployments with proper configurations
- Horizontal Pod Autoscaler (2-5 replicas, CPU/Memory based)
- Persistent Volumes for databases
- Health checks and resource limits
- Service discovery and networking
backend/Dockerfile,frontend/Dockerfiledocker-compose.ymlk8s/*.yaml(8 configuration files)
- Kafka producer for booking events
- Two Kafka consumers (Owner & Traveler services)
- Topics:
booking-request,booking-status-update - Asynchronous message flow:
- Traveler creates booking → Kafka → Owner receives
- Owner accepts/cancels → Kafka → Traveler receives
- Graceful error handling
- Kafka UI for monitoring
backend/config/kafka.js- Configuration & producerbackend/kafka/consumers.js- Consumer implementationsbackend/controllers/bookingController.js- Producer integration
- Start Kafka:
docker-compose up -d kafka zookeeper - Create a booking via API
- Check Kafka UI: http://localhost:8080
- View console logs for Kafka events
- MongoDB 7.0 for session storage
- Sessions persist in MongoDB (not memory)
- Password encryption with bcrypt (salt rounds: 10)
- Hybrid database architecture:
- MySQL: Application data (users, properties, bookings)
- MongoDB: Session storage
- MongoDB in both Docker and Kubernetes
backend/server.js- MongoDB session configurationk8s/07-mongodb-deployment.yamldocker-compose.yml- MongoDB service
# Connect to MongoDB
docker exec -it airbnb-mongodb mongosh
# View sessions
use airbnb_sessions
db.sessions.find().pretty()- Redux Toolkit (@reduxjs/toolkit@^2.9.0)
- React-Redux (react-redux@^9.2.0)
- Redux Persist for state persistence
- 4 Redux slices:
- travelerSlice - Traveler authentication & profile
- OwnerSlice - Owner authentication & profile
- propertySlice - Property search, fetch, details
- bookingSlice - Booking creation, status, favorites
- Async thunks for API calls
- Loading and error states
frontend/src/app/store.jsfrontend/src/features/traveler/travelerSlice.jsfrontend/src/features/owner/OwnerSlice.jsfrontend/src/features/property/propertySlice.jsfrontend/src/features/booking/bookingSlice.js
- Open frontend: http://localhost:3000
- Open Redux DevTools in browser
- Login as traveler
- Watch state changes in DevTools
- 3 comprehensive test plans (.jmx files)
- Tests for 100, 200, 300, 400, 500 concurrent users
- Automated test execution script
- Metrics collected:
- Response times (avg, median, percentiles)
- Throughput (requests/second)
- Error rates (% failed)
- HTML reports with graphs
- CSV data for analysis
jmeter/test-plans/01-authentication-test.jmxjmeter/test-plans/02-property-search-test.jmxjmeter/test-plans/03-booking-process-test.jmxjmeter/run-all-tests.sh- Automation script
# Ensure backend is running
curl http://localhost:4000/health
# Run all tests (100, 200, 300, 400, 500 users)
cd jmeter
./run-all-tests.sh
# View results
open results/authentication-100-users-report/index.htmljmeter -n -t test-plans/01-authentication-test.jmx \
-Jusers=100 \
-l results/auth-100.jtl \
-e -o results/auth-100-report┌─────────────────────────────────────────────────────────┐
│ Kubernetes Cluster │
│ │
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌─────────┐ │
│ │ Frontend │ │ Backend │ │ MySQL │ │ MongoDB │ │
│ │ (2-5) │ │ (2-5) │ │ (1) │ │ (1) │ │
│ └────┬─────┘ └────┬─────┘ └────-┬────┘ └────-┬───┘ │
│ │ │ │ │ │
│ └─────────────┴──────────────┴─────────────┘ │
│ │ │
│ ┌─────────────┴──────────────┐ │
│ │ │ │
│ ┌────┴─────┐ ┌───────┴────┐ │
│ │ Zookeeper│ │ Kafka │ │
│ │ (1) │ │ (1) │ │
│ └──────────┘ └────────────┘ │
└─────────────────────────────────────────────────────────┘
│ │
▼ ▼
LoadBalancer Kafka Producer/Consumer
Lab1_DistributedSystem/
├── backend/ # Node.js Backend
│ ├── config/
│ │ ├── kafka.js # Kafka configuration
│ │ └── database.js
│ ├── kafka/
│ │ └── consumers.js # Kafka consumers
│ ├── controllers/ # Kafka producers
│ ├── Dockerfile # Docker
│ └── server.js # MongoDB sessions
│
├── frontend/ # React Frontend
│ ├── src/
│ │ ├── app/
│ │ │ └── store.js # Redux store
│ │ └── features/ # Redux slices
│ └── Dockerfile # Docker
│
├── k8s/ # Kubernetes configs (8 files)
│ ├── 00-namespace.yaml
│ ├── 01-configmap.yaml
│ ├── 02-secrets.yaml
│ ├── 03-mysql-deployment.yaml
│ ├── 04-kafka-deployment.yaml
│ ├── 05-backend-deployment.yaml
│ ├── 06-frontend-deployment.yaml
│ └── 07-mongodb-deployment.yaml
│
├── jmeter/ # Performance testing
│ ├── test-plans/ # 3 JMeter test plans
│ ├── run-all-tests.sh # Automation
│ └── results/ # Generated reports
│
├── docker-compose.yml # All services
├── docker-compose.kafka.yml # Kafka only
│
└── Documentation # Complete guides
├── DOCKER_KUBERNETES_SETUP.md
├── KAFKA_SETUP.md
├── JMETER_SETUP.md
└── LAB2_FINAL_STATUS.md
# Start all services
docker-compose up -d
# Verify services
docker-compose ps
curl http://localhost:4000/health
curl http://localhost:3000
# Check Kafka
open http://localhost:8080
# Stop services
docker-compose down# Deploy
kubectl apply -f k8s/
# Check status
kubectl get all -n airbnb
kubectl get hpa -n airbnb
kubectl get pvc -n airbnb
# View logs
kubectl logs -f deployment/backend -n airbnb
# Clean up
kubectl delete namespace airbnb# Create a booking
curl -X POST http://localhost:4000/api/bookings/request \
-H "Content-Type: application/json" \
-d '{"propertyId":1,"startDate":"2025-12-01","endDate":"2025-12-05","guests":2}'
# Check backend logs for Kafka events
docker-compose logs backend | grep Kafkacd jmeter
./run-all-tests.sh
open results/authentication-100-users-report/index.html# MySQL
DB_HOST=mysql
DB_USER=airbnb_user
DB_PASSWORD=password123
DB_NAME=airbnb_db
# MongoDB
MONGO_USER=admin
MONGO_PASSWORD=mongopassword
MONGO_DB=airbnb_sessions
# Kafka
KAFKA_BROKER=kafka:9093
# Session
SESSION_SECRET=your-secret-key-change-in-production- Docker services running (
docker-compose ps) - Kubernetes pods (
kubectl get pods -n airbnb) - Kafka UI with topics
- MongoDB sessions
- Redux DevTools in browser
- JMeter test results
- Performance graphs
# Check if ports are in use
lsof -ti:4000
lsof -ti:3306
lsof -ti:27017
# Check logs
docker-compose logs backend# Restart Kafka services
docker-compose restart zookeeper kafka
# Check Kafka logs
docker-compose logs kafka# Verify MySQL is running
docker exec -it airbnb-mysql mysql -u root -p
# Verify MongoDB is running
docker exec -it airbnb-mongodb mongoshLast Updated: November 20, 2025 Author: Savitha and Jane