Incentives Domain Microservice to own the incentives data for prisoners
For running locally against docker instances of the following services:
- hmpps-auth
- prison-api
- run this application independently e.g. in IntelliJ
docker-compose up --scale hmpps-incentives-api=0
docker-compose up
This is straight-forward as authentication is delegated down to the calling services. Environment variables to be set are as follows:
API_BASE_URL_OAUTH=https://sign-in-dev.hmpps.service.justice.gov.uk/auth
API_BASE_URL_PRISON=https://prison-api-dev.prison.service.justice.gov.uk
API_BASE_URL_OFFENDER_SEARCH=https://prisoner-search-dev.prison.service.justice.gov.uk
INCENTIVES_API_CLIENT_ID=[choose a suitable hmpps-auth client]
INCENTIVES_API_CLIENT_SECRET=
Before running integration tests you need to start a localstack instance
docker-compose up localstack
This assumes you have the AWS CLI installed
- Follow Running Locally to bring up the service and docker containers
- Find the ARN of the Domain Events topic created in your localstack instance and update the
topic-arn
parameter in the command belowaws --endpoint-url=http://localhost:4566 sns publish \ --topic-arn arn:aws:sns:eu-west-2:000000000000:11111111-2222-3333-4444-555555555555 \ --message-attributes '{ "eventType": { "DataType": "String", "StringValue": "prisoner-offender-search.prisoner.received" } }' \ --message '{ "version": "1.0", "occurredAt": "2020-02-12T15:14:24.125533+00:00", "publishedAt": "2020-02-12T15:15:09.902048716+00:00", "description": "A prisoner has been received into a prison with reason: admission on new charges", "additionalInformation": { "nomsNumber": "A0289IR", "prisonId": "MDI", "reason": "NEW_ADMISSION" } }'
- Paste the command into your terminal
NOTE: If you get a Topic does not exist
error, it may mean your default AWS profile points to a different region,
be sure it points to eu-west-2
either by changing your default profile or by passing --region eu-west-1
to the
command above.
There are custom gradle tasks that make it easier to connect to AWS resources (RDS and ElastiCache Redis) in Cloud Platform from a local port:
./gradlew portForwardRDS
# and
./gradlew portForwardRedis
These could be useful to, for instance, clear out a development database or edit data live.
They require kubectl
to already be set up to access the kubernetes cluster;
essentially these tasks are just convenience wrappers.
Both accept the --environment
argument to select between dev
, preprod
and prod
namespaces
or prompt for user input when run.
Both also accept the --port
argument to choose a different local port, other than the resource’s default.
Architecture decision records start here