From f2c8b03a8a97d0b1154f0fba5c39566260ed25fb Mon Sep 17 00:00:00 2001 From: Ramazan Sakin Date: Mon, 3 Jul 2023 08:16:03 +0300 Subject: [PATCH 1/2] grammer fixes and clean ujp - README.md up --- README.md | 80 +++++++++++++++++++++---------------------------------- 1 file changed, 30 insertions(+), 50 deletions(-) diff --git a/README.md b/README.md index 356d35eb..d1ac61dc 100644 --- a/README.md +++ b/README.md @@ -1,34 +1,30 @@ # BookStoreApp-Distributed-Application [![HitCount](http://hits.dwyl.io/devdcores/BookStoreApp-Distributed-Application.svg)](http://hits.dwyl.io/devdcores/BookStoreApp-Distributed-Application) -
- ## About this project -This is an Ecommerce project still `development in progress`, where users can adds books to the cart and buy those books. - -Application is being developed using Java, Spring and React. -Using Spring Cloud Microservices and Spring Boot Framework extensively to make this application distributed. +This is an e-commerce project `still in development`, where users can add books to a cart and buy those books. +Applications are being developed using Java, Spring and React. +This application is made distributed using Spring Cloud Microservices and Spring Boot Framework extensively. -
## Frontend Checkout Flow ![CheckOutFlow](https://user-images.githubusercontent.com/14878408/103235826-06d5ca00-4969-11eb-87c8-ce618034b4f3.gif) ## Architecture -All the Microservices are developed using spring boot. -This spring boot applications will be registered with eureka discovery server. -FrontEnd React App makes request's to NGINX server which acts as a reverse proxy. +All the Microservices are developed using Spring Boot. +These Spring Boot applications will be registered with eureka discovery server. + +The Frontend React App makes requests to the NGINX server, which acts as a reverse proxy. NGINX server redirects the requests to Zuul API Gateway. -Zuul will route the requests to microservice -based on the url route. Zuul also registers with eureka and gets the ip/domain from eureka for microservice while routing the request. +Zuul will route the requests to microservices based on the URL route. +Zuul registers with Eureka and gets the IP/domain from Eureka for microservices when routing the request. -
## Run this project in Local Machine ->Frontend App +> Frontend App Navigate to `bookstore-frontend-react-app` folder Run below commnads to start Frontend React Application @@ -38,21 +34,22 @@ yarn install yarn start ``` ->Backend Services -> -To Start Backend Services follow below steps. ->Using Intellij/Eclipse or Command Line +> Backend Services + +To Start Backend Services, follow the below steps: + +> Using Intellij/Eclipse or Command Line Import this project into IDE and run all Spring boot projects or build all the jars running `mvn clean install` command in root parent pom, which builds all jars. -All services will be up in the below mentioned ports. +All services will be up in the below-mentioned ports. But running this way we wont get monitoring of microservices. So if monitoring needed to see metrics like jvm memory, tomcat error count and other metrics. Use below method to deploy all the services and monitoring setup in docker. ->Using Docker(Recommended) +> Using Docker(Recommended) Start Docker Engine in your machine. @@ -75,60 +72,47 @@ Order Service : 7001 Payment Service : 8001 ``` -
### Service Discovery -This project uses Eureka or Consul as Discovery service. -While running services in local, then using eureka as service discovery. +This project uses Eureka or Consul as a discovery service. While running services locally, Eureka is used as a service discovery. While running using Docker, Consul is used as the service discovery. -While running using docker, then consul is the service discovery. +The reason for using Consul is that it has better features and support than Eureka. Running services individually locally uses Eureka as a service discovery because running a Consul agent and setting it up becomes an extra overhead to manage. Since Docker compose manages all Consul stuff, Consul is used while running services in Docker. -Reason to use Consul is it has better features and support compared to Eureka. Running services individually in local uses Eureka as service discovery because dont want to run consul agent and set it up as it becomes extra overhead to manage. Since docker-compose manages all consul stuff hence using Consul while running services in docker. - -
### Troubleshooting -If any issue while starting up services or any api failing. -It may be because of new columns or new tables, at this point of time i am not worried much about DB migrations. +If you encounter any issues while starting up the services or if any APIs are failing, it may be because of new columns or new tables in the database. At this point in time, I am not worried about database migrations. -So any issues, **clear/drop bookstore_db**, things may start working agai, if not **raise a Issue in Github** i will help. +So for any issue, **clear/drop bookstore_db**, things may start working again, if not **raise an Issue in Github** i will help. -
## Deployment(In Future It will be deployed like this) -AWS is the cloud provider will be using to deploy this project. - -Project wil deployed in multiple Regions and multiple Availability Zones. - -React App, Zuul and Eureka will be the public facing service, which will be in public subnet -All the microservices will be packed into docker containers and deployes in the AWS ECS in the private subnet. +AWS will be the cloud provider used to deploy this project. The project will be deployed in multiple regions and multiple availability zones. The React App, Zuul, and Eureka will be the public-facing services, which will be in the public subnet. -Private subnets uses NAT Gateway to make requests to external internet. +All the microservices will be packaged into Docker containers and deployed in AWS Elastic Container Service (ECS) in the private subnet. Private subnets use a NAT gateway to make requests to the external internet. Bastian host can be used to ssh into private subnet microservices. -Bastian host can be used to ssh into private subnet microservices. - -Below is the AWS Architecture diagram for better understanding. +Below is the AWS architecture diagram for better understanding: ![Bookstore Final](https://user-images.githubusercontent.com/14878408/65784998-000e4500-e171-11e9-96d7-b7c199e74c4c.jpg) -
## Monitoring -There are 2 setups for monitoring + +There are 2 setups for monitoring: 1. Prometheus and Graphana. 2. TICK stack monitoring. -Both the setups are very powerful, where prometheus works on pull model. we have to provide target hosts where the prometheus can pull the metrics from. If we specify target hosts using individual hostname/ip its not feasible at end because it will be like hard coded hostnames/ip. So we use Consul discovery to provide target hosts dynamically. By this way when more instances added for same service no need to worry about adding to prometheus target hosts because consul will dynamically add this target in prometheus. +Both setups are very powerful. Prometheus works on a pull model, meaning that it pulls metrics from target hosts. If we specify target hosts using individual hostnames or IP addresses, this is not feasible in the long run because it would be like hardcoding hostnames or IP addresses. Instead, we use Consul discovery to provide target hosts dynamically. This way, when more instances of the same service are added, we don't need to worry about adding them to Prometheus's list of target hosts. Consul will dynamically add these targets to Prometheus. + +TICK (Telegraf, InfluxDB, Chronograf, Kapacitor) is a setup that is gaining more attention because it uses both a push and pull model. InfluxDB is a time series database. Bookstore services push metrics to InfluxDB (push model). In Telegraf, we specify the targets from which we want to pull metrics (pull model). Chronograf/Grafana can be used to view graphs and charts. Kapacitor is used to configure rules for alarms. -TICK(Telegraf, InfluxDB, Chronograf, Kapacitor) This setup is getting more attention due to its push and pull model. InfluxDB is a time series database, bookstore services push the metrics to influxDB(push model), In Telegraf we specify the targets to pull metrics(pull model). Chronograf/Graphana can be used to view the graph/charts. Kapacitor is used to configure rules for alarms. `docker-compose` will take care of bringing all this monitoring containers up. -Dashboards are available at below ports +Dashboards are available at below ports: ``` Graphana : 3030 @@ -149,7 +133,6 @@ Password : admin ``` -
**Screenshots of Tracing in Zipkin.** @@ -157,7 +140,6 @@ Password : admin
Zipkin -
**Screenshots of Monitoring in Graphana.** @@ -166,7 +148,6 @@ Password : admin Screen Shot 2019-10-16 at 9 16 12 PM -
**Screenshots of Monitoring in Chronograf(TICK).** @@ -174,7 +155,6 @@ Password : admin ![Screen Shot 2019-10-16 at 12 52 08 PM](https://user-images.githubusercontent.com/14878408/66934482-2e888d00-f058-11e9-8dea-f1f275765265.png) -
> Account Service From 850193efa686da597691903cb87d3329dab8ce9d Mon Sep 17 00:00:00 2001 From: Ramazan Sakin Date: Mon, 3 Jul 2023 08:18:10 +0300 Subject: [PATCH 2/2] README.md up++ --- README.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index d1ac61dc..a2362710 100644 --- a/README.md +++ b/README.md @@ -144,15 +144,14 @@ Password : admin **Screenshots of Monitoring in Graphana.** Screen Shot 2019-10-16 at 9 16 21 PM - - +
Screen Shot 2019-10-16 at 9 16 12 PM **Screenshots of Monitoring in Chronograf(TICK).** ![Screen Shot 2019-10-16 at 12 44 20 PM](https://user-images.githubusercontent.com/14878408/66934353-f8e3a400-f057-11e9-82ab-eda7a230c09d.png) - +
![Screen Shot 2019-10-16 at 12 52 08 PM](https://user-images.githubusercontent.com/14878408/66934482-2e888d00-f058-11e9-8dea-f1f275765265.png) @@ -184,4 +183,3 @@ password: 'cores.devd123' ```curl 93ed453e-b7ac-4192-a6d4-c45fae0d99ac:client.devd123@localhost:4001/oauth/token -d grant_type=password -d username=admin.admin -d password=admin.devd123``` -