Have gitlab:db:configure rake task seed the database whenever the Users table has 0 rows
Problem to solve
In the cloud native charts, the job that does the initial database schema load has a job timeout, that sometimes gets tripped after having loaded the schema, but before seeding the database. I have also seen this happen occasionally to users on omnibus as well, where some error occurs and seeding did not proceed.
Once the user notices they are in this state, we tend to instruct them to either run the db:seed_fu task, or drop the database and try again.
Proposal
Add a final step to gitlab:db:configure
that checks the User table, and seeds the db if it finds no rows. Currently the rake task already runs the seed, but only if it has first done a schema:load
. Moving it to a separate step will allow it to run after migrations as well if it is needed. (Because it was missed the first time)
Further details
The benefit of doing this within the gitlab:db:configure
rake task, is that we are already calling it in these situations, and it's has already gone through the trouble of loading the rails environment. So doing the check of the user table should be quick.