Skip to content

ministryofjustice/hmpps-dpr-tools-api

Repository files navigation

hmpps-dpr-tools-api

repo standards badge CircleCI Docker Repository on Quay API docs

This project is generated from ministryofjustice/hmpps-template-kotlin

Requires Java 17 or above

CODEOWNER

Overview

Provides a front end for Management Information Visualisation and Presentation

Local Development

This project uses gradle which is bundled with the repository and also makes use of

  • micronaut - for compile time dependency injection
  • lombok - to reduce boilerplate when creating data classes
  • jacoco - for test coverage reports

Running Locally against Dev

  1. Add implementation("com.h2database:h2:2.1.214") to build.gradle
  2. Change the existing datasource config in the application.yml file to the following:
  jpa:
    database-platform: org.hibernate.dialect.H2Dialect
    hibernate:
      ddl-auto: create-drop
  datasource:
    url: jdbc:h2:mem:datamart;MODE=PostgreSQL;DB_CLOSE_DELAY=-1;INIT=CREATE SCHEMA IF NOT EXISTS domain\;
    username: sa
    password: sa
    driver-class-name: org.h2.Driver
  1. Add the following two environment variables on intellij run configuration HMPPS_AUTH_URL https://sign-in-dev.hmpps.service.justice.gov.uk/auth

    AUTHORISED_ROLES ROLE_PRISONS_REPORTING_TOOLS_USER
  2. Optional: Change the org.springframework.security level to DEBUG in logback-spring.xml
  3. Run main from DigitalPrisonReportingMi

Testing

Note - test coverage reports are enabled by default and after running the tests the report will be written to build/reports/jacoco/test/html

Unit Tests

The unit tests use JUnit5 and Mockito where appropriate. Use the following to run the tests.

    ./gradlew clean test

Contributing

Please adhere to the following guidelines when making contributions to the project.

Documentation

  • Keep all code commentary and documentation up to date

Branch Naming

  • Use a JIRA ticket number where available
  • Otherwise a short descriptive name is acceptable

Commit Messages

  • Prefix any commit messages with the JIRA ticket number where available
  • Otherwise use the prefix NOJIRA

Pull Requests

  • Reference or link any relevant JIRA tickets in the pull request notes
  • At least one approval is required before a PR can be merged

Deployment

The app is deployed to the namespace: hmpps-dpr-tools-<env>.

Config for the dev environment can be found here: https://github.com/ministryofjustice/cloud-platform-environments/tree/main/namespaces/live.cloud-platform.service.justice.gov.uk/hmpps-dpr-tools-dev

Additionally, the RedShift credentials need to be manually deployed to each environment. The file redshift-jdbc-secret.yaml should be updated with the base64 encoded values and applied to the environment.

NB: Please do not commit these changes to redshift-jdbc-secret.yaml.

Example of base64 encoding a secret value:

echo -n 'placeholder' | base64

Example of applying the secret to an environment:

kubectl -n hmpps-dpr-tools-dev apply -f redshift-jdbc-secret.yaml

About

HMPPS Digital Prisons Reporting Tools API

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published