@@ -111,7 +111,7 @@ create microservice:
111111 resilience4j.ratelimiter.instances.default.limitRefreshPeriod=10s
112112
1131134.
114- -------------- Zipkin Distrubuted Tracing System ----------------
114+ -------------- Zipkin Distributed Tracing System ----------------
115115
116116api-gateway -----> Currency Conversion Microservice ----> Currency Exchange Microservice
117117 - - -
@@ -163,11 +163,79 @@ run services and go to http://localhost:9411/zipkin/ , click Run Query
163163view requests on zipkin UI.
164164
165165--------------------------
166+ ----DOCKER CONTAINER---
167+ This plugin helps to us create image for our container.
168+ IF_NOT_PRESENT--> search image first locally, if not present pull from docker hub
169+
170+
171+ <build>
172+ <plugins>
173+ <plugin>
174+ <groupId>org.springframework.boot</groupId>
175+ <artifactId>spring-boot-maven-plugin</artifactId>
176+ <configuration>
177+ <image>
178+ <name>serdarkocerr/mmv2-${project.artifactId}:${project.version}</name>
179+ </image>
180+ <pullPolicy>IF_NOT_PRESENT</pullPolicy>
181+ </configuration>
182+ </plugin>
183+ </plugins>
184+ </build>
185+
186+
187+ Create image:
188+ Run as -> Maven Build... -> Goal = spring-boot:build-image -DskipTests
189+
190+ docker run -p 8000:8000 serdarkocerr/microservices-currency-exchange-service:0.0.1-SNAPSHOT
191+ test --> http://localhost:8000/currency-exchange/from/USD/to/TRY
192+
193+ Docker compose run multiple services from yaml file. So that create docker-compose.yml file
194+ docker-compose --version
195+
196+ run from yml file
197+ docker-compose up
198+
199+ go to:
200+ -http://localhost:8765/currency-exchange/from/USD/to/TRY
201+ -http://localhost:8100/currency-conversion-feign/from/USD/to/TRY/quantity/10
202+ -http://localhost:8000/currency-exchange/from/USD/to/TRY
203+ -http://localhost:8100/currency-conversion/from/USD/to/TRY/quantity/10 --> will not work.
204+ Because in controller response uri set as localhost. So you can change it
205+ using application.properties variable from docker image.!!
206+
207+
208+
209+
210+ NOTE: eureka url in currency-exchange-server's application.properties saved as
211+ eureka.client.serviceUrl.defaultZone=http://localhost:8761/eureka
212+ but localhost is not same currency-exchange-server container and naming-server container.
213+ so that you have to set as naming-server ip address or set environment in docker-compose.yml
214+ file to register naming-server.
215+ environment:
216+ EUREKA.CLIENT.SERVICEURL.DEFAULTZONE: http://naming-server:8761/eureka
217+ Ayni durum ZIPKIN server icinde gecerlidir.
218+
219+
220+ ----------------------
221+
222+
166223---- With Rabbit MQ ------
167- What if Zipkin gone or not running? you should your trace in mq like rabbitMQ
168-
224+ What if Zipkin is gone or not running? microservices can put information to mq like rabbitMQ.
225+
226+ Normally zipkin sendr type have to define in application.properties as
227+ 'spring.zipkin.sender.type=web' but default is web so that you dont have to define.
169228
229+ If you decide to use rabbit mq, you should set
230+ 'spring.zipkin.sender.type=rabbit' or
231+ if you use docker container, you can define environment in yaml as
232+ 'SPRING.ZIPKIN.SENDER.TYPE: rabbit
170233
234+ add rabbit mq server in yaml to run RABBIT MQ in docker container.
235+
236+ Also add rabbit mq settings to environment in yaml file.
237+
238+ -----------------------------------------------------------------------
171239
172240
173241
0 commit comments