Skip to content

Commit

Permalink
PI-2786 Create initial project for breach-notice-and-delius (#4645)
Browse files Browse the repository at this point in the history
* PI-2786 Create initial project for breach-notice-and-delius

* Boostrap

---------

Co-authored-by: probation-integration-bot[bot] <177347787+probation-integration-bot[bot]@users.noreply.github.com>
Co-authored-by: Anthony Britton <anthony.britton@digital.justice.gov.uk>
  • Loading branch information
1 parent e84a49f commit d99bdb6
Show file tree
Hide file tree
Showing 46 changed files with 935 additions and 7 deletions.
1 change: 1 addition & 0 deletions .github/workflows/access.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ on:
- '["arns-and-delius"]'
- '["assess-for-early-release-and-delius"]'
- '["assessment-summary-and-delius"]'
- '["breach-notice-and-delius"]'
- '["cas2-and-delius"]'
- '["cas3-and-delius"]'
- '["common-platform-and-delius"]'
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ jobs:
- arns-and-delius
- assess-for-early-release-and-delius
- assessment-summary-and-delius
- breach-notice-and-delius
- cas2-and-delius
- cas3-and-delius
- common-platform-and-delius
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/deploy-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ on:
- arns-and-delius
- assess-for-early-release-and-delius
- assessment-summary-and-delius
- breach-notice-and-delius
- cas2-and-delius
- cas3-and-delius
- common-platform-and-delius
Expand Down
15 changes: 8 additions & 7 deletions .github/workflows/messaging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,25 @@ on:
required: true
options:
- approved-premises-and-delius-queue
- assessment-summary-and-delius-queue
- breach-notice-and-delius-queue
- cas2-and-delius-queue
- cas3-and-delius-queue
- common-platform-and-delius-queue
- custody-key-dates-and-delius-queue
- make-recall-decisions-and-delius-queue
- manage-offences-and-delius-queue
- manage-pom-cases-and-delius-queue
- opd-and-delius-queue
- pre-sentence-reports-to-delius-queue
- prison-case-notes-to-probation-queue
- prison-custody-status-to-delius-queue
- prison-identifier-and-delius-queue
- refer-and-monitor-and-delius-queue
- risk-assessment-scores-to-delius-queue
- tier-to-delius-queue
- unpaid-work-and-delius-queue
- workforce-allocations-to-delius-queue
- manage-offences-and-delius-queue
- opd-and-delius-queue
- cas3-and-delius-queue
- prison-identifier-and-delius-queue
- assessment-summary-and-delius-queue
- cas2-and-delius-queue
- common-platform-and-delius-queue
# ^ add new queues here

jobs:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/service-catalogue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ on:
- '["arns-and-delius"]'
- '["assess-for-early-release-and-delius"]'
- '["assessment-summary-and-delius"]'
- '["breach-notice-and-delius"]'
- '["cas2-and-delius"]'
- '["cas3-and-delius"]'
- '["common-platform-and-delius"]'
Expand Down
10 changes: 10 additions & 0 deletions .idea/runConfigurations/breach-notice-and-delius.run.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions doc/tech-docs/source/services.html.md.erb
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,5 @@ weight: 20
* [Ims And Delius](https://ministryofjustice.github.io/hmpps-probation-integration-services/tech-docs/projects/ims-and-delius)
* [Justice Email And Delius](https://ministryofjustice.github.io/hmpps-probation-integration-services/tech-docs/projects/justice-email-and-delius)
* [Assess For Early Release And Delius](https://ministryofjustice.github.io/hmpps-probation-integration-services/tech-docs/projects/assess-for-early-release-and-delius)
* [Breach Notice And Delius](https://ministryofjustice.github.io/hmpps-probation-integration-services/tech-docs/projects/breach-notice-and-delius)
<li style="display: none">^ add new projects here</li>
Empty file.
3 changes: 3 additions & 0 deletions projects/breach-notice-and-delius/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# breach-notice-and-delius

// TODO Describe the service
62 changes: 62 additions & 0 deletions projects/breach-notice-and-delius/applicationinsights.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{
"role": {
"name": "breach-notice-and-delius"
},
"customDimensions": {
"service.version": "${VERSION}",
"service.team": "probation-integration"
},
"instrumentation": {
"logging": {
"level": "DEBUG"
},
"springScheduling": {
"enabled": false
}
},
"selfDiagnostics": {
"destination": "console"
},
"sampling": {
"percentage": 100
},
"preview": {
"sampling": {
"overrides": [
{
"telemetryType": "request",
"attributes": [
{
"key": "http.url",
"value": "https?://[^/]+/health/?.*",
"matchType": "regexp"
}
],
"percentage": 0
},
{
"telemetryType": "request",
"attributes": [
{
"key": "http.url",
"value": "https?://[^/]+/info/?.*",
"matchType": "regexp"
}
],
"percentage": 0
},
{
"telemetryType": "dependency",
"attributes": [
{
"key": "db.operation",
"value": "SELECT",
"matchType": "strict"
}
],
"percentage": 10
}
]
}
}
}
38 changes: 38 additions & 0 deletions projects/breach-notice-and-delius/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import uk.gov.justice.digital.hmpps.extensions.ClassPathExtension

apply(plugin = "com.google.cloud.tools.jib")

dependencies {
implementation(project(":libs:audit"))
implementation(project(":libs:commons"))
implementation(project(":libs:messaging"))
implementation(project(":libs:oauth-client"))
implementation(project(":libs:oauth-server"))

implementation("org.springframework.boot:spring-boot-starter-actuator")
implementation("org.springframework.boot:spring-boot-starter-data-jpa")
implementation("org.springframework.boot:spring-boot-starter-security")
implementation("org.springframework.boot:spring-boot-starter-validation")
implementation("org.springframework.boot:spring-boot-starter-web")
implementation("org.jetbrains.kotlin:kotlin-reflect")
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
implementation(libs.springdoc)

dev(project(":libs:dev-tools"))
dev("com.h2database:h2")
dev("org.testcontainers:oracle-free")

runtimeOnly("com.oracle.database.jdbc:ojdbc11")

testImplementation("org.springframework.boot:spring-boot-starter-test")
testImplementation(libs.bundles.mockito)
}

configure<ClassPathExtension> {
jacocoExclusions = listOf(
"**/config/**",
"**/entity/**",
"**/AppKt.class"
)
}
13 changes: 13 additions & 0 deletions projects/breach-notice-and-delius/deploy/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: v2
appVersion: '1.0'
description: A Helm chart for Kubernetes
name: breach-notice-and-delius
version: 1.0.0

dependencies:
- name: generic-service
version: "3.2"
repository: https://ministryofjustice.github.io/hmpps-helm-charts
- name: generic-prometheus-alerts
version: "1.4"
repository: https://ministryofjustice.github.io/hmpps-helm-charts
9 changes: 9 additions & 0 deletions projects/breach-notice-and-delius/deploy/database/access.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
database:
access:
username_key: /breach-notice-and-delius/db-username
password_key: /breach-notice-and-delius/db-password

audit:
username: BreachNoticeAndDelius
forename: Breach Notice
surname: Service
18 changes: 18 additions & 0 deletions projects/breach-notice-and-delius/deploy/values-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
enabled: false # TODO set this to true when you're ready to deploy your service

generic-service:
ingress:
host: breach-notice-and-delius-dev.hmpps.service.justice.gov.uk

scheduledDowntime:
enabled: true

env:
SENTRY_ENVIRONMENT: dev
LOGGING_LEVEL_UK_GOV_DIGITAL_JUSTICE_HMPPS: DEBUG
SPRING_SECURITY_OAUTH2_CLIENT_PROVIDER_HMPPS-AUTH_TOKEN-URI: https://sign-in-dev.hmpps.service.justice.gov.uk/auth/oauth/token
SPRING_SECURITY_OAUTH2_RESOURCESERVER_JWT_JWK_SET_URI: https://sign-in-dev.hmpps.service.justice.gov.uk/auth/.well-known/jwks.json
SPRING_SECURITY_OAUTH2_RESOURCESERVER_JWT_ISSUER_URI: https://sign-in-dev.hmpps.service.justice.gov.uk/auth/issuer

generic-prometheus-alerts:
businessHoursOnly: true
17 changes: 17 additions & 0 deletions projects/breach-notice-and-delius/deploy/values-preprod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
enabled: false # TODO set this to true when you're ready to deploy your service

generic-service:
ingress:
host: breach-notice-and-delius-preprod.hmpps.service.justice.gov.uk

scheduledDowntime:
enabled: true

env:
SENTRY_ENVIRONMENT: preprod
SPRING_SECURITY_OAUTH2_CLIENT_PROVIDER_HMPPS-AUTH_TOKEN-URI: https://sign-in-preprod.hmpps.service.justice.gov.uk/auth/oauth/token
SPRING_SECURITY_OAUTH2_RESOURCESERVER_JWT_JWK_SET_URI: https://sign-in-preprod.hmpps.service.justice.gov.uk/auth/.well-known/jwks.json
SPRING_SECURITY_OAUTH2_RESOURCESERVER_JWT_ISSUER_URI: https://sign-in-preprod.hmpps.service.justice.gov.uk/auth/issuer

generic-prometheus-alerts:
businessHoursOnly: true
11 changes: 11 additions & 0 deletions projects/breach-notice-and-delius/deploy/values-prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
enabled: false # TODO set this to true when you're ready to deploy your service

generic-service:
ingress:
host: breach-notice-and-delius.hmpps.service.justice.gov.uk

env:
SENTRY_ENVIRONMENT: prod
SPRING_SECURITY_OAUTH2_CLIENT_PROVIDER_HMPPS-AUTH_TOKEN-URI: https://sign-in.hmpps.service.justice.gov.uk/auth/oauth/token
SPRING_SECURITY_OAUTH2_RESOURCESERVER_JWT_JWK_SET_URI: https://sign-in.hmpps.service.justice.gov.uk/auth/.well-known/jwks.json
SPRING_SECURITY_OAUTH2_RESOURCESERVER_JWT_ISSUER_URI: https://sign-in.hmpps.service.justice.gov.uk/auth/issuer
29 changes: 29 additions & 0 deletions projects/breach-notice-and-delius/deploy/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Common values
generic-service:
productId: HMPPS518
nameOverride: breach-notice-and-delius
serviceAccountName: breach-notice-and-delius

image:
repository: ghcr.io/ministryofjustice/hmpps-probation-integration-services/breach-notice-and-delius

ingress:
tlsSecretName: breach-notice-and-delius-cert

namespace_secrets:
common:
SPRING_DATASOURCE_URL: DB_URL
breach-notice-and-delius-client-credentials:
OAUTH2_CLIENT-ID: CLIENT_ID
OAUTH2_CLIENT-SECRET: CLIENT_SECRET
breach-notice-and-delius-database:
SPRING_DATASOURCE_USERNAME: DB_USERNAME
SPRING_DATASOURCE_PASSWORD: DB_PASSWORD
breach-notice-and-delius-sentry:
SENTRY_DSN: SENTRY_DSN
breach-notice-and-delius-queue:
MESSAGING_CONSUMER_QUEUE: QUEUE_NAME

generic-prometheus-alerts:
targetApplication: breach-notice-and-delius

1 change: 1 addition & 0 deletions projects/breach-notice-and-delius/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rootProject.name = "breach-notice-and-delius"
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package uk.gov.justice.digital.hmpps.data

import jakarta.annotation.PostConstruct
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
import org.springframework.boot.context.event.ApplicationReadyEvent
import org.springframework.context.ApplicationListener
import org.springframework.stereotype.Component
import uk.gov.justice.digital.hmpps.data.generator.UserGenerator
import uk.gov.justice.digital.hmpps.user.AuditUserRepository

@Component
@ConditionalOnProperty("seed.database")
class DataLoader(
private val auditUserRepository: AuditUserRepository
) : ApplicationListener<ApplicationReadyEvent> {

@PostConstruct
fun saveAuditUser() {
auditUserRepository.save(UserGenerator.AUDIT_USER)
}

override fun onApplicationEvent(are: ApplicationReadyEvent) {
// Perform dev/test database setup here, using JPA repositories and generator classes...
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package uk.gov.justice.digital.hmpps.data.generator

import uk.gov.justice.digital.hmpps.message.HmppsDomainEvent
import uk.gov.justice.digital.hmpps.resourceloader.ResourceLoader

object MessageGenerator {
val EXAMPLE = ResourceLoader.message<HmppsDomainEvent>("example-message")
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package uk.gov.justice.digital.hmpps.data.generator

import uk.gov.justice.digital.hmpps.user.AuditUser

object UserGenerator {
val AUDIT_USER = AuditUser(IdGenerator.getAndIncrement(), "BreachNoticeAndDelius")
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"Type": "Notification",
"MessageId": "aa2c2828-167f-529b-8e19-73735a2fb85c",
"TopicArn": "arn:aws:sns:eu-west-2:000000000000:example",
"Message": "{\"eventType\":\"example\",\"version\":1,\"description\":\"Example event\",\"detailUrl\":\"http://localhost:{wiremock.port}/example/123\",\"occurredAt\":\"2022-07-27T15:22:08.452612281+01:00\",\"additionalInformation\":{\"exampleId\":\"123\"},\"personReference\":{\"identifiers\":[{\"type\":\"CRN\",\"value\":\"A000001\"}]}}",
"Timestamp": "2022-07-27T14:22:08.509Z",
"SignatureVersion": "1",
"Signature": "EXAMPLE",
"SigningCertURL": "https://sns.eu-west-2.amazonaws.com/EXAMPLE.pem",
"UnsubscribeURL": "https://sns.eu-west-2.amazonaws.com/?Action=Unsubscribe&SubscriptionArn=EXAMPLE",
"MessageAttributes": {
"eventType": {
"Type": "String",
"Value": "example"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"request": {
"method": "POST",
"urlPath": "/auth/oauth/token"
},
"response": {
"headers": {
"Content-Type": "application/json"
},
"status": 200,
"jsonBody": {
"access_token": "token",
"token_type": "bearer",
"expires_in": 9999999999,
"scope": "read write",
"sub": "probation-integration-dev",
"auth_source": "none",
"iss": "https://sign-in-dev.hmpps.service.justice.gov.uk/auth/issuer"
}
}
}
Loading

0 comments on commit d99bdb6

Please sign in to comment.