Skip to main content
Version: 4.8

Spring Boot

Springboot Application Stack

The Springboot application stack is used to build and deploy Java applications in the Springboot framework and produce deployment-ready containers for the SCALE environment.

The containers produced in this application stack share common requirements with other application stacks deployed to the SCALE environment. These shared requirements include:

  • Security scanning for any vulnerabilities
  • Code coverage scanning for test quality
  • Staging of the application container in the appropriate Docker container repositories and tagged according to SCALE conventions
  • Completion of Unit Testing and User Acceptance Testing
  • Gated approvals before allowing deployments into pre-production and production environments
  • Audit trail and history of deployment within the SCALE CI/CD Pipeline

Because of the above-listed requirements, the Springboot application stack is provided in order to support the build and deployment of Java/Springboot applications in a manner that integrates with SCALE requirements and processes. The flow of deployment includes first a Continuous Integration stage of processing in a pipeline prior to deployment in the Continuous Deployment stages. The Continuous Integration stage focuses on building the application, running scans to check for test coverage and security vulnerabilities, and staging the container in the appropriate Docker repository ready for deployment. Subsequent pipeline stages deploy the application to the appropriate target Kubernetes spaces.

For details on getting started, see getting started.

For details on repository structure, see repository structure.

The source directory will contain a pom.xml file for use by Maven to build the application and a src sub-directory containing the source code of the application itself.

For details on application configuration, see application configuration.

Application Logging

Certain log format guidelines should be followed in order to ensure the capture of logs. All logging from the application should go to standard output (also sometimes referred to as "console" in the context of common logging libraries). In order for log entries to be picked up and collected into the logging collection infrastructure (Splunk), the log entries must match a particular format. That format looks like the following:

[ISO8601-Date] logLevel=level pid=pid thread=thread class=logger-class message=free-style-message where:

  • level is the logging level (INFO, WARN, etc.)
  • pid is the process ID
  • thread is the thread ID
  • logger-class is the class calling the logger (indicates where in the code the log message was issued)
  • free-style-message is any addition logging content

The format can be further extended by adding additional key=value pairs before the free-style log message.

For details on CI/CD pipelines, see CI/CD pipelines.

Added JDK21 support

Springoot catalog now supports RedHat OpenJDK 21 image, and is deafulted in this pipeline release. The list of available JDK versions are 11,17 and 21. We have also improved the memory usage during build time by add mvn build parameters to fix 137 issues in large applications.

For details on upgrading to Pipeline v4.7, see upgrading to Pipeline v4.7.

For details on pipeline definition, see pipeline definition.

Application-Specific Pipeline Configuration

The extends YAML object is a complex object consisting of additional YAML objects. This object is used to extend the pipeline logic (referenced by the repository defined in the resources object) by (a) referencing the correct appstack pipeline entry point (devops/springboot.yml for the Springboot pipeline) and (b) passing a set of YAML objects as parameters to influence the behavior of the pipeline to meet an application teams specific needs.

The extends YAML object consists of 2 objects beneath it:

  • template
  • parameters

The template YAML object is a single value set to the initial entry point for the V3 pipeline for the Springboot appstack, so it should always be defined as follows:

extends:
template: devops/springboot.yml@spaces

Please refer to upgrade document to know more about springboot.yml@templates which holds required metadata for the pipeline.

The parameters YAML object is defined immediately following the template object and at the same indentation level. This is the object that requires the most attention and definition to be set up.

The parameters YAML object includes a couple of variables required for the Springboot application stack. The first of these is the appVersion variable to define the version of the application to be built and deployed. The second variable defines the version of Java (the JDK) to be used to compile and to run the application. The variable is named jdkVersion and accepts one of 2 valid values: jdk11 for Java 1.11 and jdk8 for Java 1.8. The following is an example of how these variables would be defined (including all of the extends object preceding it):

parameters:
appVersion: 4.7.x
javaVersion: "jdk21"

Dockerfile Changes

In pipeline v4.7, we switched to a different vendor to provide us with our JDK images. This vendor does not include a CMD or ENTRYPOINT configuration, as our last one did. You will need to include the CMD at the bottom of the Dockerfile:

CMD ["java", "-jar", "app.jar"]

For details on defining hostspaces, see defining hostspaces.

Add monitoring metrics to Springboot

Added actuator to support monitoring of springboot APIs in the boilerplate. Refer Here

For details on skipping deployments, see skipping deployments.

For details on Horizontal Pod Autoscaler, see Horizontal Pod Autoscaler.

For details on PVC for application stacks, see PVC for application stacks.

DR changes

With the introduction of pipeline v4.7, we have implemented DR capabilities that require changes in the Helm chart. Please refer to the document below for the necessary modifications and kindly update your Helm chart accordingly.

Getting Started with DR

Please refer to the following document to prepare your codebase for disaster recovery.

DR Config Map and Ingress Setup

For details on Pod Anti-Affinity, see Pod Anti-Affinity.

For details on detailed pipeline configuration, see detailed pipeline configuration.

For details on Kubernetes deployment objects, see Kubernetes deployment objects.

For details on troubleshooting, see troubleshooting.