[FOLIO-1840] SPIKE: Determine best method to expire and clean up FOLIO instances Created: 04/Mar/19  Updated: 03/Jun/20  Resolved: 10/Mar/19

Status: Closed
Project: FOLIO
Components: None
Affects versions: None
Fix versions: None

Type: Task Priority: P3
Reporter: John Malconian Assignee: John Malconian
Resolution: Done Votes: 0
Labels: ci, platform-backlog
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original estimate: Not Specified

Issue links:
Relates
relates to FOLIO-1738 PR build pipeline for platform-core r... Closed
relates to FOLIO-1739 PR build pipeline for platform-comple... Closed
Sprint: Core: Platform - Sprint 58
Development Team: Core: Platform

 Description   

A new FOLIO ec2 instance is built when PRs are created in platform-core and platform-complete. An automated method to tear down these instances is needed when they are no longer useful to prevent the unnecessary utilization and expense of AWS resources.



 Comments   
Comment by John Malconian [ 04/Mar/19 ]

This may be useful. Needs further investigation. https://github.com/Netflix/SimianArmy/wiki/Janitor-Home

Comment by John Malconian [ 07/Mar/19 ]

After experimenting with SimianArmy/Janitor Monkey, I've determined that this is probably not the most suitable tool for what we need to do. It's much too broad, doesn't have too many options for granular configuration such the ability to apply filters, and doesn't include any kind of support for Route53 (cleaning up stale DNS entries). It did, however, provide me with some ideas on creating a custom script to do what we need to do. Utilizing the AWS CLI toolset (or the Python boto3 SDK) and the Github API we should be able to do the following:

  • Search for instances with a tag called 'PR' with a value set to the Github PR number.
  • Verify that the PR has either been merged or closed utilizing the Github API.
  • If the PR has been closed, terminate the EC2 instance associated with the PR.

In this way, PR FOLIO instances will remain available until the PR is closed or merged. We must, however, account for the fact that there may/will be multiple builds of the same PRs and deal with that. Possibly terminating instances with the previous build numbers after a new instance is created.

We can also tag the instance with the hostname that was set for a particular instance and use the tag value to update Route53 (AWS hosted DNS) in order to prune stale DNS entries.

Generated at Thu Feb 08 23:16:17 UTC 2024 using Jira 1001.0.0-SNAPSHOT#100246-sha1:7a5c50119eb0633d306e14180817ddef5e80c75d.