In this demo project I will be using Spring Boot 2.1 and jUnit 5 in their latest releases.
You can access to the database typing http://localhost:2289/console
and using as JDBC URL this one: jdbc:h2:mem:bookshop
and the user name is sa
and the password is password
.
I have provided a Postman collection with all the existing endpoints and examples of calls for each one of them.
If you want to build an image for docker, just execute the command
docker build -t dockerbookshop .
to build the image and then use
docker run -p 2289:2289 docker-bookshop
to run it within a docker container.
First of all, you need to run the command docker swarm init
to create a Swarm within docker
and then run docker stack deploy --compose-file=docker-compose.yml bookshop-stack
.
You will see how the 10 instances start to spin up and eventually all of them will be working.
Each one will have it own H2 Database so the database is not distributed.
To leave the Swarm and stop and delete all created containers run the command
docker swarm leave
or docker swarm leave --force
in case the first doesn't work.
- SpringBoot 2.1.4 RELEASE
- JUnit 5.4.2
- Mockito 2.25.1
- H2 Database 1.4.199
- Gradle 5.3.1