Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rapter1990/springbootmicroservicedailybuffer
Spring Cloud Example (API Gateway, Zipkin, Redis, Authentication, Config Server, Docker, Kubernetes )
https://github.com/rapter1990/springbootmicroservicedailybuffer
api-gateway config-server docker docker-compose eureka-server java jenkins jenkinsfile junit kubernetes microservice mysql postman-collection redis resillience4j services spring-boot spring-cloud spring-security zipkin
Last synced: about 3 hours ago
JSON representation
Spring Cloud Example (API Gateway, Zipkin, Redis, Authentication, Config Server, Docker, Kubernetes )
- Host: GitHub
- URL: https://github.com/rapter1990/springbootmicroservicedailybuffer
- Owner: Rapter1990
- Created: 2022-12-16T21:39:46.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2023-02-23T10:15:57.000Z (over 1 year ago)
- Last Synced: 2024-04-24T06:34:07.665Z (7 months ago)
- Topics: api-gateway, config-server, docker, docker-compose, eureka-server, java, jenkins, jenkinsfile, junit, kubernetes, microservice, mysql, postman-collection, redis, resillience4j, services, spring-boot, spring-cloud, spring-security, zipkin
- Language: Java
- Homepage:
- Size: 1.16 MB
- Stars: 55
- Watchers: 3
- Forks: 26
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Spring Boot Microservice Example (Eureka Server, Config Server, API Gateway, Services , Zipkin, Redis, Resilience4j, Docker, Kubernetes)
# About the project
- This project is based Spring Boot Microservices with the usage of Docker and Kubernetes
- User can register and login through auth service by user role (ADMIN or USER) through api gateway
- User can send any request to relevant service through api gateway with its bearer token
7 services whose name are shown below have been devised within the scope of this project.
- Config Server
- Eureka Server
- API Gateway
- Auth Service
- Order Service
- Payment Service
- Product Service
### Docker Hub
Link
### Git Backend for Config server
Link
### Explore Rest APIs
Method
Url
Description
Valid Request Body
Valid Request Params
Valid Request Params and Body
POST
authenticate/signup
Signup for User and Admin
Info
POST
authenticate/login
Login for User and Admin
Info
POST
authenticate/refreshtoken
Refresh Token for User and Admin
Info
POST
/product
Add Product
Info
GET
/product/{product_id}
Get Product By Id
Info
PUT
/reduceQuantity/{product_id}?quantity={quantity_value}
Reduce Quantity of Product
Info
DELETE
/product/{product_id}
Delete Prodcut By Id
Info
POST
/order/placeorder
Place Order
Info
GET
/order/{order_id}
Get Order By Id
Info
GET
/payment/order/{order_id}
Get Payment Details by Order Id
Info
### Used Dependencies
* Core
* Spring
* Spring Boot
* Spring Boot Test (Junit)
* Spring Security
* Spring Web
* RestTemplate
* FeighClient
* Spring Data
* Spring Data JPA
* Spring Cloud
* Spring Cloud Gateway Server
* Spring Cloud Config Server
* Spring Cloud Config Client
* Netflix
* Eureka Server
* Eureka Client
* Database
* Mysql
* Redis
* Zipkin
* Docker
* Kubernetes
* Jenkins
* Junit
* Log4j2
## Valid Request Body
## Valid Request Params
## Valid Request Params and Body
##### Get Product By Id
```
http://localhost:9090/product/{prodcutId}
Bearer Token : User Token
```
##### Delete Product By Id
```
http://localhost:9090/product/{prodcutId}
Bearer Token : Admin Token
```
##### Delete Product By Id
```
http://localhost:9090/order/{order_id}
Bearer Token : User Token
```
### 🔨 Run the App
Local
1 ) Download your project from this link `https://github.com/Rapter1990/springbootmicroservicedailybuffer`
2 ) Go to the project's home directory : `cd springbootmicroservicedailybuffer`
3 ) Run Service Registry (Eureka Server)
4 ) Run config server
5 ) Run zipkin and redis through these commands shown below on Docker
```
docker run -d -p 9411:9411 openzipkin/zipkin
docker run -d --name redis -p 6379:6379 redis
```
6 ) Run api gateway
7 ) Run other services (auth-service, orderservice, paymentservice and lastly productservice)
Docker
1 ) Install Docker Desktop. Here is the installation link : https://docs.docker.com/docker-for-windows/install/
2 ) Build jar file for all services shown below
Service
Command
service-registry
mvn clean install
configserver
mvn clean install
apigateway
mvn clean install -DskipTests
auth-service
mvn clean install -DskipTests
orderservice
mvn clean install -DskipTests
productservice
mvn clean install -DskipTests
paymentservice
mvn clean install -DskipTests
3 ) Build all images and push to Docker Hub
```
1 ) service-registry
- docker build -t microservicedailybuffer/serviceregistry:0.0.1 .
- docker tag microservicedailybuffer/serviceregistry:0.0.1 noyandocker/serviceregistry
- docker push noyandocker/serviceregistry
2 ) configserver
- docker build -t microservicedailybuffer/configserver:0.0.1 .
- docker tag microservicedailybuffer/configserver:0.0.1 noyandocker/configserver
- docker push noyandocker/configserver
3 ) api-gateway
- docker build -t microservicedailybuffer/apigateway:0.0.1 .
- docker tag microservicedailybuffer/apigateway:0.0.1 noyandocker/apigateway
- docker push noyandocker/apigateway
4 ) auth-service
- docker build -t microservicedailybuffer/authservice:0.0.1
- docker tag microservicedailybuffer/authservice:0.0.1 noyandocker/authservice
- docker push noyandocker/authservice
5 ) productservice
- docker build -t microservicedailybuffer/productservice:0.0.1 .
- docker tag microservicedailybuffer/productservice:0.0.1 noyandocker/productservice
- docker push noyandocker/productservice
6 ) orderservice
- docker build -t microservicedailybuffer/orderservice:0.0.1 .
- docker tag microservicedailybuffer/orderservice:0.0.1 noyandocker/orderservice
- docker push noyandocker/orderservice
7 ) paymentservice
- docker build -t microservicedailybuffer/paymentservice:0.0.1 .
- docker tag microservicedailybuffer/paymentservice:0.0.1 noyandocker/paymentservice
- docker push noyandocker/paymentservice
```
4 ) Run all Containers through this command shown below under main folder
```
docker-compose up -d
```
5 ) Send request to any service by using request collections under postman_collection
Kubernetes
1 ) Install minikube to access this link https://minikube.sigs.k8s.io/docs/start/
2 ) Open command prompt and install kubectl through this command shown below
```
minikube kubectl --
```
3 ) Start minikube through this command shown below.
```
minikube start
```
4 ) Open minikube dashboard through this command shown below.
```
minikube dashboard
```
5 ) Run all images coming from Docker hub on Kubernetes through this command shown below.
```
kubectl apply -f k8s
```
6 ) Show all information about images running on Kubernetes through this command
```
kubectl get all
```
7 ) Show all services running on Kubernetes through this command
```
kubectl get services
```
8 ) Show eureka server on Kubernetes through this command
```
minikube service eureka-lb
```
9 ) Show api gateway on Kubernetes through this command
```
minikube service cloud-gateway-svc
```
10 ) Copy IP address and Replace it with localhost of the endpoints defined in postman collection
Jenkins
1 ) Download jenkins to access this link https://hub.docker.com/r/jenkins/jenkins
2 ) Run Jenkins through this command shown below
```
docker run -p 8080:8080 -p 50000:50000 --restart=on-failure jenkins/jenkins:lts-jdk11
```
3 ) Install Jenkins and define username and password
3 ) Click New Item and Create pipeline to run Jenkinsfile
4 ) Run pipeline
### Screenshots
Click here to show the screenshot of project
Docker Desktop to show all running containers
Docker Hub
Kubernetes Dashboard
Jenkins Figure 1
Jenkins Figure 2