Welcome to Spring Microservices in Action, Chapter 6. Chapter 6 introduces the concept of service registration and discovery patterns using Spring Cloud and Netflix's Eureka server. Using service discovery, you will be able to add and remove service instances without the clients having to know the physical locations of the service.
- A Spring Cloud Config server that is deployed as Docker container and can manage a services configuration information using a file system/ classpath or GitHub-based repository.
- A Eureka server running as a Spring-Cloud based service. This service will allow multiple service instances to register with it. Clients that need to call a service will use Eureka to lookup the physical location of the target service.
- A organization service that will manage organization data used within Ostock.
- A licensing service that will manage licensing data used within Ostock.
- A Postgres SQL database used to hold the data.
- Apache Maven (http://maven.apache.org) All of the code examples in this book have been compiled with Java version 11.
- Git Client (http://git-scm.com)
- Docker(https://www.docker.com/products/docker-desktop)
Important: In this chapter we will be introducing a new service called Organization Service. You can donwload the organization and licensing service from the initial folder. That will contain all the source code required to start chapter 6.
To clone and run this application, you'll need Git, Maven, Java 11. From your command line:
JAVA 버전 확인
$ mvn --version실행 결과의 JAVA 버전이 11임을 확인한 후 아래 명령을 실행한다.
# Clone this repository
$ git clone https://github.com/klimtever/manning-smia2
# Go into the repository, by changing to the directory where you have downloaded the
# chapter 6 source code and select whether you want the initial or final configuration
$ cd chapter6/Initial or cd chapter6/Final
# To build the code examples for Chapter 6 as a docker image, open a command-line
# window and execute the following command:
$ mvn clean package dockerfile:build
# Now we are going to use docker-compose to start the actual image. To start the docker image, stay in the directory containing your chapter 6 source code and Run the following command:
$ docker-compose -f docker/docker-compose.yml up
맥북 M1 계열 사용자 중 spotify docker plugin으로 빌드가 되지 않는다면 아래 명령을 사용하기 바란다.
$ ./build-for-m1.sh
Will execute the Spotify dockerfile plugin defined in the pom.xml file.
Running the above command at the root of the project directory will build all of the projects. If everything builds successfully you should see a message indicating that the build was successful.
This command will run our services using the docker-compose.yml file located in the /docker directory.
If everything starts correctly you should see a bunch of Spring Boot information fly by on standard out. At this point all of the services needed for the chapter code examples will be running.
You can find the database script as well in the docker directory.
I'd like you to send me an email on [email protected] about anything you'd want to say about this software.
Feel free to file an issue if it doesn't work for your code sample. Thanks.