Skip to content

Commit 449b4be

Browse files
committed
Readme added
1 parent f29830f commit 449b4be

File tree

1 file changed

+102
-5
lines changed

1 file changed

+102
-5
lines changed

README.md

+102-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,102 @@
1-
Spring boot 3.4.3
2-
Kubernetes
3-
Keycloak
4-
Mongo
5-
Postgres
1+
# Table of Contents
2+
- [Background](#background)
3+
- [Architecture](#architecture)
4+
- [Prerequisites](#prerequisites)
5+
6+
7+
# Background
8+
A foundational framework for building **Spring Boot**-based microservices, designed for a **modular**, **scalable**, and **observable** system to manage **courses** and **reviews**. It incorporates **Spring Security** with **OAuth 2.0** via **Keycloak** for **authentication** and **Spring Cloud Gateway** as the **API gateway**. The architecture integrates a modern **observability stack**, including **OpenTelemetry (OTel)**, **Grafana**, **Loki**, **Tempo**, and **Prometheus**. **MongoDB** and **PostgreSQL** serve as **persistent storage** solutions. Deployment is supported through **Docker Compose** for **local environments** and **Kubernetes** for **scalable deployments**. The system utilizes **Spring Boot** and **Spring Cloud** to enable seamless **microservices communication**, **security**, and **observability**.
9+
10+
# Architecture
11+
### Level 1: System Context Diagram
12+
**Description**: High-level view of the system and its external actors.
13+
14+
- **System**: Course Management System
15+
- A microservices-based application for managing courses and reviews.
16+
- **Actors**:
17+
- **User**: Browses courses and submits reviews (via browser/API).
18+
- **Administrator**: Manages content and monitors system health.
19+
- **External Systems**:
20+
- **Keycloak**: Authentication and authorization (OIDC/OAuth2).
21+
- **Grafana Observability Stack**: Grafana, Loki, Tempo, Fluent-bit, and OpenTelemetry (Otel) for monitoring and logging.
22+
- **Interactions**:
23+
- User → System: HTTP requests via Gateway.
24+
- System → Keycloak: Authenticates users.
25+
- System → Grafana Stack: Sends observability data.
26+
27+
### Level 2: Container Diagram
28+
**Description**: Breaks the system into deployable units.
29+
30+
- **Containers**:
31+
1. **API Gateway (Spring Cloud Gateway)**
32+
- Tech: Spring Boot + Spring Cloud Gateway
33+
- Role: Routes requests, enforces security.
34+
- Interactions: User → Gateway → CourseComposite.
35+
2. **CourseComposite (Aggregate Microservice)**
36+
- Tech: Spring Boot
37+
- Role: Aggregates Course and Review data.
38+
- Interactions: Gateway → CourseComposite → Course/Review.
39+
3. **Course (Core Microservice)**
40+
- Tech: Spring Boot
41+
- Role: Manages course data.
42+
- Database: PostgreSQL
43+
- Interactions: CourseComposite → Course → PostgreSQL.
44+
4. **Review (Core Microservice)**
45+
- Tech: Spring Boot
46+
- Role: Manages review data.
47+
- Database: MongoDB
48+
- Interactions: CourseComposite → Review → MongoDB.
49+
5. **Keycloak**
50+
- Role: External auth provider.
51+
- Interactions: Gateway → Keycloak.
52+
6. **Observability Stack**:
53+
- **Fluent-bit**: Log collection.
54+
- **OpenTelemetry (OTel)**: Trace.
55+
- **Loki**: Log storage.
56+
- **Tempo**: Trace storage.
57+
- **Grafana**: Visualization.
58+
- Interactions: Microservices → Fluent-bit/OTel → Loki/Tempo → Grafana.
59+
60+
### Level 3: Component Diagram
61+
**Description**: Key components within containers.
62+
63+
- **API Gateway**:
64+
- Routing Component (Spring Cloud Gateway).
65+
- Security Component (Keycloak integration).
66+
- Observability Agent (OTel + Fluent-bit).
67+
- **CourseComposite**:
68+
- Course Client (REST).
69+
- Review Client (REST).
70+
- Aggregation Logic.
71+
- Observability Agent.
72+
- **Course**:
73+
- Course Controller (REST).
74+
- Course Service (Logic).
75+
- Course Repository (JPA/PostgreSQL).
76+
- Observability Agent.
77+
- **Review**:
78+
- Review Controller (REST).
79+
- Review Service (Logic).
80+
- Review Repository (MongoDB).
81+
- Observability Agent.
82+
83+
### Level 4: Deployment Notes
84+
**Description**: Two deployment setups.
85+
86+
1. **Docker Compose Setup**:
87+
- Containers: Gateway, CourseComposite, Course + PostgreSQL, Review + MongoDB, Keycloak, Observability Stack.
88+
- Networking: Single Docker network.
89+
- Config: `docker-compose.yml`.
90+
91+
2. **Kubernetes Setup with Tilt**:
92+
- Pods: Gateway, CourseComposite, Course + PostgreSQL, Review + MongoDB, Keycloak, Observability Pods.
93+
- Resources: Ingress, Services, ConfigMaps/Secrets, PVCs.
94+
- Tilt: Automates dev with live updates.
95+
- Observability: Fluent-bit DaemonSet
96+
97+
### Additional Notes
98+
- **Tech**: Spring Boot, Spring Cloud, JPA, MongoDB driver, OTel, Fluent-bit.
99+
- **Interactions**: REST/HTTP, JDBC, MongoDB protocol.
100+
- **Scalability**: Kubernetes supports replicas; Docker Compose for local dev.
101+
102+
# Prerequisites

0 commit comments

Comments
 (0)