[terraform] Migration script for for self-hosted keyserver
Summary:
This runs a migration on the primary node by doing the following:
- Disables traffic to load balancer
- Grab the domain and desired secondary node count from terraform.tfvars
- Stops all primary and secondary nodes
- Waits for health check to fail
- Redeploys the primary node, causing the migration to run
- Redeploys the secondary nodes
- Waits for health check to succeed
- Re-enables traffic to load balancer
On running the script on my personal setup, the migration script took 15 minutes
Test Plan:
Script runs successfully. Monitored aws console through the running of the script and confirmed that tasks were being stopped. The primary node was reinitialized and finally the secondary nodes were set to reinitialize.
I set my keyserver nodes to use wyilio/keyserver:latest. I then updated latest to include a test migration which created a new table and populated it with a single random number entry.
Ran my migration script and verified by connecting mysql remotely to MariaDB that the table was being created and there was only a single entry
Reviewers: ashoat, varun, bartek
Reviewed By: ashoat
Subscribers: tomek
Differential Revision: https://phab.comm.dev/D12731