FightPandemics / infrastructure

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

FightPandemics Infrastructure

This repo contains the Terraform code for setting up the FightPandemics infrastructure.

Prerequisites

  1. Install Terraform v0.12.29 by downloading the package for your operating system here. Alternatively, you can run Terraform in Docker. NOTE: Please install Terraform v0.12.29 as v0.13 has some breaking changes.

  2. In the #devops Slack channel, ask for the following:

  • Access to this repository (provide your Github username)
  • Access to our sandbox development AWS account (provide your email address)
  • MongoDB Atlas API key (provide your IP address to be whitelisted)

Contributing

  1. Clone this repo, and create a new branch.

  2. Change directory into the infra folder in this repo.

  3. Copy fp_context.env.example to development.env. In the #devops Slack channel, ask for the proper values to add to this file for the development environment. Please note that the AWS credentials are session-based, and therefore they are short-lived. You will need to continually retrieve new credentials after they expire. Please ask in the #devops channel for instructions on how to retrieve these credentials.

  4. Confirm in the #devops channel that no one else is currently working in the development AWS account, so that you don't interfere with their work.

  5. Once you have confirmed that no one is working in the development environment, run ./deploy.sh apply development. This will set up the infrastructure in the development environment.

  6. Once the deployment is complete, make the necessary changes in the Terraform code.

  7. Validate your Terraform code by running ./deploy.sh validate development. If there are any syntax errors in the code, it will alert you.

  8. Once you have validated and fixed your code, run ./deploy.sh plan development. This will show you the proposed changes to be made to the infrastructure. Fix any issues if necessary, and also make sure that the changes being proposed are what you would expect.

  9. Once you are satisfied with the output of Terraform Plan, run ./deploy.sh apply development. This will apply your changes to the infrastructure.

  10. Log in to the development AWS account to verify that the changes look good.

  11. It is strongly recommended that you also deploy the Fargate service and test that the app is still functional with the infrastructure changes you made. Go to the main FightPandemics repo and clone it if you haven't already.

  12. Copy the development.env file from this repo to the main FightPandemics repo.

  13. Run ./deploy-development.sh apply.

  14. Wait a few minutes for the Fargate service to spin up, and then test the app by going to https://development.fightpandemics.online.

  15. Once you have verified that the app is still functional, and also performed any other tests you deem necessary to validate your changes, open a pull request for your changes.

  16. To save costs in the development environment, please destroy the resources that you created (ideally within the same day). In the FightPandemics repo, run ./deploy-development.sh destroy to destroy the Fargate service. After destroying the Fargate service, come back to this repo and run ./deploy.sh destroy development to destroy the development infrastructure.

About


Languages

Language:HCL 89.1%Language:Shell 10.9%