This repository contains examples for the talk "Spring Cloud goes Cloud". The main focus of the talk is on running the Spring Boot applications using Docker and Kubernetes.
config-server- Spring Cloud Config Serverdiscovery-service- Service discovery with Eurekaexaminator- entry point, transparently sends requests to subsequent challenge providershistory- provides challenges about historymathematic- provides challenges about math
To request data you need to send POST request to the examinator's /exams/exam endpoint
with the following payload:
{
"MATH": 1,
"HISTORY": 1
}Internally, examinator application will request data from math and history providers.
To build the apps you can use Apache Maven because all the apps are using it. However,
the build-scripts directory contains a few more scripts which build app differently.
build-images-naive.sh- this script runsmvn clean packageand next uses simple and naive Dockerfile to build Docker images.build-images-oci.sh- this script builds Docker images with Spring Boot Maven plugin and buildpacks.build-images-layered.sh- this script builds far-jar's and next unpacks them using Spring Boot layered jar. As soon asjarfiles are unpacked, they are next used to build layered Docker images manually via another Dockerfile.build-images-kubernetes.sh- this script builds jar files withwith-kubernetesprofile active. This profile is important for themathprovider - enables reload of configs fromConfigMaps.
Built images can be used to run apps in different ways. See the build-scripts/compose and
build-scripts/kubernetes folders.
compose/naive- running all the images built bybuild-images-naive.shscript, uses health checks to wait till containers are started.compose/oci- runs all the containers based on images built bybuild-images-oci.shscript. As a result no way to check the health here.componse/docker-only- runs all the containers but without service discovery because this functionality is provided by Docker out of the box.kubernetes/config-server- a few scripts which runpods andservices in Kubernetes.kubernetes/config-maps- running apps generated bybuild-images-kubernetes.shand so that reloading ofConfigMaps are available.kubernetes/autoscaling- the same but with autoscaling based on the CPU usage.
The examinator app exposes liveness and readiness probes as well as a custom
PhaseOfTheMoonHealthIndicator. Additionally, mathematics exposes MetricsConfiguration and
metrics internally.