Project-Reclass / toynet

0 stars 0 forks source link

Install Datdog Host Agent to VM hosting ToyNet via Terraform #8

Closed takakonishimura closed 12 months ago

takakonishimura commented 1 year ago

(I) Bring up ToyNet in a QA Environment

  1. Select a temporary QA Environment (a different AWS region) in which to play around with ToyNet.
  2. Check out the https://github.com/Project-Reclass/toynet GitHub repo to your local workstation.
  3. Run cd infra/terraform/toynet.
  4. Modify the variables.tf so it points to your new QA Enviornment.

(II) Check the deployment and monitoring state before making changes

  1. Confirm that ToyNet is running correctly via navigating in your browser to: https://<IP address listed for frontend container in ECS console>.
  2. Confirm that ToyNet's network emulator is running correctly https://<IP address listed for frontend container in ECS console>/module/100000/emulator/1 by creating a new host, attaching it to a switch, then pinging that host through the Console.
  3. Login to Reclass's Datadog Account.
  4. Confirm that there are no agent metrics being reported in the dashboard.
  5. Optional: You can practice running terraform destroy and then terraform apply if you're new to Datadog.

(III) Practice manually making the change and cleaning it up

  1. Install the Datadog agent to our ToyNet VM using the Datadog Docs (https://docs.datadoghq.com/agent/).
  2. Confirm that a Datadog agent is running on the ToyNet VM.
  3. Confirm that agent metrics are now being reported to Datadog.
  4. Uninstall the Datadog agent on our ToyNet VM.
  5. Confirm that the Datadog agent is no longer running on ToyNet VM.
  6. Confirm that there are no agent metrics being reported to Datadog.

(IV) Implement change in Terraform

  1. Check out a new branch in your local GitHub repo clone.
  2. Implement a code change in Terraform code in https://github.com/Project-Reclass/toynet/tree/main/infra/terraform/toynet to automate Datadog agent installation when bringing up Datadog.
  3. Apply modified terraform.
  4. Confirm that the agent is running using techniques practiced in Part III.
  5. Revise terraform as needed.
  6. Tear down ToyNet in the QA environment using terraform destroy.
  7. Confirm via ECS and EC2 consoles that the entire QA environment has been cleaned up.

(V) Make a pull request

  1. Commit your changes to your local GitHub branch.
  2. Remember to revert the variables.tf data so it points to Production ToyNet Enviornment.
  3. Push your commits to origin, and create a PR.
  4. Link the PR to this ticket.
  5. Address feedback as needed until code change is approved.
  6. Merge the pull request.

(VI) Deploy your change to production

  1. Check out the main branch and run git pull so your main branch has all of the changes merged into origin.
  2. Run terraform apply to the production environment
  3. Confirm that Production metrics are now being reported to Datadog.
takakonishimura commented 1 year ago

@d-c007 This ticket is blocked on the team merging: https://github.com/Project-Reclass/toynet/pull/5

Please don't start on it without checking that it has been merged.

takakonishimura commented 1 year ago
takakonishimura commented 1 year ago

https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account

takakonishimura commented 1 year ago

terraform init in infra/terraform/toynet (version 1.3.6 in our case)