This project is generated from ministryofjustice/hmpps-template-kotlin
Requires Java 17 or above
Provides a front end for Management Information Visualisation and Presentation
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
- Add implementation("com.h2database:h2:2.1.214") to build.gradle
- 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
- 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_USER
- Optional: Change the org.springframework.security level to DEBUG in logback-spring.xml
- Run main from DigitalPrisonReportingMi
Note - test coverage reports are enabled by default and after running the tests the report will be written to build/reports/jacoco/test/html
The unit tests use JUnit5 and Mockito where appropriate. Use the following to run the tests.
./gradlew clean test
Please adhere to the following guidelines when making contributions to the project.
- Keep all code commentary and documentation up to date
- Use a JIRA ticket number where available
- Otherwise a short descriptive name is acceptable
- Prefix any commit messages with the JIRA ticket number where available
- Otherwise use the prefix
NOJIRA
- Reference or link any relevant JIRA tickets in the pull request notes
- At least one approval is required before a PR can be merged
The app is deployed to the namespace: hmpps-digital-prison-reporting-mi-<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-digital-prison-reporting-mi-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-digital-prison-reporting-mi-dev apply -f redshift-jdbc-secret.yaml
The data product definition files are in digital-prison-reporting-data-product-definitions directory
which is a git submodule.
In order to deploy new files from this repository to the reporting mi application you would need to pull the latest changes from the submodule's main branch.
Then create symlinks from the new json files in the submodule to the main resources directory.
And finally these new files would need to be added to the Dockerfile.
cd digital-prison-reporting-data-product-definitions
git checkout main
git pull
cd ../src/main/resources
ln -s ../../../digital-prison-reporting-data-product-definitions/prisons/orphanage/external-movements.json
- The last step is to add the file to Dockerfile by adding this line to Dockerfile below line 21:
ADD ./digital-prison-reporting-data-product-definitions/prisons/orphanage/external-movements.json .
- And finally add this file location to the env variable DPR_LIB_DEFINITION_LOCATIONS by appending the file name to the comma separated list of files
here:
ENV DPR_LIB_DEFINITION_LOCATIONS=
- So for example for a new file called external movements assuming you already had dpd001-court-hospital-movements.json you would have:
ENV DPR_LIB_DEFINITION_LOCATIONS=/external-movements.json,/dpd001-court-hospital-movements.json
- Following the above steps the same can be done for any file.
- If an existing file has changed then a new deployment of the reporting mi application will pick up these changes as this happens through the circleci pipeline.