Skip to content

Docker Compose example with two Spring Boot services, Kafka, Zookeeper and Redis

License

Notifications You must be signed in to change notification settings

yaskovdev/docker-compose-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 

Repository files navigation

Docker Compose Example

This example illustrates how to use Docker Compose to run two simple Spring Boot microservices (Data Collector and Social Rating Calculator) that communicate with each other via Kafka and store data in Redis.

To Run Locally

Create a working directory and clone Docker Compose Example:

mkdir sandbox
cd sandbox
git clone https://github.com/yaskovdev/docker-compose-example.git

Clone and build Data Collector and Social Rating Calculator:

git clone https://github.com/yaskovdev/data-collector.git
mvn -f data-collector clean package -D maven.test.skip

git clone https://github.com/yaskovdev/social-rating-calculator.git
mvn -f social-rating-calculator clean package -D maven.test.skip

Build and pull all the required images and start the containers:

cd docker-compose-example
docker-compose up --build

Send the test request:

curl -v -H "Content-Type: application/json" http://localhost:8080/persons \
    --data '{"first_name": "Koshchey", "last_name": "Immortal", "age": 20000}'

See the logs of Social Rating Calculator, the social rating for the user from the cURL request should be logged there.

You can also connect to Redis using Redis CLI (src/redis-cli from Redis directory) and make sure the social rating is stored there.

About

Docker Compose example with two Spring Boot services, Kafka, Zookeeper and Redis

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published