Application Platform Shared Components

Project Bootstrapper

The project bootstrapper is a utility for generating new projects and/or configuring build pipelines for projects. It works by defining a project in the projects.json file and running a script to create and configure a GitHub project and add service catalogue entries.

The bootstrapper can be used to copy an existing Kotlin or Typescript template project or can run against an existing project.

As well as removing the effort required to create a build pipeline it allows us to standardise things like GitHub project configuration.

See the project readme on GitHub for usage details.

GitHub project: https://github.com/ministryofjustice/hmpps-project-bootstrap

projects.json file: https://github.com/ministryofjustice/hmpps-project-bootstrap/blob/main/projects.json

Kotlin Template

The Kotlin Template project is a skeleton backend Kotlin / Spring Boot application. It can be copied to create a new project.

The application is very light and provides little more than example health checks. The main value is gained from Github secrets, Helm, Docker, Gradle and Application Insights configurations. These allow a new application to be built and deployed to a Kubernetes namespace. The template application itself runs in the namespace hmpps-template-kotlin on Cloud Platform as a test to prove it is deployable.

The template works best in conjunction with the Project Bootstrapper which configures a build pipeline to get the application deployed into Kubernetes.

Any questions or suggestions relating to the Kotlin template should be directed to MOJ Slack channel #kotlin-dev.

Typescript Template

The Typescript Template project is a skeleton frontend / Node application. It can be copied to create a new project.

Note that this template is not a DPS Tech Team project but is community driven and owned by the MOJ Slack channel #typescript. It has been included here because it is a great fit with the other offerings.

The application is very light but provides enough detail to get a skeleton application up and running. The template application itself runs in the namespace hmpps-template-typescript on Cloud Platform as a test to prove it is deployable.

The template works best in conjunction with the Project Bootstrapper which configures a build pipeline to get the application deployed into Kubernetes.

Any questions or suggestions relating to the Typescript template should be directed to MOJ Slack channel #typescript.

Gradle Build Plugin

The Gradle Plugin is used to orchestrate Gradle builds of Java/Kotlin Spring Boot projects. “Orchestrate” means it applies 3rd party Gradle plugins and configures them rather than adding new build logic. The plugins applied can be found in the build.gradle.kts file.

Please see the project readme for more information on the plugin.

Note that the plugin is used in our Kotlin Template project.

Helm Charts

The HMPPS Helm Charts project provides generic Helm charts that can be used by any service. These are Helm templates with various extension points that can be configured in Helm values files.

A generic service chart is available to deploy any service into the Kubernetes instance hosted by Cloud Platforms.

A generic prometheus alerts chart provides a standard set of alerts for Kubernetes deployments and ingresses.

A ClamAV chart adds an antivirus utility to a namespace.

Note that the generic service chart and generic prometheus alerts chart are used by both the Kotlin Template project and the Typescript Template project (in the directory helm_deploy).

Spring Boot SQS Starter Library

The hmpps-spring-boot-sqs project publishes a Spring Boot starter library for using AWS SQS and SNS in a standard HMPPS way.

The library captures various patterns for using the AWS SQS and SNS client libraries that have been widely adopted within HMPPS. These patterns include creating secure clients, JMS listeners, queue health indicators, retry/purge endpoints and integration with the AWS testing utility Localstack.

To see an example of the library in action look at the project’s test application which is used for both functional tests and can be spun up locally. The library has also been used in several projects and these provide good real life examples.

This page was last reviewed on 04-Sep-2024, next review will be on 04-Dec-2024.