Skip to content

Commit 93a5dba

Browse files
committed
Adding diagram and documentation.
1 parent 4cce07d commit 93a5dba

File tree

2 files changed

+74
-55
lines changed

2 files changed

+74
-55
lines changed

README.md

Lines changed: 74 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,56 @@
11
# Springy Store μServices
22

3-
- This project is a development of a small set of Spring Boot based Microservices projects, that implement cloud-native intuitive, design patterns and coding best practices.
3+
- This project is a development of a small set of **Spring Boot** and **Cloud** based Microservices projects, that implement cloud-native intuitive, Reactive Programming, Event-driven, Microservices design patterns and coding best practices.
44
- The project follows [**CloudNative**](https://www.cncf.io/) recommendations and The [**twelve-factor app**](https://12factor.net/) methodology for building *software-as-a-service apps* to show how μServices should be built and deployed.
5-
- The project is using cutting edge technologies like Docker, Kubernetes, Elasticsearch Stack for logging and monitoring, Java SE 14, MySQL database, MongoDB, TDD, unit, integration & performance testing and Reactive Programming, and many more.
5+
- This project is using cutting edge technologies like Docker, Kubernetes, Elasticsearch Stack for logging and monitoring, Java SE 14, MySQL, and MongoDB databases, all components developed with TDD in mind, covering integration & performance testing, and many more.
66

77
------
8-
98
I am developing this project as stages, and all such stages are documented under project
10-
**Springy Store μServices** [wiki page](https://github.com/mohamed-taman/Springy-Store-Microservices/wiki). Each of such stage will be a release in its owen, so you can go back and
11-
forward
12-
between releases to see the differences and how adding things solve specific problems we face.
9+
**Springy Store μServices** [wiki page](https://github.com/mohamed-taman/Springy-Store-Microservices/wiki). Each of such stage will be a release in its own, so you can go back and
10+
forward between releases to see the differences and how adding things solve specific problems we face.
1311

14-
For example; in the first stage (1st release) I just created project structure, basic services' skeleton, integration between them, and finally write integration testing as well as semi-automated testing for the whole services' functionality.
12+
<u>For example;</u> in the first stage (1st release) I just created project structure, basic services' skeleton, integration between them, and finally write integration testing as well as semi-automated testing for the whole services' functionality.
1513

16-
At 1st stage the **Recommendation** and **Review** microservices generate local in-memory data
17-
and **Store Service** calls the other three services (*Product*, *Recommendation*, and *Review*) statically to generate client aggregate response for a specific product. Therefore, in:
14+
At the 1st stage the **Recommendation** and **Review** microservices generate local in-memory data and **Store Service** calls the other three services (*Product*, *Recommendation*, and *Review*) statically to generate client aggregate response for a specific product. Therefore, in:
1815

1916
- The second stage I will introduce **database integration**, then in (***done***)
2017
- The third stage I will introduce **Dockerization** of our services and **docker-compose**, and in (***done***)
2118
- The fourth stage I will introduce **service discovery**, and so on.
2219

20+
## System components Structure
21+
Let's explain first the system structure to understand its components:
22+
**Springy Store μService** --> *Parent folder.*
23+
|- **config** --> *All system configuration files*
24+
|- **docs** --> *All docs and diagrams.*
25+
|- **store-base**
26+
|- **store-build-chassis** --> *Super Parent POM, contains all build information*
27+
|- **store-cloud-chassis** --> *Cloud services Parent POM, inherit from build contains all cloud libraries*
28+
|- **store-service-chassis** --> *Parent POM, inherits from cloud contains all microservices common libraries*
29+
|-**store-cloud-infra**
30+
|- **eureka-server** --> *Service discovery server*
31+
|-**store-common**
32+
|- **store-api** --> *API Endpoint and services definitions for all microservices*
33+
|- **store-utils** --> *Common utilities shared between all components*
34+
|-**store-services**
35+
|- **product-service** --> *Product Microservice*
36+
|- **recommendation-service** --> *Recommendation Microservice*
37+
|- **review-service** --> *Review Microservice*
38+
|- **store-service** --> *Store Microservice*
39+
|- **docker-compose.yml** --> *contains all services landscape with RabbitMQ*
40+
|- **docker-compose-kafka.yml** --> *contains all services landscape with more instances working with Kafka with partitions*
41+
|- **docker-compose-partitions.yml** *--> contains all services landscape with more instances working with RabbitMQ with partitions*
42+
|- **run-em-all.sh** *--> Run all microservices in separate mode.*
43+
|- **setup.sh** *--> Install all shared POMs and shared libraries.*
44+
|- **stop-em-all.sh** *--> Stop all services runs in standalone mode.*
45+
|- **test-em-all.sh** *--> This will start all docker compose landscape and test them, then shutdown docker compose containers with test finishes (use switch start stop)*
46+
47+
Now as we have learned about different system components, then let's start.
48+
2349
## Getting started
2450

2551
The first stage aka (**Release v1.0**) is about creating and implementing a set of project Microservices.
2652

27-
### Creating a Set of Cooperating Microservices
53+
### Creating a Set of Cooperating Microservices (Release v1.0)
2854

2955
The following topics are going to be covered in this 1st stage (other stages topics to be documented
3056
in a
@@ -39,7 +65,7 @@ The following topics are going to be covered in this 1st stage (other stages top
3965
- Adding automated tests of microservices in isolation.
4066
- Adding semi-automated tests to a microservice landscape.
4167

42-
### System Boundary - μServices Landscape (Release 4)
68+
### System Boundary - μServices Landscape (Release 4.5-Latest)
4369

4470
![System Boundary](docs/stage1/app_ms_landscape.png)
4571

@@ -85,11 +111,9 @@ To build and run test cases for each service & shared modules in the project we
85111

86112
#### First: Build & Install Shared Dependencies
87113

88-
> This done only for the first time or any new version of shared modules.
114+
> This done only for the first time or any new changes or versions of shared modules and POMs.
89115
90-
To build and install `store-build-chassis`, `store-utils`, `store-api`, `store-chassis` libraries
91-
, from the root
92-
folder `springy-store-microservices` run the following commands:
116+
To build and install `store-build-chassis`, `store-utils`, `store-api`, `store-chassis` libraries, from the root folder `springy-store-microservices` run the following commands:
93117

94118
```bash
95119
mohamed.taman@DTLNV8 ~/springy-store-microservices
@@ -99,25 +123,27 @@ mohamed.taman@DTLNV8 ~/springy-store-microservices
99123
Now you should expect output like this:
100124

101125
```bash
102-
Installing all Springy store core shared modules
103-
................................................
126+
Installing all Springy store core shared modules & Parent POMs
127+
...............................................................
104128

105129
1- Installing [Parent Build Chassis] module...
106130
Done successfully.
107131

108-
2- Installing shared [Services Utilities] module...
132+
2- Installing [Parent Cloud Chassis] module...
109133
Done successfully.
110134

111-
3- Installing shared [Services APIs] module...
135+
3- Installing shared [Services Utilities] module...
112136
Done successfully.
113137

114-
4- Installing [Services Parent Chassis] module...
138+
4- Installing shared [Services APIs] module...
139+
Done successfully.
140+
141+
5- Installing [Services Parent Chassis] module...
115142
Done successfully.
116143

117144
Woohoo, building & installing all project modules are finished successfully.
118145
The project is ready for the next step. :)
119146
```
120-
121147
#### Second: Build & Test Microservices
122148
Now it is time to build our **4 microservices** and run each service integration test in
123149
isolation by running the following commands:
@@ -130,49 +156,47 @@ mohamed.taman@DTLNV8 ~/springy-store-microservices
130156
All build commands and test suite for each microservice should run successfully, and the final output should be like this:
131157

132158
```bash
133-
[INFO] ---------------< com.siriusxi.ms.store:store-aggregator >---------------
134-
[INFO] Building Springy Store Aggregator 1.0-SNAPSHOT [9/9]
159+
---------------< com.siriusxi.ms.store:store-aggregator >---------------
160+
[INFO] Building Springy Store Aggregator 1.0-SNAPSHOT [11/11]
135161
[INFO] --------------------------------[ pom ]---------------------------------
136162
[INFO]
137163
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ store-aggregator ---
138164
[INFO] ------------------------------------------------------------------------
139165
[INFO] Reactor Summary for Springy Store Aggregator 1.0-SNAPSHOT:
140166
[INFO]
141-
[INFO] Springy Store Build Chassis ........................ SUCCESS [ 0.276 s]
142-
[INFO] Springy Store APIs ................................. SUCCESS [ 3.920 s]
143-
[INFO] Springy Store Utils ................................ SUCCESS [ 1.508 s]
144-
[INFO] Springy Store Chassis .............................. SUCCESS [ 0.608 s]
145-
[INFO] Store Service ...................................... SUCCESS [ 4.073 s]
146-
[INFO] Product Service .................................... SUCCESS [ 2.710 s]
147-
[INFO] Review Service ..................................... SUCCESS [ 2.633 s]
148-
[INFO] Recommendation Service ............................. SUCCESS [ 2.615 s]
149-
[INFO] Springy Store Aggregator ........................... SUCCESS [ 0.071 s]
167+
[INFO] Springy Store Build Chassis ........................ SUCCESS [ 0.228 s]
168+
[INFO] Springy Store Cloud Chassis ........................ SUCCESS [ 1.257 s]
169+
[INFO] Store APIs ......................................... SUCCESS [ 4.279 s]
170+
[INFO] Store Utils ........................................ SUCCESS [ 1.809 s]
171+
[INFO] Springy Store Chassis .............................. SUCCESS [ 0.857 s]
172+
[INFO] Product Service .................................... SUCCESS [ 13.079 s]
173+
[INFO] Review Service ..................................... SUCCESS [ 9.332 s]
174+
[INFO] Recommendation Service ............................. SUCCESS [ 8.463 s]
175+
[INFO] Store Service ...................................... SUCCESS [ 8.927 s]
176+
[INFO] Eureka Discovery Server ............................ SUCCESS [ 6.536 s]
177+
[INFO] Springy Store Aggregator ........................... SUCCESS [ 0.100 s]
150178
[INFO] ------------------------------------------------------------------------
151179
[INFO] BUILD SUCCESS
152180
[INFO] ------------------------------------------------------------------------
153-
[INFO] Total time: 18.900 s
154-
[INFO] Finished at: 2020-04-09T01:33:14+02:00
181+
[INFO] Total time: 55.663 s
182+
[INFO] Finished at: 2020-04-26T03:38:34+02:00
155183
[INFO] ------------------------------------------------------------------------
156184
```
157185

158186
### Running Them All
159187
#### Using RabbitMQ without the use of partitions
160-
Now it's the time to run all of our reactive Microservices, and it's very simple just run the
161-
following
162-
`docker-compose` commands:
188+
Now it's the time to run all of our reactive Microservices, and it's very simple just run the following `docker-compose` commands:
163189

164190
```bash
165191
mohamed.taman@DTLNV8 ~/springy-store-microservices
166192
λ docker-compose -p ssm up -d
167193
```
168194

169-
All the **services**, **databases**, and **messaging service** will run in parallel in detach
170-
mode
171-
(option `-d`), and
172-
command output will print to the console the following:
195+
All the **services**, **databases**, and **messaging service** will run in parallel in detach mode (option `-d`), and command output will print to the console the following:
173196

174197
```bash
175198
Creating network "ssm_default" with the default driver
199+
Creating ssm_eureka_1 ... done
176200
Creating ssm_mysql_1 ... done
177201
Creating ssm_mongodb_1 ... done
178202
Creating ssm_rabbitmq_1 ... done
@@ -186,23 +210,18 @@ Creating ssm_recommendation_1 ... done
186210
You can manually test `Store Service` APIs throughout its **Swagger** interface at the following
187211
URL [http://localhost:8080/swagger-ui.html](http://localhost:8080/swagger-ui.html).
188212
#### Access RabbitMQ
189-
In browser point to this URL [http://localhost:5672/](http://localhost:5672/) `username: guest
190-
` and `password: guest`, and you can see all **topics**, **DLQs**, **partitions**, and payload.
213+
In browser point to this URL [http://localhost:5672/](http://localhost:5672/) `username: guest` and `password: guest`, and you can see all **topics**, **DLQs**, **partitions**, and payload.
191214

192-
1. For running 2 instances of each service and using _RabbitMQ with two partitions per topic_, use
193-
the following
194-
`docker-compose` command:
215+
1. For running 2 instances of each service and using _RabbitMQ with two partitions per topic_, use the following `docker-compose` command:
195216
```bash
196217
mohamed.taman@DTLNV8 ~/springy-store-microservices
197218
λ docker-compose -p ssm -f docker-compose-partitions.yml up -d
198219
```
199-
1. To use _Kafka and Zookeeper with two partitions per topic_ run the following
200-
command:
201-
```bash
220+
1. To use _Kafka and Zookeeper with two partitions per topic_ run the following command:
221+
```bash
202222
mohamed.taman@DTLNV8 ~/springy-store-microservices
203223
λ docker-compose -p ssm -f docker-compose-kafka.yml up -d
204-
```
205-
224+
```
206225
#### Check All Services Health
207226
From Store front Service we can check all the core services health, when you have all the
208227
microservices up and running using Docker Compose,
@@ -250,7 +269,7 @@ Now it's time to test all the application functionality as one part. To do so ju
250269
251270
```bash
252271
mohamed.taman@DTLNV8 ~/springy-store-microservices
253-
λ ./test-em-all.sh
272+
λ ./test-em-all.sh start stop
254273
```
255274
256275
The result will look like this:
@@ -305,20 +324,20 @@ Stopping ssm_mongodb_1 ... done
305324
Stopping ssm_store_1 ... done
306325
Stopping ssm_mysql_1 ... done
307326
Stopping ssm_rabbitmq_1 ... done
327+
Stopping ssm_eureka_1 ... done
308328
Removing ssm_recommendation_1 ... done
309329
Removing ssm_product_1 ... done
310330
Removing ssm_review_1 ... done
311331
Removing ssm_mongodb_1 ... done
312332
Removing ssm_store_1 ... done
313333
Removing ssm_mysql_1 ... done
314334
Removing ssm_rabbitmq_1 ... done
335+
Removing ssm_eureka_1 ... done
315336
Removing network ssm_default
316337
```
317-
318338
### The End
319339
Happy coding :)
320340
321341
# License
322342
Copyright (C) 2017-2020 Mohamed Taman
323-
324-
Licensed under the MIT License.
343+
Licensed under the MIT License.

docs/stage1/app_ms_landscape.png

-57.2 KB
Loading

0 commit comments

Comments
 (0)