From 91c16af5a6b78924f263cb591aa9cc632ec33128 Mon Sep 17 00:00:00 2001 From: Bingjie Liu Date: Mon, 25 Mar 2024 12:02:16 +0000 Subject: [PATCH 1/2] Fix guides links and add documentation on how to setup new client event subscriber queue --- README.md | 10 ++++----- docs/guides/setting-up-a-new-consumer.md | 28 +++++++++++++++++++++++- 2 files changed, 32 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index bfdd2f521..3b875308d 100644 --- a/README.md +++ b/README.md @@ -253,11 +253,11 @@ Note, this will only specifically enable the `RequestLogger`. ## Developer guides -- [Creating an environment](/docs/creating-an-environment.md) -- [Setting up a CircleCI context for deployment](/docs/setting-up-circleci-context-for-deployment.md) -- [Setting up a new consumer](/docs/setting-up-a-new-consumer.md) -- [Updating diagrams](/docs/updating-diagrams.md) -- [Useful commands](/docs/useful-commands.md) +- [Creating an environment](/docs/guides/creating-an-environment.md) +- [Setting up a CircleCI context for deployment](/docs/guides/setting-up-circleci-context-for-deployment.md) +- [Setting up a new consumer](/docs/guides/setting-up-a-new-consumer.md) +- [Updating diagrams](/docs/guides/updating-diagrams.md) +- [Useful commands](/docs/guides/useful-commands.md) ## Related repositories diff --git a/docs/guides/setting-up-a-new-consumer.md b/docs/guides/setting-up-a-new-consumer.md index 510578567..2a459a727 100644 --- a/docs/guides/setting-up-a-new-consumer.md +++ b/docs/guides/setting-up-a-new-consumer.md @@ -84,7 +84,33 @@ kubectl -n hmpps-integration-api- get secrets consumer-api-keys -o # E.g. kubectl -n hmpps-integration-api-dev get secrets consumer-api-keys -o json | jq -r '.data.dev' | base64 -d ``` -2. Using [One-Time Secret](https://onetimesecret.com/) and email, send the new consumer their: +2. Using [One-Time Secret](https://password.link/en) and email, send the new consumer their: 1. private key 2. client certificate 3. API key + +## Create new consumer subscriber queue + +### Create basic infrastructure +Within the [Cloud Platform Environments GitHub repository](https://github.com/ministryofjustice/cloud-platform-environments/tree/main) and the namespace of the environment: + +1. Create a branch. +2. Add new client subscriber terraform file. Example: [event-subscriber-mapps.tf](https://github.com/ministryofjustice/cloud-platform-environments/pull/22091/files#diff-4046866c9398b1db59a427052406a08c2adab45aadbc278f16232157a636f451) +3. Rename client name "mapps" to new client name +4. Add new client filter list secret. exmaple [secret.tf](https://github.com/ministryofjustice/cloud-platform-environments/pull/22091/files#diff-bc13dba50c430d2a667e5b867d2798770e5e8c48697407d93e2febedb3ff46dc) +5. Follow steps 3-8 in [Create an API key](#create-an-api-key) to merge branch to main. + +After the change is merged and applied, you can retrieve client queue name and ARN with the following command: + +```bash +kubectl -n hmpps-integration-api-[environment] get secrets [your queue secret name] -o json +# E.g. kubectl -n hmpps-integration-api-dev get secrets event-mapps-queue -o json +``` +### Using AWS secret for filter Policy +1. Login to the [AWS Console](https://user-guide.cloud-platform.service.justice.gov.uk/documentation/getting-started/accessing-the-cloud-console.html), navigate to Secrets Manager and navigate to the secret created in the previous step by search using the secret description. e.g. MAPPS event filter list Pre-prod +2. Click on the secret and then click on Retrieve secret value. If this is your first time accessing the new secret, you will see an error Failed to get the secret value. +3. Click on Set secret Value, and set the Plaintext value as: {"eventType":["default"]} +4. Save the change +5. Create new [Cloud Platform Environments GitHub repository](https://github.com/ministryofjustice/cloud-platform-environments/tree/main) branch +6. Load secret value from AWS and update filter_policy value. Follow [Example](https://github.com/ministryofjustice/cloud-platform-environments/pull/22111/files). Note: you will need get secret name from AWS console. +7. Follow steps 3-8 in [Create an API key](#create-an-api-key) to merge branch to main. From 7818f4701d9b65100a4fe626f6c1904d45a92f51 Mon Sep 17 00:00:00 2001 From: Bingjie Liu Date: Mon, 25 Mar 2024 15:11:04 +0000 Subject: [PATCH 2/2] Update documentation --- docs/guides/setting-up-a-new-consumer.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/guides/setting-up-a-new-consumer.md b/docs/guides/setting-up-a-new-consumer.md index 2a459a727..0263fc657 100644 --- a/docs/guides/setting-up-a-new-consumer.md +++ b/docs/guides/setting-up-a-new-consumer.md @@ -109,8 +109,8 @@ kubectl -n hmpps-integration-api-[environment] get secrets [your queue secret na ### Using AWS secret for filter Policy 1. Login to the [AWS Console](https://user-guide.cloud-platform.service.justice.gov.uk/documentation/getting-started/accessing-the-cloud-console.html), navigate to Secrets Manager and navigate to the secret created in the previous step by search using the secret description. e.g. MAPPS event filter list Pre-prod 2. Click on the secret and then click on Retrieve secret value. If this is your first time accessing the new secret, you will see an error Failed to get the secret value. -3. Click on Set secret Value, and set the Plaintext value as: {"eventType":["default"]} +3. Click on Set secret Value, and set the Plaintext value as: {"eventType":["default"]}. Setting filter to default will block subscriber receiving any messages. Event notifier will update the subscriber and AWS secret with actual filter list later. 4. Save the change 5. Create new [Cloud Platform Environments GitHub repository](https://github.com/ministryofjustice/cloud-platform-environments/tree/main) branch -6. Load secret value from AWS and update filter_policy value. Follow [Example](https://github.com/ministryofjustice/cloud-platform-environments/pull/22111/files). Note: you will need get secret name from AWS console. +6. Update terraform to load the secret value from AWS and update filter_policy value. Follow [Example](https://github.com/ministryofjustice/cloud-platform-environments/pull/22111/files). Note: The name of aws_secretsmanager_secret module has to be same as the secret name created from step 4/5 above. 7. Follow steps 3-8 in [Create an API key](#create-an-api-key) to merge branch to main.