Skip to content

Commit

Permalink
Merge pull request #2 from hmcts/CRF-1
Browse files Browse the repository at this point in the history
CRF-1: Initial commit
  • Loading branch information
paulridout authored Nov 30, 2023
2 parents 99434ce + 6878784 commit 4bb723c
Show file tree
Hide file tree
Showing 25 changed files with 36 additions and 251 deletions.
8 changes: 0 additions & 8 deletions .github/CODEOWNERS

This file was deleted.

24 changes: 0 additions & 24 deletions .github/workflows/ci.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/publish-openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ jobs:
secrets:
SWAGGER_PUBLISHER_API_TOKEN: ${{ secrets.SWAGGER_PUBLISHER_API_TOKEN }}
with:
test_to_run: 'uk.gov.hmcts.reform.demo.openapi.OpenAPIPublisherTest'
test_to_run: 'uk.gov.hmcts.reform.civil.openapi.OpenAPIPublisherTest'
java_version: 17
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# renovate: datasource=github-releases depName=microsoft/ApplicationInsights-Java
ARG APP_INSIGHTS_AGENT_VERSION=3.4.18
FROM hmctspublic.azurecr.io/base/java:21-distroless
FROM hmctspublic.azurecr.io/base/java:17-distroless

COPY lib/applicationinsights.json /opt/app/
COPY build/libs/spring-boot-template.jar /opt/app/
COPY build/libs/civil-rtl-export.jar /opt/app/

EXPOSE 4550
CMD [ "spring-boot-template.jar" ]
CMD [ "civil-rtl-export.jar" ]
4 changes: 2 additions & 2 deletions Jenkinsfile_template → Jenkinsfile_CNP
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
@Library("Infrastructure")

def type = "java"
def product = "rpe"
def component = "demo"
def product = "civil"
def component = "rtl-export"

withPipeline(type, product, component) {}
4 changes: 2 additions & 2 deletions Jenkinsfile_nightly
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ properties([
@Library("Infrastructure")

def type = "java"
def product = "rpe"
def component = "spring-boot-template"
def product = "civil"
def component = "rtl-export"

withNightlyPipeline(type, product, component) {}
92 changes: 2 additions & 90 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,92 +1,4 @@
# Spring Boot application template

## Purpose

The purpose of this template is to speed up the creation of new Spring applications within HMCTS
and help keep the same standards across multiple teams. If you need to create a new app, you can
simply use this one as a starting point and build on top of it.

## What's inside

The template is a working application with a minimal setup. It contains:
* application skeleton
* setup script to prepare project
* common plugins and libraries
* docker setup
* automatically publishes API documentation to [hmcts/cnp-api-docs](https://github.com/hmcts/cnp-api-docs)
* code quality tools already set up
* MIT license and contribution information
* Helm chart using chart-java.

The application exposes health endpoint (http://localhost:4550/health) and metrics endpoint
(http://localhost:4550/metrics).

## Plugins

The template contains the following plugins:

* checkstyle

https://docs.gradle.org/current/userguide/checkstyle_plugin.html

Performs code style checks on Java source files using Checkstyle and generates reports from these checks.
The checks are included in gradle's *check* task (you can run them by executing `./gradlew check` command).

* pmd

https://docs.gradle.org/current/userguide/pmd_plugin.html

Performs static code analysis to finds common programming flaws. Included in gradle `check` task.


* jacoco

https://docs.gradle.org/current/userguide/jacoco_plugin.html

Provides code coverage metrics for Java code via integration with JaCoCo.
You can create the report by running the following command:

```bash
./gradlew jacocoTestReport
```

The report will be created in build/reports subdirectory in your project directory.

* io.spring.dependency-management

https://github.com/spring-gradle-plugins/dependency-management-plugin

Provides Maven-like dependency management. Allows you to declare dependency management
using `dependency 'groupId:artifactId:version'`
or `dependency group:'group', name:'name', version:version'`.
* org.springframework.boot
http://projects.spring.io/spring-boot/
Reduces the amount of work needed to create a Spring application
* org.owasp.dependencycheck
https://jeremylong.github.io/DependencyCheck/dependency-check-gradle/index.html
Provides monitoring of the project's dependent libraries and creating a report
of known vulnerable components that are included in the build. To run it
execute `gradle dependencyCheck` command.
* com.github.ben-manes.versions
https://github.com/ben-manes/gradle-versions-plugin
Provides a task to determine which dependencies have updates. Usage:
```bash
./gradlew dependencyUpdates -Drevision=release
```

## Setup

Located in `./bin/init.sh`. Simply run and follow the explanation how to execute it.
# civil-rtl-export

## Building and deploying the application

Expand Down Expand Up @@ -115,7 +27,7 @@ Create docker image:
docker-compose build
```

Run the distribution (created in `build/install/spring-boot-template` directory)
Run the distribution (created in `build/install/civil-rtl-export` directory)
by executing the following command:

```bash
Expand Down
95 changes: 0 additions & 95 deletions bin/init.sh

This file was deleted.

8 changes: 4 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ project.tasks['check'].dependsOn integration

sonarqube {
properties {
property "sonar.projectName", "Reform :: spring-boot-template"
property "sonar.projectKey", "uk.gov.hmcts.reform:spring-boot-template"
property "sonar.projectName", "Reform :: civil-rtl-export"
property "sonar.projectKey", "uk.gov.hmcts.reform:civil-rtl-export"
}
}

Expand Down Expand Up @@ -204,10 +204,10 @@ dependencies {
}
}

mainClassName = 'uk.gov.hmcts.reform.demo.Application'
mainClassName = 'uk.gov.hmcts.reform.civil.Application'

bootJar {
archiveFileName = "spring-boot-template.jar"
archiveFileName = "civil-rtl-export.jar"

manifest {
attributes('Implementation-Version': project.version.toString())
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
apiVersion: v2
appVersion: "1.0"
description: A Helm chart for spring-boot-template App
name: rpe-spring-boot-template
home: https://github.com/hmcts/spring-boot-template
description: A Helm chart for civil-rtl-export App
name: civil-rtl-export
home: https://github.com/hmcts/civil-rtl-export
version: 0.0.13
maintainers:
- name: HMCTS rpe team
- name: HMCTS civil team
dependencies:
- name: java
version: 5.0.2
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
java:
applicationPort: 4550
image: 'hmctspublic.azurecr.io/rpe/spring-boot-template:latest'
ingressHost: rpe-spring-boot-template-{{ .Values.global.environment }}.service.core-compute-{{ .Values.global.environment }}.internal
aadIdentityName: rpe
image: 'hmctspublic.azurecr.io/civil/rtl-export:latest'
ingressHost: civil-rtl-export-{{ .Values.global.environment }}.service.core-compute-{{ .Values.global.environment }}.internal
aadIdentityName: civil
# Uncomment once the vault containing the app insights key has been set up
# keyVaults:
# rpe:
# civil:
# secrets:
# - name: AppInsightsInstrumentationKey
# alias: azure.application-insights.instrumentation-key
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: '2.1'

services:
spring-boot-template:
civil-rtl-export:
build:
context: .
args:
Expand Down
4 changes: 2 additions & 2 deletions lib/applicationinsights.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"connectionString": "${file:/mnt/secrets/rpe/app-insights-connection-string}",
"connectionString": "${file:/mnt/secrets/civil/app-insights-connection-string}",
"role": {
"name": "rpe-demo"
"name": "civil-rtl-export"
},
"preview": {
"sampling": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package uk.gov.hmcts.reform.demo.controllers;
package uk.gov.hmcts.reform.civil.controllers;

import io.restassured.RestAssured;
import io.restassured.http.ContentType;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package uk.gov.hmcts.reform.demo.controllers;
package uk.gov.hmcts.reform.civil.controllers;

import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package uk.gov.hmcts.reform.demo.openapi;
package uk.gov.hmcts.reform.civil.openapi;

import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package uk.gov.hmcts.reform.demo;
package uk.gov.hmcts.reform.civil;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package uk.gov.hmcts.reform.demo.config;
package uk.gov.hmcts.reform.civil.config;

import io.swagger.v3.oas.models.ExternalDocumentation;
import io.swagger.v3.oas.models.OpenAPI;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package uk.gov.hmcts.reform.demo.controllers;
package uk.gov.hmcts.reform.civil.controllers;

import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
Expand All @@ -23,6 +23,6 @@ public class RootController {
*/
@GetMapping("/")
public ResponseEntity<String> welcome() {
return ok("Welcome to spring-boot-template");
return ok("Welcome to Civil RTL Export");
}
}
Loading

0 comments on commit 4bb723c

Please sign in to comment.