Skip to content

inncnr/springbootdeneme

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

You are a senior Java + DevOps engineer.

Create a production-style learning project for understanding centralized logging with Spring Boot, Docker, Kubernetes, and ELK Stack.

Project Goal: Build a backend application that generates structured logs, containerize it with Docker, deploy it to Kubernetes, and integrate it with ELK stack for centralized logging and observability.

Tech Stack:

  • Java 21
  • Spring Boot 3
  • Maven
  • Logback
  • SLF4J
  • logstash-logback-encoder
  • Docker
  • Kubernetes
  • Elasticsearch
  • Kibana
  • Filebeat

Project Requirements:

  1. Spring Boot Application Create a REST API project named: order-service

Endpoints:

  • POST /orders
  • GET /orders/{id}
  • DELETE /orders/{id}
  • GET /health
  • GET /error-test

Requirements:

  • Use layered architecture:

    • controller
    • service
    • repository
    • model
    • dto
    • config
    • exception
  • Use in-memory storage initially.

  • Return JSON responses.

  • Add global exception handling.

  1. Structured Logging Implement production-style structured JSON logging.

Requirements:

  • Use logback-spring.xml
  • Use LogstashEncoder
  • All logs must go to stdout
  • Include:
    • timestamp
    • log level
    • service name
    • traceId
    • request path
    • HTTP method
    • message
    • exception stack trace

Add:

  • request logging filter/interceptor
  • correlation ID / traceId generation
  • MDC usage

Example log: { "timestamp":"2026-01-01T10:00:00", "level":"INFO", "service":"order-service", "traceId":"abc123", "method":"POST", "path":"/orders", "message":"Order created successfully" }

  1. Error Simulation Create endpoints that intentionally generate:
  • RuntimeException
  • validation errors
  • 404 errors

Log all exceptions in structured JSON format.

  1. Dockerization Create:
  • optimized Dockerfile
  • .dockerignore

Requirements:

  • Use eclipse-temurin:21-jre
  • Small image size
  • Proper layering
  • Expose port 8080

Provide commands:

  • mvn clean package
  • docker build
  • docker run
  1. Docker Compose Environment Create docker-compose.yml containing:
  • order-service
  • Elasticsearch
  • Kibana

Requirements:

  • Proper networking
  • Environment variables
  • Volume mappings
  • Health checks

Expose:

  • Kibana on 5601
  • Elasticsearch on 9200
  • Application on 8080
  1. Kubernetes Deployment Create complete Kubernetes manifests:
  • namespace.yaml
  • deployment.yaml
  • service.yaml
  • configmap.yaml

Requirements:

  • 2 replicas
  • readiness probe
  • liveness probe
  • resource requests/limits
  • environment variables
  • labels/selectors
  1. Filebeat Integration Create Filebeat configuration for Kubernetes.

Requirements:

  • DaemonSet deployment
  • Collect container stdout logs
  • Parse JSON logs
  • Send logs to Elasticsearch
  • Add Kubernetes metadata

Provide:

  • filebeat.yml
  • filebeat-daemonset.yaml
  1. Kibana Explain:
  • how to create index patterns
  • how to search logs
  • how to filter by traceId
  • how to create dashboards

Create examples for:

  • error rate visualization
  • request count visualization
  • pod-based filtering
  1. Observability Concepts Document:
  • centralized logging
  • stdout logging in containers
  • Kubernetes logging architecture
  • why JSON logging matters
  • correlation IDs
  • log aggregation
  1. Project Structure Generate a clean professional folder structure.

  2. README.md Create a complete README including:

  • local development
  • Docker usage
  • Kubernetes deployment
  • ELK setup
  • troubleshooting
  • useful kubectl commands
  • useful docker commands
  1. Best Practices Apply:
  • production logging practices
  • clean architecture
  • environment-based configuration
  • secure defaults
  • container best practices
  • Kubernetes best practices
  1. Output Format Generate:
  • full source code
  • all YAML files
  • all Docker files
  • all configs
  • all commands
  • explanations for every important step

The project should be educational, production-inspired, and suitable for a DevOps engineer learning ELK and Kubernetes logging architecture.

About

elk stack for springbootdeneme

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors