Skip to content

Commit

Permalink
Removed unnecessary (I think) code, and amended some values from temp…
Browse files Browse the repository at this point in the history
…late app values. More TODOs to do.
  • Loading branch information
JazJax committed Sep 13, 2024
1 parent 6e0ae55 commit 1cc6f91
Show file tree
Hide file tree
Showing 10 changed files with 104 additions and 42 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# List of the jobs in CircleCI we may need to replicate: */
# - way to send alerts to slack
# - jobs
# - validate
# - workflows
# - build, test and deploty (which contains jobs) [WORKFLOW]
# - jobs:
# - validate (runs job as devined above)
# - hmpps/helm_lint <-- (probs can't replicate)
# - hmpps/build-multiplatform-docker <-- (probs can't replicate)
# - deploy-env
# - [COMMENTED OUT JOBS]
# - request preprod aproval
# - deploy env (again, but with preprod)
# - request-prod-approval
# - deploy-env (but prod)
# - Security [WORKFLOW] <-- (probs can't replicate)
# - has triggers: 7:15 daily
# - has jobs: owasp, trivy, and veracode, all in the hmpps orb
# - Security weekly [WORKFLOW] <-- (probs can't replicate)
# - has triggers: 5am monday
# - has jobs: veracode, from the hmpps orb



# What does validate do? Using java 21, it...
# -> checks out the code
# -> restores the cache
# This is the cached dependencies generated in a previous run on circleCI
# It's saved/recalled with the checksum of the build.gradle.kts file
# OR, if that's not there, any generic gradle cache
# -> runs ./gradlew check
# This is basically just ./gradlew test
# You can add to this with plugins in build.gradle.kts
# -> saves the cache in the same place
# -> stores test results and artefacts in /build

# Original code from .circleci/config.yml
# validate:
# executor:
# name: hmpps/java
# tag: "21.0"
# steps:
# - checkout
# - restore_cache:
# keys:
# - gradle-{{ checksum "build.gradle.kts" }}
# - gradle-
# - run:
# command: ./gradlew check
# - save_cache:
# paths:
# - ~/.gradle
# key: gradle-{{ checksum "build.gradle.kts" }}
# - store_test_results:
# path: build/test-results
# - store_artifacts:
# path: build/reports/tests
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-electronic-monitoring-datastore-api
version: 0.2.0
dependencies:
- name: generic-service
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
generic-service:
nameOverride: hmpps-template-kotlin
nameOverride: hmpps-electronic-monitoring-datastore-api
productId: "HMPPS529" # productId for the product that this belongs too, i.e. DPS001, see README.md for details

replicaCount: 4

image:
repository: quay.io/hmpps/hmpps-template-kotlin
repository: quay.io/hmpps/hmpps-electronic-monitoring-datastore-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
# TODO: Do we need to change this secret name?
# Do we need to make this match the secret record we create in the namespace?
# This seems unlikely, as it looks like secrets and secret-names are per-environment

# Environment variables to load into the deployment
env:
Expand All @@ -29,13 +32,15 @@ generic-service:
namespace_secrets:
hmpps-template-kotlin:
APPINSIGHTS_INSTRUMENTATIONKEY: "APPINSIGHTS_INSTRUMENTATIONKEY"
# TODO: Check that the appinsights_instrumentaitonKey exists in the NS
# Example client registration secrets
EXAMPLE_API_CLIENT_ID: "TEMPLATE_KOTLIN_API_CLIENT_ID"
EXAMPLE_API_CLIENT_SECRET: "TEMPLATE_KOTLIN_API_CLIENT_SECRET"
# TODO: add in appropriate client registration details - once these exist in the namespace

allowlist:
groups:
- internal

generic-prometheus-alerts:
targetApplication: hmpps-template-kotlin
targetApplication: hmpps-electronic-monitoring-datastore-api
10 changes: 5 additions & 5 deletions helm_deploy/values-dev.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
---
# Per environment values which override defaults in hmpps-template-kotlin/values.yaml
# Per environment values which override defaults in hmpps-electronic-monitoring-datastore-api/values.yaml

generic-service:
replicaCount: 2

ingress:
host: template-kotlin-dev.hmpps.service.justice.gov.uk
host: hmpps-electronic-monitoring-datastore-api-dev.hmpps.service.justice.gov.uk
# TODO: Create certificate as per https://user-guide.cloud-platform.service.justice.gov.uk/documentation/other-topics/custom-domain-cert.html

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"

# TODO: any external API URLS go here, e.g. "https://template-kotlin-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
Expand Down
9 changes: 4 additions & 5 deletions helm_deploy/values-preprod.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
---
# Per environment values which override defaults in hmpps-template-kotlin/values.yaml
# Per environment values which override defaults in hmpps-electronic-monitoring-datastore-api/values.yaml

generic-service:
replicaCount: 2

ingress:
host: template-kotlin-preprod.hmpps.service.justice.gov.uk
host: hmpps-electronic-monitoring-datastore-api-preprod.hmpps.service.justice.gov.uk
# TODO: Create certificate as per https://user-guide.cloud-platform.service.justice.gov.uk/documentation/other-topics/custom-domain-cert.html

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"
# TODO: any external API URLS go here, e.g. "https://template-kotlin-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
Expand Down
10 changes: 5 additions & 5 deletions helm_deploy/values-prod.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
---
# Per environment values which override defaults in hmpps-template-kotlin/values.yaml
# Per environment values which override defaults in hmpps-electronic-monitoring-datastore-api/values.yaml

generic-service:
ingress:
host: template-kotlin.hmpps.service.justice.gov.uk
host: hmpps-electronic-monitoring-datastore-api.hmpps.service.justice.gov.uk
# TODO: Create certificate as per https://user-guide.cloud-platform.service.justice.gov.uk/documentation/other-topics/custom-domain-cert.html

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"

# TODO: any external API URLS go here, e.g. "https://template-kotlin.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
Expand Down
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-electronic-monitoring-datastore-api"
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,17 @@ class OpenApiConfiguration(buildProperties: BuildProperties) {
Server().url("http://localhost:8080").description("Local"),
),
)
.tags(
listOf(
// TODO: Remove the Popular and Examples tag and start adding your own tags to group your resources
Tag().name("Popular")
.description("The most popular endpoints. Look here first when deciding which endpoint to use."),
Tag().name("Examples").description("Endpoints for searching for a prisoner within a prison"),
),
)
// TODO: Add tags for OpenAPI - below are commented out Popular and Examples tags
// .tags(
// listOf(
// Tag().name("Popular")
// .description("The most popular endpoints. Look here first when deciding which endpoint to use."),
// Tag().name("Examples").description("Endpoints for searching for a prisoner within a prison"),
// ),
// )
.info(
Info().title("HMPPS Template Kotlin").version(version)
.contact(Contact().name("HMPPS Digital Studio").email("feedback@digital.justice.gov.uk")),
Info().title("HMPPS Electronic Monitoring datastore API").version(version)
.contact(Contact().name("Electronic Monitoring").email("hmpps-ems-platform-team@digital.justice.gov.uk")),
)
// TODO: Remove the default security schema and start adding your own schemas and roles to describe your
// service authorisation requirements
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ class WebClientConfiguration(
@Value("\${api.timeout:20s}") val timeout: Duration,
) {
// HMPPS Auth health ping is required if your service calls HMPPS Auth to get a token to call other services
// TODO: Remove the health ping if no call outs to other services are made
// Remove the health ping if no call outs to other services are made
@Bean
fun hmppsAuthHealthWebClient(builder: WebClient.Builder): WebClient = builder.healthWebClient(hmppsAuthBaseUri, healthTimeout)

// TODO: This is an example health bean for checking other services and should be removed / replaced
@Bean
fun exampleApiHealthWebClient(builder: WebClient.Builder): WebClient = builder.healthWebClient(exampleApiBaseUri, healthTimeout)
// This is an example of a health bean for checking other services
// @Bean
// fun exampleApiHealthWebClient(builder: WebClient.Builder): WebClient = builder.healthWebClient(exampleApiBaseUri, healthTimeout)

// TODO: This is an example bean for calling other services and should be removed / replaced
@Bean
fun exampleApiWebClient(authorizedClientManager: OAuth2AuthorizedClientManager, builder: WebClient.Builder): WebClient =
builder.authorisedWebClient(authorizedClientManager, registrationId = "example-api", url = exampleApiBaseUri, timeout)
// This is an example of a bean for calling other services
// @Bean
// fun exampleApiWebClient(authorizedClientManager: OAuth2AuthorizedClientManager, builder: WebClient.Builder): WebClient =
// builder.authorisedWebClient(authorizedClientManager, registrationId = "example-api", url = exampleApiBaseUri, timeout)
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import org.springframework.web.reactive.function.client.WebClient
import uk.gov.justice.hmpps.kotlin.health.HealthPingCheck

// HMPPS Auth health ping is required if your service calls HMPPS Auth to get a token to call other services
// TODO: Remove the health ping if no call outs to other services are made
// Remove the health ping if no call outs to other services are made
@Component("hmppsAuth")
class HmppsAuthHealthPing(@Qualifier("hmppsAuthHealthWebClient") webClient: WebClient) : HealthPingCheck(webClient)

// TODO: Example ping health check calling out to other services
@Component("exampleApi")
class ExampleApiHealthPing(@Qualifier("exampleApiHealthWebClient") webClient: WebClient) : HealthPingCheck(webClient)
// Example ping health check calling out to other services
// @Component("exampleApi")
// class ExampleApiHealthPing(@Qualifier("exampleApiHealthWebClient") webClient: WebClient) : HealthPingCheck(webClient)

0 comments on commit 1cc6f91

Please sign in to comment.