addons-server
addons-server copied to clipboard
Remove initialize_docker: Integrate data initialization to make up
Fixes: mozilla/addons#15020
Description
Integrate data initialization to make up by integrating the 3 types of data initiailization commands to management commands, making them idempotent, and hooking them into make up.
With this, we no longer need initialize_docker
as make up will do everything it does if the project is pristine.
Context
We haven't really needed the initiailzation command for a while, but now that everyone is fairly used to rely on make up for "doing everything" we should make it actually do everything.
This approach integrates data initialization as another part of the make up pipeline. What is mostly different here is that now make up will ensure:
- database and other service level dependencies are up and running
- database is migrated
- database is seeded (unless skipped)
- database is indexed in ES (unless skipped)
This has a pleasant side effect that CI now verifies database migrations more explicitly. We could consider migrating our testDB to use the regular DB in CI, but that is outside of this PRs scope.
Testing
You should run make up in the following scenarios.
- completely fresh project,
make down && make clean_docker
). Expect: create DB, seed DB, index. - after running make up, Expect: it does nothing
- after running make down (but you have created and seeded DB) Expect: only index
- After running make down (and delete all addons) Expect: seed and index
Expect the flags to work as expected:
-
INIT_FORCE_DB
: will recreate the database even if it exists. Will also seed and index -
INIT_SKIP_SEED
: will skip seeding if it otherwise would have happened -
INIT_SKIP_INDEX
: will skip index if it otherwise would have happened
The command itself is tested for various scenarios specified above. But you can manually inspect the commands run as the tests do not test the results of the commands but the execution order.
Checklist
- [X] Add
#ISSUENUM
at the top of your PR to an existing open issue in the mozilla/addons repository. - [X] Successfully verified the change locally.
- [x] The change is covered by automated tests, or otherwise indicated why doing so is unnecessary/impossible.
- [ ] Add before and after screenshots (Only for changes that impact the UI).
- [X] Add or update relevant docs reflecting the changes made.