Skip to content

bindian0509/spring-microservices

Repository files navigation

spring-microservices

Import topics covered here -

For further reference, please consider the following sections:

Getting Started

Local Setup

  1. Setup and run mysql on local machine, then dump the data given in helper-files directory like
mysql -u root < helper-files/university.db.sql 
  1. Change database connection credentials everywhere in application.properties
spring.datasource.url=jdbc:mysql://localhost:3306/university
spring.datasource.username=root
spring.datasource.password=root_pass
  1. Each microservices can be build and run by following maven command from the respective directory
# order of running -
eureka-server -> api-gateway -> config-server -> address-service (port 8081) -> address-service (port 8082) -> student-service 

mvn spring-boot:run
 
  1. For all local request and testing you can use following postman collection via import option in Postman -

Postman localhost API endpoint collection

  1. Spring version used here is -
(╯°□°)╯︵ ┻━┻

 :: Spring Boot ::                (v2.7.1)

Docker Based Setup

  1. Have docker installed on your system first.
$ docker -v
Docker version 20.10.17, build 100c701
  1. Run docker compose
$ docker-compose up --build
  1. Check if everything runs good
$ docker container ls
 
IMAGE                                PORTS                               NAMES
grafana/grafana:latest               0.0.0.0:3000->3000/tcp              spring-microservices-grafana-1
prom/prometheus:latest               0.0.0.0:9090->9090/tcp              spring-microservices-prometheus-1
bindian0509/student-service:latest   0.0.0.0:8080->8080/tcp              student-service
bindian0509/address-service:latest   0.0.0.0:8081->8081/tcp              address-service-1
bindian0509/address-service:latest   0.0.0.0:8082->8081/tcp              address-service-2
bindian0509/api-gateway:latest       0.0.0.0:8072->8072/tcp              api-gateway
bindian0509/config-server:latest     0.0.0.0:8888->8888/tcp              config-server
openzipkin/zipkin                    9410/tcp, 0.0.0.0:9411->9411/tcp    zipkin
bindian0509/eureka-server:latest     0.0.0.0:8761->8761/tcp              eureka-server
mysql:5.7                            0.0.0.0:3306->3306/tcp, 33060/tcp   mysql

About

A goto guide for implementation of Spring Boot and Spring Cloud components

Topics

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors