|
4 | 4 | [](https://ghcr.io/ministryofjustice/hmpps-person-integration-api)
|
5 | 5 | [](https://hmpps-person-integration-api-dev.hmpps.service.justice.gov.uk/webjars/swagger-ui/index.html?configUrl=/v3/api-docs)
|
6 | 6 |
|
7 |
| -Template github repo used for new Kotlin based projects. |
| 7 | +This is a Spring Boot service, written in Kotlin, which acts as an interface to the data in the Core Person Record and Person Protected Characteristics domains. |
8 | 8 |
|
9 |
| -# Instructions |
| 9 | +## Contents |
10 | 10 |
|
11 |
| -If this is a HMPPS project then the project will be created as part of bootstrapping - |
12 |
| -see [dps-project-bootstrap](https://github.com/ministryofjustice/dps-project-bootstrap). You are able to specify a |
13 |
| -template application using the `github_template_repo` attribute to clone without the need to manually do this yourself |
14 |
| -within GitHub. |
| 11 | +1. [Building, Testing and Running](readme/build_test_run.md) |
| 12 | +2. [Architecture Decision Records](architecture-decision-record/README.md) |
15 | 13 |
|
16 |
| -This project is community managed by the mojdt `#kotlin-dev` slack channel. |
17 |
| -Please raise any questions or queries there. Contributions welcome! |
18 |
| - |
19 |
| -Our security policy is located [here](https://github.com/ministryofjustice/hmpps-person-integration-api/security/policy). |
20 |
| - |
21 |
| -Documentation to create new service is located [here](https://tech-docs.hmpps.service.justice.gov.uk/applicationplatform/newservice-GHA/). |
22 |
| - |
23 |
| -## Creating a Cloud Platform namespace |
24 |
| - |
25 |
| -When deploying to a new namespace, you may wish to use the |
26 |
| -[templates project namespace](https://github.com/ministryofjustice/cloud-platform-environments/tree/main/namespaces/live.cloud-platform.service.justice.gov.uk/hmpps-templates-dev) |
27 |
| -as the basis for your new namespace. This namespace contains both the kotlin and typescript template projects, |
28 |
| -which is the usual way that projects are setup. |
29 |
| - |
30 |
| -Copy this folder and update all the existing namespace references to correspond to the environment to which you're deploying. |
31 |
| - |
32 |
| -If you only need the kotlin configuration then remove all typescript references and remove the elasticache configuration. |
33 |
| - |
34 |
| -To ensure the correct github teams can approve releases, you will need to make changes to the configuration in `resources/service-account-github` where the appropriate team names will need to be added (based on [lines 98-100](https://github.com/ministryofjustice/cloud-platform-environments/blob/main/namespaces/live.cloud-platform.service.justice.gov.uk/hmpps-templates-dev/resources/serviceaccount-github.tf#L98) and the reference appended to the teams list below [line 112](https://github.com/ministryofjustice/cloud-platform-environments/blob/main/namespaces/live.cloud-platform.service.justice.gov.uk/hmpps-templates-dev/resources/serviceaccount-github.tf#L112)). Note: hmpps-sre is in this list to assist with deployment issues. |
35 |
| - |
36 |
| -Submit a PR to the Cloud Platform team in |
37 |
| -#ask-cloud-platform. Further instructions from the Cloud Platform team can be found in |
38 |
| -the [Cloud Platform User Guide](https://user-guide.cloud-platform.service.justice.gov.uk/#cloud-platform-user-guide) |
39 |
| - |
40 |
| -## Renaming from HMPPS Template Kotlin - github Actions |
41 |
| - |
42 |
| -Once the new repository is deployed. Navigate to the repository in github, and select the `Actions` tab. |
43 |
| -Click the link to `Enable Actions on this repository`. |
44 |
| - |
45 |
| -Find the Action workflow named: `rename-project-create-pr` and click `Run workflow`. This workflow will |
46 |
| -execute the `rename-project.bash` and create Pull Request for you to review. Review the PR and merge. |
47 |
| - |
48 |
| -Note: ideally this workflow would run automatically however due to a recent change github Actions are not |
49 |
| -enabled by default on newly created repos. There is no way to enable Actions other then to click the button in the UI. |
50 |
| -If this situation changes we will update this project so that the workflow is triggered during the bootstrap project. |
51 |
| -Further reading: <https://github.community/t/workflow-isnt-enabled-in-repos-generated-from-template/136421> |
52 |
| - |
53 |
| -The script takes six arguments: |
54 |
| - |
55 |
| -### New project name |
56 |
| - |
57 |
| -This should start with `hmpps-` e.g. `hmpps-prison-visits` so that it can be easily distinguished in github from |
58 |
| -other departments projects. Try to avoid using abbreviations so that others can understand easily what your project is. |
59 |
| - |
60 |
| -### Slack channel for release notifications |
61 |
| - |
62 |
| -By default, release notifications are only enabled for production. The circleci configuration can be amended to send |
63 |
| -release notifications for deployments to other environments if required. Note that if the configuration is amended, |
64 |
| -the slack channel should then be amended to your own team's channel as `dps-releases` is strictly for production release |
65 |
| -notifications. If the slack channel is set to something other than `dps-releases`, production release notifications |
66 |
| -will still automatically go to `dps-releases` as well. This is configured by `releases-slack-channel` in |
67 |
| -`.circleci/config.yml`. |
68 |
| - |
69 |
| -### Slack channel for pipeline security notifications |
70 |
| - |
71 |
| -Ths channel should be specific to your team and is for daily / weekly security scanning job results. It is your team's |
72 |
| -responsibility to keep up-to-date with security issues and update your application so that these jobs pass. You will |
73 |
| -only be notified if the jobs fail. The scan results can always be found in circleci for your project. This is |
74 |
| -configured by `alerts-slack-channel` in `.circleci/config.yml`. |
75 |
| - |
76 |
| -### Non production kubernetes alerts |
77 |
| - |
78 |
| -By default Prometheus alerts are created in the application namespaces to monitor your application e.g. if your |
79 |
| -application is crash looping, there are a significant number of errors from the ingress. Since Prometheus runs in |
80 |
| -cloud platform AlertManager needs to be setup first with your channel. Please see |
81 |
| -[Create your own custom alerts](https://user-guide.cloud-platform.service.justice.gov.uk/documentation/monitoring-an-app/how-to-create-alarms.html) |
82 |
| -in the Cloud Platform user guide. Once that is setup then the `custom severity label` can be used for |
83 |
| -`alertSeverity` in the `helm_deploy/values-*.yaml` configuration. |
84 |
| - |
85 |
| -Normally it is worth setting up two separate labels and therefore two separate slack channels - one for your production |
86 |
| -alerts and one for your non-production alerts. Using the same channel can mean that production alerts are sometimes |
87 |
| -lost within non-production issues. |
88 |
| - |
89 |
| -### Production kubernetes alerts |
90 |
| - |
91 |
| -This is the severity label for production, determined by the `custom severity label`. See the above |
92 |
| -#non-production-kubernetes-alerts for more information. This is configured in `helm_deploy/values-prod.yaml`. |
93 |
| - |
94 |
| -### Product ID |
95 |
| - |
96 |
| -This is so that we can link a component to a product and thus provide team and product information in the Developer |
97 |
| -Portal. Refer to the developer portal at https://developer-portal.hmpps.service.justice.gov.uk/products to find your |
98 |
| -product id. This is configured in `helm_deploy/<project_name>/values.yaml`. |
99 |
| - |
100 |
| -## Manually branding from template app |
101 |
| - |
102 |
| -Run the `rename-project.bash` without any arguments. This will prompt for the six required parameters and create a PR. |
103 |
| -The script requires a recent version of `bash` to be installed, as well as GNU `sed` in the path. |
104 |
| - |
105 |
| -## TODOs and Examples |
106 |
| - |
107 |
| -We have tried to provide some examples of best practice in the application - so there are lots of TODOs in the code |
108 |
| -where changes are required to meet your requirements. There is an `ExampleResource` that includes best practice and also |
109 |
| -serve as spring security examples. The template typescript project has a demonstration that calls this endpoint as well. |
110 |
| - |
111 |
| -For the demonstration, rather than introducing a dependency on a different service, this application calls out to |
112 |
| -itself. This is only to show a service calling out to another service and is certainly not recommended! |
113 |
| - |
114 |
| -## Running the application locally |
115 |
| - |
116 |
| -The application comes with a `dev` spring profile that includes default settings for running locally. This is not |
117 |
| -necessary when deploying to kubernetes as these values are included in the helm configuration templates - |
118 |
| -e.g. `values-dev.yaml`. |
119 |
| - |
120 |
| -There is also a `docker-compose.yml` that can be used to run a local instance of the template in docker and also an |
121 |
| -instance of HMPPS Auth (required if your service calls out to other services using a token). |
122 |
| - |
123 |
| -```bash |
124 |
| -docker compose pull && docker compose up |
125 |
| -``` |
126 |
| - |
127 |
| -will build the application and run it and HMPPS Auth within a local docker instance. |
128 |
| - |
129 |
| -### Running the application in Intellij |
130 |
| - |
131 |
| -```bash |
132 |
| -docker compose pull && docker compose up --scale hmpps-person-integration-api=0 |
133 |
| -``` |
134 |
| - |
135 |
| -will just start a docker instance of HMPPS Auth. The application should then be started with a `dev` active profile |
136 |
| -in Intellij. |
0 commit comments