Simple containerized spring boot API with test coverage that can be used for test purposes in CI/CD pipelines.
- Java JDK 11
- Maven 3.6.0
- VSCode or other IDE
From the project root, after making sure you have Java 11 in the path
mvn clean package
From the project root
export DOCKERHUB_USER=yourdockeruser
docker build -t $DOCKERHUB_USER/spring-boot-demo-api .
Push the image to your repo
docker push -t $DOCKERHUB_USER/spring-boot-demo-api .
Note: You will need to update this in deployment files also to reference the correct user
- Deployment/spring-boot-api/base/deployment.yaml
- Deployment/spring-boot-api/overlays/dev/image-template.yaml
- Deployment/spring-boot-api/overlays/dev/image.yaml
- Deployment/spring-boot-api/overlays/test/image-template.yaml
- Deployment/spring-boot-api/overlays/test/image.yaml
This app exposes a simple /greeting
endpoint under
http://app.domain.com/greeting
and
http://app.domain.com/greeting?name=Charlie
Calls to the endpoint increment a counter that can be monitored using prometheus.
Added a @Timer
metric on the greeting
method and also a custom Counter
metric to
track the number of times the greeting is called.
Metrics can be looked up via