Skip to content

Commit

Permalink
Rename project
Browse files Browse the repository at this point in the history
  • Loading branch information
runner committed Jan 6, 2025
1 parent a79997f commit a03dd66
Show file tree
Hide file tree
Showing 34 changed files with 78 additions and 78 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/security_owasp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Security OWASP dependency check
on:
workflow_dispatch:
schedule:
- cron: "19 6 * * MON-FRI" # Every weekday
- cron: "47 4 * * MON-FRI" # Every weekday
jobs:
security-kotlin-owasp-check:
name: Kotlin security OWASP dependency check
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/security_trivy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Security trivy dependency check
on:
workflow_dispatch:
schedule:
- cron: "19 6 * * MON-FRI" # Every weekday
- cron: "47 4 * * MON-FRI" # Every weekday
jobs:
security-kotlin-trivy-check:
name: Project security trivy dependency check
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/security_veracode_pipeline_scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Security veracode pipeline scan
on:
workflow_dispatch:
schedule:
- cron: "19 6 * * MON-FRI" # Every weekday
- cron: "47 4 * * MON-FRI" # Every weekday
jobs:
security-veracode-pipeline-scan:
name: Project security veracode pipeline scan
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/security_veracode_policy_scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Security veracode policy scan
on:
workflow_dispatch:
schedule:
- cron: "34 6 * * 1" # Every Monday
- cron: "52 5 * * 1" # Every Monday
jobs:
security-veracode-policy-check:
name: Project security veracode policy scan
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ RUN addgroup --gid 2000 --system appgroup && \
adduser --uid 2000 --system appuser --gid 2000

WORKDIR /app
COPY --from=builder --chown=appuser:appgroup /app/build/libs/hmpps-template-kotlin*.jar /app/app.jar
COPY --from=builder --chown=appuser:appgroup /app/build/libs/hmpps-learner-records-api*.jar /app/app.jar
COPY --from=builder --chown=appuser:appgroup /app/build/libs/applicationinsights-agent*.jar /app/agent.jar
COPY --from=builder --chown=appuser:appgroup /app/applicationinsights.json /app
COPY --from=builder --chown=appuser:appgroup /app/applicationinsights.dev.json /app
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# hmpps-template-kotlin
# hmpps-learner-records-api

[![repo standards badge](https://img.shields.io/badge/endpoint.svg?&style=flat&logo=github&url=https%3A%2F%2Foperations-engineering-reports.cloud-platform.service.justice.gov.uk%2Fapi%2Fv1%2Fcompliant_public_repositories%2Fhmpps-template-kotlin)](https://operations-engineering-reports.cloud-platform.service.justice.gov.uk/public-report/hmpps-template-kotlin "Link to report")
[![Docker Repository on ghcr](https://img.shields.io/badge/ghcr.io-repository-2496ED.svg?logo=docker)](https://ghcr.io/ministryofjustice/hmpps-template-kotlin)
[![API docs](https://img.shields.io/badge/API_docs_-view-85EA2D.svg?logo=swagger)](https://hmpps-template-kotlin-dev.hmpps.service.justice.gov.uk/webjars/swagger-ui/index.html?configUrl=/v3/api-docs)
[![repo standards badge](https://img.shields.io/badge/endpoint.svg?&style=flat&logo=github&url=https%3A%2F%2Foperations-engineering-reports.cloud-platform.service.justice.gov.uk%2Fapi%2Fv1%2Fcompliant_public_repositories%2Fhmpps-learner-records-api)](https://operations-engineering-reports.cloud-platform.service.justice.gov.uk/public-report/hmpps-learner-records-api "Link to report")
[![Docker Repository on ghcr](https://img.shields.io/badge/ghcr.io-repository-2496ED.svg?logo=docker)](https://ghcr.io/ministryofjustice/hmpps-learner-records-api)
[![API docs](https://img.shields.io/badge/API_docs_-view-85EA2D.svg?logo=swagger)](https://hmpps-learner-records-api-dev.hmpps.service.justice.gov.uk/webjars/swagger-ui/index.html?configUrl=/v3/api-docs)

Template github repo used for new Kotlin based projects.

Expand All @@ -16,7 +16,7 @@ within GitHub.
This project is community managed by the mojdt `#kotlin-dev` slack channel.
Please raise any questions or queries there. Contributions welcome!

Our security policy is located [here](https://github.com/ministryofjustice/hmpps-template-kotlin/security/policy).
Our security policy is located [here](https://github.com/ministryofjustice/hmpps-learner-records-api/security/policy).

Documentation to create new service is located [here](https://tech-docs.hmpps.service.justice.gov.uk/applicationplatform/newservice-GHA/).

Expand All @@ -37,7 +37,7 @@ Submit a PR to the Cloud Platform team in
#ask-cloud-platform. Further instructions from the Cloud Platform team can be found in
the [Cloud Platform User Guide](https://user-guide.cloud-platform.service.justice.gov.uk/#cloud-platform-user-guide)

## Renaming from HMPPS Template Kotlin - github Actions
## Renaming from HMPPS Learner Records Api - github Actions

Once the new repository is deployed. Navigate to the repository in github, and select the `Actions` tab.
Click the link to `Enable Actions on this repository`.
Expand Down Expand Up @@ -129,7 +129,7 @@ will build the application and run it and HMPPS Auth within a local docker insta
### Running the application in Intellij

```bash
docker compose pull && docker compose up --scale hmpps-template-kotlin=0
docker compose pull && docker compose up --scale hmpps-learner-records-api=0
```

will just start a docker instance of HMPPS Auth. The application should then be started with a `dev` active profile
Expand Down
2 changes: 1 addition & 1 deletion applicationinsights.dev.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"role": {
"name": "hmpps-template-kotlin"
"name": "hmpps-learner-records-api"
},
"customDimensions": {
"service.version": "${BUILD_NUMBER}"
Expand Down
2 changes: 1 addition & 1 deletion applicationinsights.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"role": {
"name": "hmpps-template-kotlin"
"name": "hmpps-learner-records-api"
},
"customDimensions": {
"service.version": "${BUILD_NUMBER}"
Expand Down
6 changes: 3 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
version: "3"
services:
hmpps-template-kotlin:
hmpps-learner-records-api:
build:
context: .
networks:
- hmpps
container_name: hmpps-template-kotlin
container_name: hmpps-learner-records-api
ports:
- "8080:8080"
healthcheck:
Expand All @@ -14,7 +14,7 @@ services:
- SERVER_PORT=8080
- HMPPS_AUTH_URL=http://hmpps-auth:8080/auth
# TODO: Remove this URL and replace with outgoing service URLs
- EXAMPLE_URL=http://hmpps-template-kotlin:8080
- EXAMPLE_URL=http://hmpps-learner-records-api:8080
- SPRING_PROFILES_ACTIVE=dev

hmpps-auth:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v2
appVersion: '1.0'
description: A Helm chart for Kubernetes
name: hmpps-template-kotlin
name: hmpps-learner-records-api
version: 0.2.0
dependencies:
- name: generic-service
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
generic-service:
nameOverride: hmpps-template-kotlin
productId: "UNASSIGNED" # productId for the product that this belongs too, i.e. DPS001, see README.md for details
nameOverride: hmpps-learner-records-api
productId: "DPS121" # productId for the product that this belongs too, i.e. DPS001, see README.md for details

replicaCount: 4

image:
repository: ghcr.io/ministryofjustice/hmpps-template-kotlin
repository: ghcr.io/ministryofjustice/hmpps-learner-records-api
tag: app_version # override at deployment time
port: 8080

ingress:
enabled: true
host: app-hostname.local # override per environment
tlsSecretName: hmpps-template-kotlin-cert
tlsSecretName: hmpps-learner-records-api-cert

# Environment variables to load into the deployment
env:
Expand All @@ -26,7 +26,7 @@ generic-service:
# [name of environment variable as seen by app]: [key of kubernetes secret to load]

namespace_secrets:
hmpps-template-kotlin:
hmpps-learner-records-api:
# Example client registration secrets
EXAMPLE_API_CLIENT_ID: "TEMPLATE_KOTLIN_API_CLIENT_ID"
EXAMPLE_API_CLIENT_SECRET: "TEMPLATE_KOTLIN_API_CLIENT_SECRET"
Expand All @@ -38,4 +38,4 @@ generic-service:
- internal

generic-prometheus-alerts:
targetApplication: hmpps-template-kotlin
targetApplication: hmpps-learner-records-api
8 changes: 4 additions & 4 deletions helm_deploy/values-dev.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
---
# Per environment values which override defaults in hmpps-template-kotlin/values.yaml
# Per environment values which override defaults in hmpps-learner-records-api/values.yaml

generic-service:
replicaCount: 2

ingress:
host: template-kotlin-dev.hmpps.service.justice.gov.uk
host: learner-records-api-dev.hmpps.service.justice.gov.uk

env:
APPLICATIONINSIGHTS_CONFIGURATION_FILE: "applicationinsights.dev.json"
HMPPS_AUTH_URL: "https://sign-in-dev.hmpps.service.justice.gov.uk/auth"
# Template kotlin calls out to itself to provide an example of a service call
# TODO: This should be replaced by a call to a different service, or removed
EXAMPLE_API_URL: "https://template-kotlin-dev.hmpps.service.justice.gov.uk"
EXAMPLE_API_URL: "https://learner-records-api-dev.hmpps.service.justice.gov.uk"

# CloudPlatform AlertManager receiver to route prometheus alerts to slack
# See https://user-guide.cloud-platform.service.justice.gov.uk/documentation/monitoring-an-app/how-to-create-alarms.html#creating-your-own-custom-alerts
generic-prometheus-alerts:
alertSeverity: NON_PROD_ALERTS_SEVERITY_LABEL
alertSeverity: digital-prison-service-dev
8 changes: 4 additions & 4 deletions helm_deploy/values-preprod.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
---
# Per environment values which override defaults in hmpps-template-kotlin/values.yaml
# Per environment values which override defaults in hmpps-learner-records-api/values.yaml

generic-service:
replicaCount: 2

ingress:
host: template-kotlin-preprod.hmpps.service.justice.gov.uk
host: learner-records-api-preprod.hmpps.service.justice.gov.uk

env:
APPLICATIONINSIGHTS_CONFIGURATION_FILE: "applicationinsights.dev.json"
HMPPS_AUTH_URL: "https://sign-in-preprod.hmpps.service.justice.gov.uk/auth"
# Template kotlin calls out to itself to provide an example of a service call
# TODO: This should be replaced by a call to a different service, or removed
EXAMPLE_API_URL: "https://template-kotlin-preprod.hmpps.service.justice.gov.uk"
EXAMPLE_API_URL: "https://learner-records-api-preprod.hmpps.service.justice.gov.uk"

# CloudPlatform AlertManager receiver to route prometheus alerts to slack
# See https://user-guide.cloud-platform.service.justice.gov.uk/documentation/monitoring-an-app/how-to-create-alarms.html#creating-your-own-custom-alerts
generic-prometheus-alerts:
alertSeverity: NON_PROD_ALERTS_SEVERITY_LABEL
alertSeverity: digital-prison-service-dev
8 changes: 4 additions & 4 deletions helm_deploy/values-prod.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
---
# Per environment values which override defaults in hmpps-template-kotlin/values.yaml
# Per environment values which override defaults in hmpps-learner-records-api/values.yaml

generic-service:
ingress:
host: template-kotlin.hmpps.service.justice.gov.uk
host: learner-records-api.hmpps.service.justice.gov.uk

env:
HMPPS_AUTH_URL: "https://sign-in.hmpps.service.justice.gov.uk/auth"
# Template kotlin calls out to itself to provide an example of a service call
# TODO: This should be replaced by a call to a different service, or removed
EXAMPLE_API_URL: "https://template-kotlin.hmpps.service.justice.gov.uk"
EXAMPLE_API_URL: "https://learner-records-api.hmpps.service.justice.gov.uk"

# CloudPlatform AlertManager receiver to route prometheus alerts to slack
# See https://user-guide.cloud-platform.service.justice.gov.uk/documentation/monitoring-an-app/how-to-create-alarms.html#creating-your-own-custom-alerts
generic-prometheus-alerts:
alertSeverity: PROD_ALERTS_SEVERITY_LABEL
alertSeverity: digital-prison-service
2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
rootProject.name = "hmpps-template-kotlin"
rootProject.name = "hmpps-learner-records-api"
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package uk.gov.justice.digital.hmpps.templatepackagename
package uk.gov.justice.digital.hmpps.learnerrecordsapi

import org.springframework.boot.autoconfigure.SpringBootApplication
import org.springframework.boot.runApplication

@SpringBootApplication
class HmppsTemplateKotlin
class LearnerRecordsApi

fun main(args: Array<String>) {
runApplication<HmppsTemplateKotlin>(*args)
runApplication<LearnerRecordsApi>(*args)
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package uk.gov.justice.digital.hmpps.templatepackagename.config
package uk.gov.justice.digital.hmpps.learnerrecordsapi.config

import jakarta.validation.ValidationException
import org.slf4j.LoggerFactory
Expand All @@ -14,7 +14,7 @@ import org.springframework.web.servlet.resource.NoResourceFoundException
import uk.gov.justice.hmpps.kotlin.common.ErrorResponse

@RestControllerAdvice
class HmppsTemplateKotlinExceptionHandler {
class LearnerRecordsApiExceptionHandler {
@ExceptionHandler(ValidationException::class)
fun handleValidationException(e: ValidationException): ResponseEntity<ErrorResponse> = ResponseEntity
.status(BAD_REQUEST)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package uk.gov.justice.digital.hmpps.templatepackagename.config
package uk.gov.justice.digital.hmpps.learnerrecordsapi.config

import io.swagger.v3.oas.models.Components
import io.swagger.v3.oas.models.OpenAPI
Expand All @@ -20,9 +20,9 @@ class OpenApiConfiguration(buildProperties: BuildProperties) {
fun customOpenAPI(): OpenAPI = OpenAPI()
.servers(
listOf(
Server().url("https://template-kotlin-dev.hmpps.service.justice.gov.uk").description("Development"),
Server().url("https://template-kotlin-preprod.hmpps.service.justice.gov.uk").description("Pre-Production"),
Server().url("https://template-kotlin.hmpps.service.justice.gov.uk").description("Production"),
Server().url("https://learner-records-api-dev.hmpps.service.justice.gov.uk").description("Development"),
Server().url("https://learner-records-api-preprod.hmpps.service.justice.gov.uk").description("Pre-Production"),
Server().url("https://learner-records-api.hmpps.service.justice.gov.uk").description("Production"),
Server().url("http://localhost:8080").description("Local"),
),
)
Expand All @@ -35,18 +35,18 @@ class OpenApiConfiguration(buildProperties: BuildProperties) {
),
)
.info(
Info().title("HMPPS Template Kotlin").version(version)
Info().title("HMPPS Learner Records Api").version(version)
.contact(Contact().name("HMPPS Digital Studio").email("feedback@digital.justice.gov.uk")),
)
// TODO: Remove the default security schema and start adding your own schemas and roles to describe your
// service authorisation requirements
.components(
Components().addSecuritySchemes(
"template-kotlin-ui-role",
"learner-records-api-ui-role",
SecurityScheme().addBearerJwtRequirement("ROLE_TEMPLATE_KOTLIN__UI"),
),
)
.addSecurityItem(SecurityRequirement().addList("template-kotlin-ui-role", listOf("read")))
.addSecurityItem(SecurityRequirement().addList("learner-records-api-ui-role", listOf("read")))
}

private fun SecurityScheme.addBearerJwtRequirement(role: String): SecurityScheme =
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package uk.gov.justice.digital.hmpps.templatepackagename.config
package uk.gov.justice.digital.hmpps.learnerrecordsapi.config

import org.springframework.beans.factory.annotation.Value
import org.springframework.context.annotation.Bean
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package uk.gov.justice.digital.hmpps.templatepackagename.health
package uk.gov.justice.digital.hmpps.learnerrecordsapi.health

import org.springframework.beans.factory.annotation.Qualifier
import org.springframework.stereotype.Component
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package uk.gov.justice.digital.hmpps.templatepackagename.resource
package uk.gov.justice.digital.hmpps.learnerrecordsapi.resource

import io.swagger.v3.oas.annotations.Operation
import io.swagger.v3.oas.annotations.media.Content
Expand All @@ -11,7 +11,7 @@ import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.PathVariable
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController
import uk.gov.justice.digital.hmpps.templatepackagename.service.ExampleApiService
import uk.gov.justice.digital.hmpps.learnerrecordsapi.service.ExampleApiService
import uk.gov.justice.hmpps.kotlin.common.ErrorResponse
import java.time.LocalDateTime

Expand All @@ -28,7 +28,7 @@ class ExampleResource(private val exampleApiService: ExampleApiService) {
@Operation(
summary = "Retrieve today's date and time",
description = "This is an example endpoint that calls a service to return the current date and time. Requires role ROLE_TEMPLATE_KOTLIN__UI",
security = [SecurityRequirement(name = "template-kotlin-ui-role")],
security = [SecurityRequirement(name = "learner-records-api-ui-role")],
responses = [
ApiResponse(responseCode = "200", description = "today's date and time"),
ApiResponse(
Expand All @@ -53,7 +53,7 @@ class ExampleResource(private val exampleApiService: ExampleApiService) {
It will return a 404 response as the /example-external-api endpoint hasn't been implemented, so we use wiremock
in integration tests to simulate other responses.
Requires role ROLE_TEMPLATE_KOTLIN__UI""",
security = [SecurityRequirement(name = "template-kotlin-ui-role")],
security = [SecurityRequirement(name = "learner-records-api-ui-role")],
responses = [
ApiResponse(responseCode = "200", description = "a message with a parameter"),
ApiResponse(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package uk.gov.justice.digital.hmpps.templatepackagename.service
package uk.gov.justice.digital.hmpps.learnerrecordsapi.service

import org.springframework.stereotype.Service
import org.springframework.web.reactive.function.client.WebClient
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
info.app:
name: HMPPS Template Kotlin
name: HMPPS Learner Records Api
version: 1.0

spring:
application:
name: hmpps-template-kotlin
name: hmpps-learner-records-api
codec:
max-in-memory-size: 10MB

Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/logback-spring.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</encoder>
</appender>

<logger name="uk.gov.justice.digital.hmpps.templatepackagename.HmppsTemplateKotlinKt" additivity="false" level="DEBUG">
<logger name="uk.gov.justice.digital.hmpps.learnerrecordsapi.LearnerRecordsApiKt" additivity="false" level="DEBUG">
<appender-ref ref="consoleAppender"/>
</logger>

Expand Down
Loading

0 comments on commit a03dd66

Please sign in to comment.