[Nix] Reconcile missing db config in more granular fashion
Summary:
The logic previously only worked on fresh installs of MariadB.
If the database configuration was lost, or a user was deleted, there was
nothing to reconcile it back to a healthy state.
The logic now checks each individual step to ensure that every assumption
has been placed correctly.
https://linear.app/comm/issue/ENG-2046
Test Plan:
This test plan assumes that you're using the mariadb daemon supplied as part of nix develop,
if you have mariadb installed through homebrew, then beware
that the nix supplied socket will be available at
$HOME/.local/share/MariaDB/mysql.sock as opposed to /tmp/mysql.sock.
In theory, this should work on linux and macOS, however, only tested and expected to be ran
on macOS.
# stop previous MariaDB pkill mariadb # Break some chain of assumptions, like removing the db config rm -rf keyserver/secrets/db_config.json nix develop # should emit that it's starting MariaDB and writing a config cd keyserver yarn dev # shouldn't crash when starting DB configuration
Reviewers: atul, varun, O1 Nix, ashoat
Reviewed By: varun, O1 Nix, ashoat
Subscribers: ashoat, tomek
Differential Revision: https://phab.comm.dev/D5791