Harvester DB Migration Rebuild

Aperta
#6,258 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Da chiarire
Stato di attività
Attiva
Stack tecnologico
python, shell

Direzione di ricerca

Inizia da app-start.sh alla riga 9, quindi esamina le issue 6147 e 6145 e il lavoro di migrazione OpenSearch a cui si fa riferimento nella PR 842 di datagov-harvester. Il lavoro è considerato completato quando il workflow di migrazione blue/green documentato è implementato e validato, inclusi il rollback in caso di errore, il blocco dei deploy e la ripresa dei job di harvest dopo la verifica.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Harvest-DB

User Story

In order to release DB migrations intentionally and with purpose, data.gov admins want DB migration split into a separate process and completed when PR has tag (or when PR has migrations in it).

Acceptance Criteria

  • GIVEN a DB migration is prepped and ready to be applied to staging/production
    WHEN the migration changes are accepted and merged into main
    THEN the migration occurs smoothly on release
    AND if any failures occur the change is rolled back and issues are created to manage/mitigate
    AND deploys are stopped until triage occurs

Background

See https://github.com/GSA/data.gov/issues/6147 and https://github.com/GSA/data.gov/issues/6145. We have schema drift that wasn't being reported and in a bad state.
We want to streamline the process to be better.
We did this for complex OpenSearch changes/migrations, which was more complex because it involved a whole new index and coordinating with the catalog application. See https://github.com/GSA/datagov-harvester/pull/842 and https://github.com/GSA/data.gov/issues/5885

Security Considerations (required)

None

Sketch

Current migration happens as part of startup: https://github.com/GSA/datagov-harvester/blob/main/app-start.sh#L9

This is going to be a blue/green deployment. What that means is we have 2 versions of the application running in parallel in order to service the in-between state of the DB (partial migration has occurred).

The workflow should be something like the following:

  • Stop all new harvest jobs, wait/kill current running jobs (wait 10 minutes, then kill; can always be re-run)
  • Create new harvest application with new code and deploy, scaled to 0, with 0 harvest runners.
  • Start task specifically for DB migration
  • Once task is confirmed running, scale new app to 1
  • Wait/watch for DB migration task to finish and succeed
  • Scale old app to 0, new app to 2, and swap names (datagov-harvest becomes datagov-harvest-old and datagov-harvest-new becomes datagov-harvest)
  • Verify everything working and all good
  • Resume harvest job runners and remove old app
  • If at any point any of the above fails, create ticket and disable deployment action (and possibly other O&M notification, ie slack?)

This is meant to provide the best user experience that if the DB is in an in-between state the new application could serve the request and be successful, and vice-versa. It will be buggy, but the only "sure fire" way to keep everything alive would be to have scheduled down time (turn off the app and run the migration and turn it back on with new code); which is possible but seems unnecessary. We could also consider not turning on the blue/green deployment and letting certain routes/items fail until able to spin up the new application after the migration is complete.

Lingua principale
Python
Stelle
1.2k
Fork
207
Merge medio
3g 16h
PR unite (30g)
5

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di GSA/data.gov

Tutte le issue di GSA/data.gov

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.