department-of-veterans-affairs / va.gov-team

Public resources for building on and in support of VA.gov. Visit complete Knowledge Hub:
https://depo-platform-documentation.scrollhelp.site/index.html
283 stars 205 forks source link

KMS Key Rotation - 1. Research #49444

Closed holdenhinkle closed 1 year ago

holdenhinkle commented 2 years ago

ticket details to come...

Issue Description

What details are necessary for understanding the specific work or request tracked by this issue?


Tasks

Acceptance Criteria

holdenhinkle commented 2 years ago

Google doc - https://docs.google.com/document/d/1kJBpyB7IdOxV-tgs2VaqbtHf1nGV96v0OiaNWh4Y02w/edit#

holdenhinkle commented 2 years ago

Main issues:

Issue #1: What if a job fails?

Issue #2: Can we automatically divvy up tables/records amongst n number of Sidekiq workers?


Lindsey and I met yesterday (11/7/2022) and discussed the ideas outlined in the above linked document.

A couple of main points came out of it:


Links

Sidekiq Batches - https://github.com/mperham/sidekiq/wiki/Batches#overview


Pseudocode

Class Batcher

initialize

Create new sidekiq batch instance

batch_records

private

on_complete

this method is a callback that's called when the current batch is complete we can log the results of the previous batch this method also acts as a loop to keep the job running by creating another instance of Batcher => call Batcher.new

get_model_names

returns an array of model names that we want to rotate the keys for

~ - - -

Class KMSKeyRotator

Includes Sidekiq::Job

perform(record)

holdenhinkle commented 2 years ago

Research and Solutioning is kinda blurred.

I'm planning on opening the Implementation ticket tomorrow and coding this up.

holdenhinkle commented 2 years ago

I'll also write a rake task that will kick this off.