Skip to content

Commit

Permalink
initial run of init.sh script
Browse files Browse the repository at this point in the history
run of init.sh script for darts modernisation api
  • Loading branch information
scott-robertson1 committed Mar 13, 2023
1 parent b5a085f commit ac6ed3f
Show file tree
Hide file tree
Showing 21 changed files with 40 additions and 221 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
ARG APP_INSIGHTS_AGENT_VERSION=3.4.10
FROM hmctspublic.azurecr.io/base/java:17-distroless

COPY build/libs/spring-boot-template.jar /opt/app/
COPY build/libs/darts-api.jar /opt/app/

EXPOSE 4550
CMD [ "spring-boot-template.jar" ]
CMD [ "darts-api.jar" ]
11 changes: 11 additions & 0 deletions Jenkinsfile_CNP
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!groovy

@Library("Infrastructure")

def type = "java"
def product = "darts"
def component = "api"

withPipeline(type, product, component) {
enableSlackNotifications('#darts-builds')
}
9 changes: 0 additions & 9 deletions Jenkinsfile_template

This file was deleted.

96 changes: 3 additions & 93 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,96 +1,6 @@
# Spring Boot application template
# darts-api

[![Build Status](https://travis-ci.org/hmcts/spring-boot-template.svg?branch=master)](https://travis-ci.org/hmcts/spring-boot-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
* swagger configuration for api documentation ([see how to publish your api documentation to shared repository](https://github.com/hmcts/reform-api-docs#publish-swagger-docs))
* code quality tools already set up
* integration with Travis CI
* Hystrix circuit breaker enabled
* 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.
[![Build Status](https://travis-ci.org/hmcts/darts-api.svg?branch=master)](https://travis-ci.org/hmcts/darts-api)

## Notes

Expand Down Expand Up @@ -125,7 +35,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/darts-api` directory)
by executing the following command:

```bash
Expand Down
93 changes: 0 additions & 93 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 :: darts-api"
property "sonar.projectKey", "uk.gov.hmcts.reform:darts-api"
property "sonar.coverage.jacoco.xmlReportPaths", "${jacocoTestReport.reports.xml.destination.path}"
}
}
Expand Down Expand Up @@ -206,10 +206,10 @@ dependencies {
}
}

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

bootJar {
archiveFileName = "spring-boot-template.jar"
archiveFileName = "darts-api.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 darts-api App
name: darts-darts-api
home: https://github.com/hmcts/darts-api
version: 0.0.4
maintainers:
- name: HMCTS rpe team
- name: HMCTS darts team
dependencies:
- name: java
version: 4.0.13
Expand Down
File renamed without changes.
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/darts/api:latest'
ingressHost: darts-api-{{ .Values.global.environment }}.service.core-compute-{{ .Values.global.environment }}.internal
aadIdentityName: darts
# Uncomment once the vault containing the app insights key has been set up
# keyVaults:
# rpe:
# darts:
# 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:
darts-api:
build:
context: .
args:
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.darts.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.config;
package uk.gov.hmcts.reform.darts.config;

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.controllers;
package uk.gov.hmcts.reform.darts.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;
package uk.gov.hmcts.reform.darts;

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.darts.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.darts.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 darts-api");
}
}
6 changes: 3 additions & 3 deletions src/main/resources/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ management:
include: health, info, prometheus

springdoc:
packagesToScan: uk.gov.hmcts.reform.demo.controllers
packagesToScan: uk.gov.hmcts.reform.darts.controllers

#If you use a database then uncomment below lines and update db properties accordingly
spring:
config:
import: "optional:configtree:/mnt/secrets/rpe/"
import: "optional:configtree:/mnt/secrets/darts/"
application:
name: Spring Boot Template
# datasource:
Expand All @@ -44,4 +44,4 @@ spring:

azure:
application-insights:
instrumentation-key: ${rpe.AppInsightsInstrumentationKey:00000000-0000-0000-0000-000000000000}
instrumentation-key: ${darts.AppInsightsInstrumentationKey:00000000-0000-0000-0000-000000000000}
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.darts.controllers;

import io.restassured.RestAssured;
import io.restassured.http.ContentType;
Expand Down

0 comments on commit ac6ed3f

Please sign in to comment.