Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update deployment doc after helm chart changes #218

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 28 additions & 6 deletions scripts/deploy/medic-deploy.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,18 @@ As each deployment needs its own configuration directory, DNS entry and deployme
| MoH Uganda | `users-chis-ug`| `users-chis-ug.yaml` | `users-chis-ug-cht-user-management` | users-chis-ug.app.medicmobile.org |
| MoH Mali CIV | `users-chis-civ`| `users-chis-civ.yaml` | `users-chis-civ-cht-user-management` | users-chis-civ.app.medicmobile.org |

### `helm` commands
### Prepare a Deployment

The `helm upgrade` and `helm install` commands should be run in the `./scripts/deploy` directory in this repo.
To prepare a deployment, use the following steps to ensure your environment is properly configured.
The `helm install` and `helm upgrade` commands should be run in the `./scripts/deploy` directory in this repo.

1. Check the image is [published](https://github.com/medic/cht-user-management/tree/main#publishing-new-docker-images) to [ECR](https://gallery.ecr.aws/medic/cht-user-management)
2. Commit a values YAML file in [values folder](https://github.com/medic/cht-user-management/blob/main/scripts/deploy/values/) in `main` branch
3. Switch to the `deploy` branch and ensure the same values file from the prior step is in the [values folder](https://github.com/medic/cht-user-management/blob/deploy/scripts/deploy/values/) in `deploy` branch
4. Edit the version in the `tag:` as the version you want deploy in the `helm` command below. Ensure this version in the `tag:` is commmited to `deploy` branch
5. run either `helm install...` or `helm deploy...` per the full commands below.
Comment on lines -35 to -38
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously we wanted to use the deploy branch so that we didn't need to do a whole PR every time we wanted to push. I also think this might result in extra images being built and pushed to ECR? Slack thread:

For deployments, I've been pushing to this deploy branch which is probably lazy but I also don't want to make a new PR every time I push. And when I merge it, publishes duplicate images.

This changes that - but maybe it's OK because we want to not use deploy branch and over all are changing things less often?

Copy link
Contributor Author

@paulpascal paulpascal Nov 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously we wanted to use the deploy branch so that we didn't need to do a whole PR every time we wanted to push....

Oh yes thats right, I got it and I think we still don't want to make a whole PR for every push, neither duplicated images published... :)

So maybe I should bring back the deploy branch use ? I am not sure I know the best thing to do here 😅

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd say let's revisit it in the #cht-user-management and we can discuss async.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure

2. Update the `tag:` in the respective `values.yaml` file located in the [values folder](https://github.com/medic/cht-user-management/blob/main/scripts/deploy/values/) to match the version you wish to deploy.
3. Ensure your local system has the latest charts by running:
```bash
helm repo update medic
```
4. Run either `helm install...` or `helm upgrade...` per the full commands below. (commands should be run in the `./scripts/deploy` directory in this repo)

#### Install (only once!)

Expand All @@ -61,6 +64,9 @@ helm upgrade \
$CONFIG medic/cht-user-management
```

> [!NOTE]
> If you encounter issues, you may need to first delete existing helm values and then reinstall with the new values, as outlined in this [section](#delete-existing-values-in-order-to-redeploy).

### How to

#### List all helm deployments
Expand Down Expand Up @@ -110,3 +116,19 @@ _You can replace `deploy/x` with for example `pods/y` from the get all command a
kubectl --context arn:aws:eks:eu-west-2:720541322708:cluster/prod-cht-eks \
--namespace users-chis-prod describe deploy/$EKS-DEPLOYMENT
```

#### Delete existing values in order to redeploy

1. Delete existing values if encountering issues
```shell
helm --namespace users-chis-prod users-chis-prod delete $CONFIG
```

2. Reinstall with updated values
```shell
helm install \
--kube-context arn:aws:eks:eu-west-2:720541322708:cluster/prod-cht-eks \
--namespace users-chis-prod \
--values values/$VALUES \
$CONFIG medic/cht-user-management
```
Loading