A distributed help desk / support ticket system designed to showcase workload management across Kubernetes pods
Features β’ Quick Start β’ Architecture β’ Deployment β’ API β’ Contributing
- Overview
- Features
- Architecture
- Technology Stack
- Quick Start
- Docker
- Kubernetes Deployment
- Configuration
- Usage
- API Reference
- Development
- Testing
- Monitoring
- Troubleshooting
- Contributing
- License
srvc-tckt (Service Ticket) is a full-featured, distributed support ticket management system built with Spring Boot and designed for Kubernetes environments. It demonstrates real-time workload distribution, agent performance tracking, and queue management across multiple pods.
- π Cloud-Native: Built for Kubernetes with horizontal scaling
- π― Priority Management: Color-coded priority system (Urgent/High/Medium/Low)
- π Real-Time Distribution: Watch tickets flow across pods in real-time
- π‘οΈ Concurrency Safe: Optimistic locking prevents double-assignment
- π Metrics & Monitoring: Built-in actuator endpoints and performance tracking
- π¨ Modern UI: Responsive Thymeleaf templates with JavaScript enhancements
-
π Ticket Management
- Create, assign, update, and track support tickets
- Full lifecycle management (NEW β ASSIGNED β IN_PROGRESS β RESOLVED β CLOSED β ARCHIVED)
- Priority-based queue with visual color coding
- Category organization (Technical, Billing, Account, General)
-
π₯ Multi-Agent Support
- Multiple agents can work simultaneously
- "Assign to Me" functionality with race condition prevention
- Per-agent performance metrics and dashboards
- Workload distribution visualization
-
π― Priority System
- π΄ URGENT - Immediate attention required
- π HIGH - Important, prompt handling
- π‘ MEDIUM - Standard priority
- π’ LOW - Can be deferred
-
π Analytics & Reporting
- System-wide statistics dashboard
- Per-agent performance metrics
- Pod/Node distribution tracking
- Response time and resolution time SLA tracking
-
π Notifications
- Email notifications for ticket events
- Async email processing
- Configurable notification templates
- βοΈ Horizontal Scaling: Auto-scaling based on CPU/Memory metrics
- π² Load Distribution: Demonstrates workload spread across pods
- π Health Checks: Liveness and readiness probes
- π‘ Service Discovery: Pod and node tracking
- π Rolling Updates: Zero-downtime deployments
- πΎ Persistent Storage: PostgreSQL with PVC for data persistence
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Load Balancer / Ingress β
βββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββΌββββββββββββββββ
β β β
βββββΌββββ βββββΌββββ βββββΌββββ
β Pod 1 β β Pod 2 β β Pod 3 β
βAgent Aβ βAgent Bβ βAgent Cβ
βββββ¬ββββ βββββ¬ββββ βββββ¬ββββ
β β β
βββββββββββββββββΌββββββββββββββββ
β
βββββΌβββββ
βPostgreSQLβ
ββββββββββ
srvc-tckt/
βββ controllers/ # HTTP request handlers
βββ services/ # Business logic layer
βββ repositories/ # Data access layer
βββ entities/ # JPA entities
βββ dto/ # Data transfer objects
βββ config/ # Spring configuration
βββ templates/ # Thymeleaf HTML views
NEW β ASSIGNED β IN_PROGRESS β RESOLVED β CLOSED β ARCHIVED
β β
βββββββββββββββ΄βββββ WAITING_CUSTOMER βββ IN_PROGRESS
- Java 21 - Modern Java LTS release
- Spring Boot 4.0.0 - Application framework
- Spring MVC - Web framework
- Spring Data JPA - Data persistence
- Spring Security - Authentication & authorization
- Hibernate - ORM
- Flyway - Database migrations
- H2 - In-memory database (development)
- PostgreSQL 16 - Production database
- Thymeleaf - Server-side templating
- HTML5/CSS3 - Modern web standards
- JavaScript (ES6+) - Client-side interactivity
- Docker - Containerization
- Kubernetes - Orchestration
- Maven - Build automation
- Spring Boot Actuator - Monitoring & metrics
- Lombok - Boilerplate reduction
- Spring Boot DevTools - Development utilities
- JavaMail - Email notifications
- Java 21 or higher
- Maven 3.9+
- Docker (optional, for containerization)
- kubectl & k3s (optional, for Kubernetes deployment)
-
Clone the repository
git clone https://github.com/your-org/srvc-tckt.git cd srvc-tckt -
Run with H2 (in-memory database)
./mvnw spring-boot:run
-
Access the application
URL: http://localhost:8888 -
Login with default credentials
- agent1 / password
- agent2 / password
- admin / admin
-
Start PostgreSQL
docker run -d \ --name postgres \ -e POSTGRES_DB=srvc_tckt_db \ -e POSTGRES_USER=postgres \ -e POSTGRES_PASSWORD=postgres \ -p 5432:5432 \ postgres:16-alpine
-
Run application with prod profile
./mvnw spring-boot:run -Dspring-boot.run.profiles=prod
# Build the image
docker build -t srvc-tckt:latest .
# Verify the image
docker images | grep srvc-tcktCreate a docker-compose.yml:
version: '3.8'
services:
postgres:
image: postgres:16-alpine
environment:
POSTGRES_DB: srvc_tckt_db
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
ports:
- "5432:5432"
volumes:
- postgres-data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 10s
timeout: 5s
retries: 5
srvc-tckt:
image: srvc-tckt:latest
depends_on:
postgres:
condition: service_healthy
environment:
SPRING_PROFILES_ACTIVE: prod
DB_HOST: postgres
DB_PORT: 5432
DB_NAME: srvc_tckt_db
DB_USERNAME: postgres
DB_PASSWORD: postgres
ports:
- "8888:8888"
healthcheck:
test: ["CMD", "wget", "--spider", "http://localhost:8888/actuator/health"]
interval: 30s
timeout: 10s
retries: 3
volumes:
postgres-data:Run with:
docker-compose up -d- k3s or any Kubernetes cluster
- kubectl configured
- Docker image built and available
-
Build and load image into k3s
# Build the image docker build -t srvc-tckt:latest . # Import into k3s docker save srvc-tckt:latest | sudo k3s ctr images import -
-
Deploy to Kubernetes
kubectl apply -f deployment.yaml
-
Check deployment status
# Check pods kubectl get pods -n srvc-tckt # Check services kubectl get svc -n srvc-tckt # Watch pod distribution kubectl get pods -n srvc-tckt -o wide
-
Access the application
# Get the LoadBalancer IP kubectl get svc srvc-tckt-service -n srvc-tckt # Access at: http://<EXTERNAL-IP>
# Manual scaling
kubectl scale deployment srvc-tckt -n srvc-tckt --replicas=5
# Check HPA status
kubectl get hpa -n srvc-tckt
# Watch auto-scaling in action
kubectl get hpa -n srvc-tckt --watch# View logs from all pods
kubectl logs -n srvc-tckt -l app=srvc-tckt --tail=100
# Follow logs from a specific pod
kubectl logs -n srvc-tckt <pod-name> -f
# Execute commands in a pod
kubectl exec -n srvc-tckt <pod-name> -it -- /bin/sh| Variable | Description | Default | Required |
|---|---|---|---|
SPRING_PROFILES_ACTIVE |
Active Spring profile | local |
No |
SERVER_PORT |
Application port | 8888 |
No |
DB_HOST |
Database hostname | localhost |
Yes (prod) |
DB_PORT |
Database port | 5432 |
Yes (prod) |
DB_NAME |
Database name | srvc_tckt_db |
Yes (prod) |
DB_USERNAME |
Database username | postgres |
Yes (prod) |
DB_PASSWORD |
Database password | - | Yes (prod) |
HOSTNAME |
Pod name (auto-set by K8s) | local-dev |
No |
NODE_NAME |
Node name (set in deployment) | local-node |
No |
MAIL_HOST |
SMTP host | localhost |
No |
MAIL_PORT |
SMTP port | 1025 |
No |
- local - H2 in-memory database, development features enabled
- prod - PostgreSQL database, production optimizations
Available at /actuator:
/health- Health check/info- Application info/metrics- Application metrics/prometheus- Prometheus metrics
- Navigate to Dashboard
- Click Create New Ticket
- Fill in the form:
- Subject
- Description
- Priority (Urgent/High/Medium/Low)
- Category (Technical/Billing/Account/General)
- Customer Name & Email
- Click Submit Ticket
- Login as an agent (agent1/password)
- View Ticket Queue - See all unassigned tickets
- Click Assign to Me on a ticket
- Work through the ticket lifecycle:
- Start Progress - Begin working
- Request Info - Ask customer for more details
- Resolve - Mark as resolved
- Close - Final closure
- Go to Statistics page
- View By Pod section
- See how tickets are distributed across pods
- Compare performance metrics per pod/node
Alt + H- DashboardAlt + Q- Ticket QueueAlt + M- My TicketsAlt + A- All TicketsAlt + N- New Ticket
GET /tickets # List all tickets
GET /tickets/{id} # Get ticket details
POST /tickets/new # Create ticket
POST /tickets/{id}/assign # Assign to current agent
POST /tickets/{id}/start # Start progress
POST /tickets/{id}/resolve # Resolve ticket
POST /tickets/{id}/close # Close ticketGET /tickets/stats # System statisticsGET /actuator/health # Health check
GET /actuator/metrics # Metrics
GET /actuator/info # Application info# Clean and build
./mvnw clean install
# Skip tests for faster builds
./mvnw clean install -DskipTests
# Run tests only
./mvnw test
# Package as JAR
./mvnw clean packagesrvc-tckt/
βββ src/
β βββ main/
β β βββ java/
β β β βββ com/helpdesk/srvc_tckt/
β β β βββ config/ # Configuration
β β β βββ controller/ # Controllers
β β β βββ dto/ # DTOs
β β β βββ entity/ # Entities
β β β βββ repository/ # Repositories
β β β βββ service/ # Services
β β βββ resources/
β β βββ db/migration/ # Flyway migrations
β β βββ static/ # CSS, JS
β β βββ templates/ # Thymeleaf templates
β β βββ application.properties
β βββ test/ # Tests
βββ Dockerfile # Docker image definition
βββ deployment.yaml # Kubernetes manifests
βββ pom.xml # Maven configuration
βββ README.md # This file
- Follow Java naming conventions
- Use Lombok to reduce boilerplate
- Document public APIs with Javadoc
- Write unit tests for service layer
- Keep controllers thin, business logic in services
./mvnw test./mvnw test -Dtest=TicketServiceTest./mvnw clean test jacoco:reportView coverage report: target/site/jacoco/index.html
Scrape metrics from:
http://localhost:8888/actuator/prometheus
Import the provided dashboard:
- CPU/Memory usage per pod
- Request rate and response times
- Ticket processing metrics
- Database connection pool stats
Logs are output to stdout/stderr and can be collected by:
- Kubernetes logs:
kubectl logs - Log aggregation: Elasticsearch/Fluentd/Kibana (EFK)
- Cloud logging: CloudWatch, Stackdriver, etc.
Check Java version:
java -version # Should be 21 or higherCheck port availability:
lsof -i :8888 # Port should be freePostgreSQL not running:
docker ps | grep postgresWrong credentials:
Check application-prod.properties and environment variables
Check pod logs:
kubectl logs -n srvc-tckt <pod-name>Check events:
kubectl describe pod -n srvc-tckt <pod-name>Check resources:
kubectl top pods -n srvc-tckt| Issue | Solution |
|---|---|
| 503 Service Unavailable | Database not ready - check init container logs |
| CrashLoopBackOff | Check logs with kubectl logs |
| ImagePullBackOff | Ensure image is in k3s: docker save | k3s ctr images import |
| No LoadBalancer IP | k3s uses Traefik - check ingress instead |
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch
git checkout -b feature/amazing-feature
- Commit your changes
git commit -m "Add amazing feature" - Push to the branch
git push origin feature/amazing-feature
- Open a Pull Request
- Write clear commit messages
- Add tests for new features
- Update documentation
- Follow existing code style
- Ensure CI passes
This project is licensed under the MIT License - see the LICENSE file for details.
- Spring Boot team for the excellent framework
- Kubernetes community for orchestration tools
- Open source contributors
- π Issues: GitHub Issues
- π Docs: Wiki
Built with β€οΈ for demonstrating distributed workload management in Kubernetes
β Star this repo if you find it useful!