HomePhabricator
Diffusion Comm fe25f7b03123

[Nix] Reconcile missing db config in more granular fashion

Description

[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

Details

Provenance
jonAuthored on Nov 30 2022, 7:58 PM
Reviewer
Restricted Owners Package
Differential Revision
D5791: [Nix] Reconcile missing db config in more granular fashion
Parents
rCOMM520d1f1b5422: [web] Introduce spoiler colors in the first section of theme.css
Branches
Unknown
Tags
Unknown