Nasruddin/spring-boot-based-microservices
소개
코스와 리뷰를 관리하는 모듈형·확장형 Spring Boot 마이크로서비스 프레임워크입니다. Keycloak을 통한 OAuth 2.0 인증과 Spring Cloud Gateway를 이용한 API 관리를 제공하며, OTel, Grafana, Loki, Tempo, Prometheus로 관측성을 구현합니다. 데이터 저장에는 MongoDB와 PostgreSQL을 사용하고 Docker Compose와 Kubernetes로 배포합니다.
시스템 및 인프라측정된 스타 증가
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- 0
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
OriginalSpring Boot Based Microservices
A modular, production-style microservices reference project for managing courses and reviews with strong focus on:
- API gateway routing
- OAuth2/OIDC security with Keycloak
- Observability (metrics, logs, traces)
- Docker Compose and Kubernetes/Tilt local deployment workflows
Table of Contents
- Overview
- Architecture
- Tech Stack
- Prerequisites
- Quick Start (Docker Compose)
- Run with Kubernetes + Tilt
- Core Endpoints
- Keycloak
- Observability
- Troubleshooting
Overview
The system is split into domain services and platform components:
- Gateway Service: entry point and request routing
- Course Service: manages course data in PostgreSQL
- Review Service: manages review data in MongoDB
- Course Composite Service: aggregates course + review responses
- Keycloak: identity provider for authn/authz
- Observability stack: Prometheus, Grafana, Loki, Tempo, Fluent Bit, OpenTelemetry Collector
Architecture
Context Diagram

Container Diagram

Component Diagram

Deployment View

Tech Stack
- Java 17, Spring Boot, Spring Cloud Gateway
- PostgreSQL (Course Service)
- MongoDB (Review Service)
- Keycloak (OAuth2/OIDC)
- OpenTelemetry, Prometheus, Grafana, Loki, Tempo, Fluent Bit
- Docker Compose and Kubernetes (Minikube + Tilt)
Prerequisites
Install the following before running:
- Java 17+
- Maven 3.8+
- Docker + Docker Compose
- (Optional) Minikube + Tilt for Kubernetes mode
- curl or HTTPie for API validation
Quick Start (Docker Compose)
Make sure Docker Engine is running.
1) Start databases
cd docker
docker compose -f docker-compose-infra.yml up --build
2) Start observability stack
cd docker
docker compose -f docker-compose-observability.yml up --build
3) Start microservices
From repository root:
sh run.sh docker
or
sh run.sh
Run with Kubernetes + Tilt
1) Start Minikube
minikube start \
--profile=microservice-deployment \
--memory=4g \
--cpus=4 \
--disk-size=30g \
--kubernetes-version=v1.31.0 \
--driver=docker
2) Enable ingress
minikube addons enable ingress --profile microservice-deployment
3) Use Minikube Docker daemon
eval $(minikube -p microservice-deployment docker-env)
4) Build images
sh build-images.sh
5) Start platform with Tilt
tilt up
Optional check:
tilt get uiresources
Each service exposes actuator metrics and Prometheus output.
Core Endpoints
Ports and hostnames depend on your local setup (Docker vs Kubernetes ingress).
Typical routes exposed through the gateway:
GET /coursePOST /courseGET /reviewPOST /reviewGET /course-composite/{courseId}
Actuator/metrics examples:
GET /actuator/healthGET /actuator/prometheus
Keycloak
Keycloak is used as the identity provider for user authentication and token issuance.
Typical local flow:
- Open Keycloak admin/UI.
- Ensure realm, clients, and users are configured.
- Get a bearer token from Keycloak.
- Call gateway APIs with
Authorization: Bearer <token>.
The token must contain both:
Observability
Prometheus
- Check service targets are UP.
- Scrape metrics from
/actuator/prometheus.
Grafana
- Use dashboards for metrics/logs/traces correlation.
Fluent Bit + Loki
- Fluent Bit forwards service logs to Loki.
Tempo + OpenTelemetry
- Services export traces through OTel collector to Tempo.
Troubleshooting
- Services fail to start: verify dependent containers (PostgreSQL, MongoDB, Keycloak) are healthy.
- Auth issues (401/403): check token expiration, client config, and realm roles in Keycloak.
- No logs/traces/metrics: ensure Fluent Bit, OTel collector, Prometheus, Loki, and Tempo are running.
- Kubernetes image pull issues: confirm you built images in Minikube Docker context (
docker-env).
Notes
- This README focuses on readable setup and operational flow.
- Architecture diagrams remain in
notes/images.
관련 프로젝트 살펴보기
불러오는 중…