From 11b6ebee2e0233037e2c2ab5bcc947a9baf24010 Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 11 Jan 2024 17:16:52 +0100 Subject: [PATCH 1/6] Add deploy readme and users-chis-{ke,ug} values --- scripts/deploy/medic-deploy.md | 76 ++++++++++++++++++++++++ scripts/deploy/values/users-chis-ke.yaml | 25 ++++++++ scripts/deploy/values/users-chis-ug.yaml | 25 ++++++++ 3 files changed, 126 insertions(+) create mode 100644 scripts/deploy/medic-deploy.md create mode 100644 scripts/deploy/values/users-chis-ke.yaml create mode 100644 scripts/deploy/values/users-chis-ug.yaml diff --git a/scripts/deploy/medic-deploy.md b/scripts/deploy/medic-deploy.md new file mode 100644 index 00000000..1a2973ba --- /dev/null +++ b/scripts/deploy/medic-deploy.md @@ -0,0 +1,76 @@ +## Medic Deployment + +| Key | Value | +|-----------|---------------------------------------------------------| +| context | arn:aws:eks:eu-west-2:720541322708:cluster/prod-cht-eks | +| namespace | users-chis-prod | + +### Requirements: +1. Applications: + - [Helm](https://helm.sh/) + - [Kubectl](https://kubernetes.io/docs/reference/kubectl/kubectl/) + +2. [Add medic helm chart repository](https://github.com/medic/helm-charts/tree/main#usage) + +3. [Authenticate to Medic kubernetes cluster (EKS)](https://github.com/medic/medic-infrastructure/blob/master/terraform/aws/dev/eks/access/README.md) + + +### Deploy new version + +#### KE +```shell +# Edit tag in users-chis-ke.yaml and then run: + +helm upgrade \ + --kube-context arn:aws:eks:eu-west-2:720541322708:cluster/prod-cht-eks \ + --namespace users-chis-prod \ + --values values/users-chis-ke.yaml \ + users-chis-ke medic/cht-user-management +``` +#### UG +```shell +# Edit tag in users-chis-ug.yaml and then run: + +helm upgrade \ + --kube-context arn:aws:eks:eu-west-2:720541322708:cluster/prod-cht-eks \ + --namespace users-chis-prod \ + --values values/users-chis-ug.yaml \ + users-chis-ug medic/cht-user-management +``` +### How to + +#### List all helm deployments +```shell +helm --kube-context $context --namespace $namespace list --all +``` + +#### Check history of a deployment +```shell +helm --kube-context $context --namespace $namespace history $deployment_name +``` +_You can get `deployment_name` from the helm list command above_ + +#### Get current configuration of a deployment +```shell +helm --kube-context $context --namespace $namespace get values $deployment_name +``` + +#### List all resources in a namespace +```shell +kubectl --context $context --namespace $namespace get all +``` + +#### View logs of a deployment +```shell +kubectl --context $context --namespace $namespace logs deploy/users-chis-ke-cht-user-management +# or +kubectl --context $context --namespace $namespace logs deploy/users-chis-ug-cht-user-management +``` +_You can replace `deploy/x` with for example `pods/y` from the get all command above_ + +#### Get more details of a deployment +```shell +kubectl --context $context --namespace $namespace describe deploy/users-chis-ke-cht-user-management +# or +kubectl --context $context --namespace $namespace describe deploy/users-chis-ug-cht-user-management +``` diff --git a/scripts/deploy/values/users-chis-ke.yaml b/scripts/deploy/values/users-chis-ke.yaml new file mode 100644 index 00000000..a7c038b9 --- /dev/null +++ b/scripts/deploy/values/users-chis-ke.yaml @@ -0,0 +1,25 @@ +cht-user-management: + image: + tag: 0.0.1 + env: + CONFIG_NAME: chis-ke + + # EKS prod ELB + ingress: + enabled: true + annotations: + alb.ingress.kubernetes.io/scheme: internet-facing + alb.ingress.kubernetes.io/tags: Environment=prod,Team=SRE + alb.ingress.kubernetes.io/group.name: prod-cht-alb + alb.ingress.kubernetes.io/ssl-redirect: '443' + alb.ingress.kubernetes.io/target-type: ip + alb.ingress.kubernetes.io/healthcheck-port: traffic-port + alb.ingress.kubernetes.io/certificate-arn: arn:aws:iam::720541322708:server-certificate/2023-wildcard-app-medicmobile-org-chain + alb.ingress.kubernetes.io/listen-ports: '[{"HTTP": 80}, {"HTTPS": 443}]' + + className: alb + hosts: + - host: users-chis-ke.app.medicmobile.org + paths: + - path: / + pathType: Prefix diff --git a/scripts/deploy/values/users-chis-ug.yaml b/scripts/deploy/values/users-chis-ug.yaml new file mode 100644 index 00000000..e1ef7ddd --- /dev/null +++ b/scripts/deploy/values/users-chis-ug.yaml @@ -0,0 +1,25 @@ +cht-user-management: + image: + tag: 0.0.1 + env: + CONFIG_NAME: chis-ug + + # EKS prod ELB + ingress: + enabled: true + annotations: + alb.ingress.kubernetes.io/scheme: internet-facing + alb.ingress.kubernetes.io/tags: Environment=prod,Team=SRE + alb.ingress.kubernetes.io/group.name: prod-cht-alb + alb.ingress.kubernetes.io/ssl-redirect: '443' + alb.ingress.kubernetes.io/target-type: ip + alb.ingress.kubernetes.io/healthcheck-port: traffic-port + alb.ingress.kubernetes.io/certificate-arn: arn:aws:iam::720541322708:server-certificate/2023-wildcard-app-medicmobile-org-chain + alb.ingress.kubernetes.io/listen-ports: '[{"HTTP": 80}, {"HTTPS": 443}]' + + className: alb + hosts: + - host: users-chis-ug.app.medicmobile.org + paths: + - path: / + pathType: Prefix From fc98f238ed3a920bf8202e32bbd7f3cd186e4ec1 Mon Sep 17 00:00:00 2001 From: Ashley <8253488+mrjones-plip@users.noreply.github.com> Date: Thu, 11 Jan 2024 14:44:53 -0800 Subject: [PATCH 2/6] Update scripts/deploy/medic-deploy.md --- scripts/deploy/medic-deploy.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scripts/deploy/medic-deploy.md b/scripts/deploy/medic-deploy.md index 1a2973ba..73e3274b 100644 --- a/scripts/deploy/medic-deploy.md +++ b/scripts/deploy/medic-deploy.md @@ -1,5 +1,10 @@ ## Medic Deployment +This readme talks about how to use `helm` and `kubect` running locally on your workstation to create, update and delete instances of the CHT User Management tool. These will be running in Medic's [EKS](https://docs.aws.amazon.com/eks/latest/userguide/what-is-eks.html) and these instructions are meant to be followed by Medic teammates who have access to EKS. + +General public is welcome to look at these instructions for who they might use them in their own infrastructure. + +### Key/Value pairs used | Key | Value | |-----------|---------------------------------------------------------| | context | arn:aws:eks:eu-west-2:720541322708:cluster/prod-cht-eks | From f9d8f56500221eecdbe2ce33b142c9ce8226fa5b Mon Sep 17 00:00:00 2001 From: Ashley <8253488+mrjones-plip@users.noreply.github.com> Date: Thu, 11 Jan 2024 14:44:59 -0800 Subject: [PATCH 3/6] Update scripts/deploy/medic-deploy.md --- scripts/deploy/medic-deploy.md | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/scripts/deploy/medic-deploy.md b/scripts/deploy/medic-deploy.md index 73e3274b..f19fffb7 100644 --- a/scripts/deploy/medic-deploy.md +++ b/scripts/deploy/medic-deploy.md @@ -11,13 +11,9 @@ General public is welcome to look at these instructions for who they might use t | namespace | users-chis-prod | ### Requirements: -1. Applications: - - [Helm](https://helm.sh/) - - [Kubectl](https://kubernetes.io/docs/reference/kubectl/kubectl/) - -2. [Add medic helm chart repository](https://github.com/medic/helm-charts/tree/main#usage) - -3. [Authenticate to Medic kubernetes cluster (EKS)](https://github.com/medic/medic-infrastructure/blob/master/terraform/aws/dev/eks/access/README.md) +- Have both [Helm](https://helm.sh/) and [Kubectl](https://kubernetes.io/docs/reference/kubectl/kubectl/) installed on your local workstation +- Check out [helm chart repository](https://github.com/medic/helm-charts/tree/main#usage) so you can reference it locally +- Be able to [authenticate to Medic kubernetes cluster (EKS)](https://github.com/medic/medic-infrastructure/blob/master/terraform/aws/dev/eks/access/README.md) ### Deploy new version From b9d041c1631c69caca43f20459b326e9149d12ee Mon Sep 17 00:00:00 2001 From: Ashley <8253488+mrjones-plip@users.noreply.github.com> Date: Thu, 11 Jan 2024 14:45:07 -0800 Subject: [PATCH 4/6] Update scripts/deploy/medic-deploy.md --- scripts/deploy/medic-deploy.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/deploy/medic-deploy.md b/scripts/deploy/medic-deploy.md index f19fffb7..839b91aa 100644 --- a/scripts/deploy/medic-deploy.md +++ b/scripts/deploy/medic-deploy.md @@ -18,6 +18,8 @@ General public is welcome to look at these instructions for who they might use t ### Deploy new version +These commands should be run in the `./scripts/deploy` directory in this repo. Also note you may need to replace `medic/cht-user-management` with the full path to the helm chart repository you checked out above. + #### KE ```shell # Edit tag in users-chis-ke.yaml and then run: From 2c4b5b8cb68ad340f331f219df87ea76255dfa60 Mon Sep 17 00:00:00 2001 From: Ashley <8253488+mrjones-plip@users.noreply.github.com> Date: Thu, 11 Jan 2024 14:45:41 -0800 Subject: [PATCH 5/6] Update scripts/deploy/values/users-chis-ke.yaml --- scripts/deploy/values/users-chis-ke.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/deploy/values/users-chis-ke.yaml b/scripts/deploy/values/users-chis-ke.yaml index a7c038b9..70b76a61 100644 --- a/scripts/deploy/values/users-chis-ke.yaml +++ b/scripts/deploy/values/users-chis-ke.yaml @@ -1,6 +1,6 @@ cht-user-management: image: - tag: 0.0.1 + tag: 1.0.0 env: CONFIG_NAME: chis-ke From 732caf056d9631a4e33157061d915980bb931425 Mon Sep 17 00:00:00 2001 From: Ashley <8253488+mrjones-plip@users.noreply.github.com> Date: Thu, 11 Jan 2024 14:45:49 -0800 Subject: [PATCH 6/6] Update scripts/deploy/values/users-chis-ug.yaml --- scripts/deploy/values/users-chis-ug.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/deploy/values/users-chis-ug.yaml b/scripts/deploy/values/users-chis-ug.yaml index e1ef7ddd..d3af0efc 100644 --- a/scripts/deploy/values/users-chis-ug.yaml +++ b/scripts/deploy/values/users-chis-ug.yaml @@ -1,6 +1,6 @@ cht-user-management: image: - tag: 0.0.1 + tag: 1.0.0 env: CONFIG_NAME: chis-ug