Example application for spring boot ready to be deployed on k8s and OpenShift using Helm.
It is RESTful application with Java implemented with Spring Boot.
Api support:
● Create a new product ● Retrieve a list of all products ● Update a product (Optional) ● Delete a product (soft deletion) (Optional)
With mvn will get an all in one java-jar
mvn install
Docker build contains all for building the jar and store it in a Docker image
docker build . -t products-example
The repository can be automatically build by dockerhub in order to obtain a docker image in the DockerHub registry. This application has been built in the repository:
https://hub.docker.com/repository/docker/jgpelaez/example-springboot-rest-k8s
mvn spring-boot:run
Run:
kubectl create ns products-example
helm3 upgrade --install products-example ./charts/springboot --namespace products-example -f chart-values.yaml
Access to the application
kubectl port-forward svc/products-example-back 11811
In the browser:
http://localhost:11811/swagger-ui.html
http://localhost:11811/product
Application api can be found with swagger in the url:
http://localhost:8080/swagger-ui.html

The helm chart includes a security layer with an authentication proxy, all requests will pass through this proxy with basic http authentication.
The persistence in the aplication is done with an SQL database. It's configurable to use H2 for testing purposes and postgresql for production
The database deployment is based on the postgresql helm chart, and deployed with the command:
helm3 upgrade --install db stable/postgresql
The database creation and upgrades is done using liquibase, every update will contain the scripts for database update.
The database creation is handled by the yaml and sql files in the src/main/resources/db folder
Content type
Image
Digest
Size
96.2 MB
Last updated
over 6 years ago
docker pull jgpelaez/example-springboot-rest-k8s