-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtemp.txt
80 lines (55 loc) · 3.91 KB
/
temp.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
Prerequisite:
Java 8
Docker (I was using docker for desktop windows version=18.09.2)
Kubernetes (I was using built in "docker for desktop" kubernetes)
Clone this repository and run "mvn clean install" inside all four projects (CatalogService, EurekaServer, Gateway, CatalogData)
Project Explanation :
I found many examples over Internet which covering topics like "Springboot Microservice Architecture" or "Deploy Microservices on Docker Containers" or "Manage Docker Images with Kubertenes clusters". But didn't found which covering all topics in single example step by step.
In this project I have created 3 Eureka Clients (CatalogService, Gateway, CatalogData) and one Eureka Server (EurekaServer).
EurekaServer: This microservice is acting as Eureka Server, all other service register themselves in EurekaServer.
Gateway: This microservice acting as a proxy server.
CatalogData: This microservice acting as Database layer.
CatalogService: This microservice is a middle layer between Gateway and CatalogData.
*Note: In this project I was not maintaining any business login, propose of this project to build our understanding towards Microservice Architecture and DevOps parts in Microservice world. That why we are not making any database interaction in "CatalogData" service and maintaining in memory list.
https://github.com/vineetkala11/Microservice/blob/master/img/flow-diagram.png
Services Description:
Here are trying to implement Microservice Architecture using these four services. Quick look in role of each service in this Architecture and implementation of Spring module in each service.
EurekaServer : Eureka Server (refer to code to check implementation)
Gateway: Eureka Client, Implemented Zuul Proxy Gateway (refer to code to check implementation)
CatalogService: Eureka Client, Feign (Rest Client), Ribbon (Load Balancer), Hystrix (Circuit Breaker) (refer to code to check implementation)
CatalogData: Eureka Client (refer to code to check implementation)
Usage:
Run project as a Spring boot application:
Import all four project as a maven project in your IDE (I am using eclipse as IDE).
Right click EurekaServer project and run as a Spring boot Application.
- Open browser and try to access http://localhost:8761/ .If everything setup correctly you are able to view Eureka server home page.
Our Eureka server is running and ready to register Eureka Clients.
Run other three Services (CatalogService, Gateway, CatalogData) as Spring Boot application, once all three clients up and running, again try to access http://localhost:8761/ ,you will find all three services is registered in Eureka client.
At this moment all four service is up and running. Before hitting our API, I would like to share PORT details for each service as describe in application.properties file.
- EurekaServer: 8761
- Gateway: 8084
- CatalogService: 8100
- CatalogData: 8000
Its time to check our Gateway API response, open browser and try to access Gateway proxy url http://localhost:8084/catservice/service/fetchCatalog .You must be seeing below response in your screen.
Here we redirected our Gateway Proxy Url towards CatalogService endpoint, to verify Gateway proxy configuration please refer to application.properties file line no 5
With docker-compose:
For this segment we need docker installed in our machine.
Refer to Dockerfile in each service
Running as a Springboot project:
Eureka Server : http://localhost:8761/
Gateway: http://localhost:8084/catservice/service/fetchCatalog
http://localhost:8100/service/fetchCatalog
http://localhost:8000/catalog/getAllCatalog
mesh network
muel usb
tifco queue
Docker compose:
http://localhost:8761/
http://localhost:8084/catservice/service/fetchCatalog
http://localhost:32771/service/fetchCatalog
http://localhost:32769/catalog/getAllCatalog
kubernetes:
https://localhost/
https://localhost/api/catservice/service/fetchCatalog
https://localhost/cts/service/fetchCatalog
https://localhost/data/catalog/getAllCatalog