Page MenuHomePhabricator

Add manage_storage script for quickstart
ClosedPublic

Authored by chris on Jul 21 2019, 2:51 PM.

Details

Summary

Depends on D11. This adds a quickstart script for bootstrapping database tables.

Test Plan

Ran shell script with

python3 ./simplex/scripts/sql/manage_storage.py \
  --hostname localhost \
  --port 3306 \
  --username root \
  --password ***** \
  --namespace simplex

which produced:

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| simplex            |
+--------------------+

mysql> use simplex;
mysql> show tables;
+--------------------------------+
| Tables_in_simplex              |
+--------------------------------+
| auth_password                  |
| auth_passwordtransaction       |
| auth_providerconfig            |
| auth_providerconfigtransaction |
| auth_temporarytoken            |
| user                           |
| user_email                     |
| user_log                       |
| user_preferences               |
| user_profile                   |
| user_session                   |
+--------------------------------+

Diff Detail

Repository
rSIM Simplex
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

chris created this revision.Jul 21 2019, 2:51 PM
chris requested review of this revision.Jul 21 2019, 2:51 PM
chris updated this revision to Diff 32.Jul 21 2019, 4:02 PM

Working implementation

chris edited the test plan for this revision. (Show Details)Jul 21 2019, 4:05 PM
chris edited the test plan for this revision. (Show Details)
chris added a comment.Jul 21 2019, 4:11 PM

I think approximate next steps from here will be to:

  • Add a global check that the database is reachable per credentials stored in an arbitrary config file
  • If unreachable, redirect to an error page that prompts the user to run some config command. E.g., config set mysql.port=3306 or whatever else
    • Ideally, this should do a somewhat comprehensive check so that the instance admin has a fairly complete list of all required setup steps in one view (as opposed to having to continually reload the page to find the next broken thing in a hellish and neverending game of whack-a-mole)
  • If reachable, check that all of the quickstart scripts have run. I need to figure out a way to do this efficiently and how to extend it to arbitrary patches delivered from the upstream
    • If not, run the quickstart scripts. Ideally with some error handling. But if not, I'd be okay with that for the short term (I mean, not really, but I'm just lazy)
  • If everything's good so far, actually go ahead and render the page
chris added a comment.Jul 21 2019, 4:14 PM
In D12#258, @chris wrote:

I think approximate next steps from here will be to:
[...]

One other thing to add, if there are no registered users, should probably recognize that and automatically enter the registration flow / make the first user an instance admin.

brooke accepted this revision.Jul 21 2019, 4:45 PM
This revision is now accepted and ready to land.Jul 21 2019, 4:45 PM
chris updated this revision to Diff 34.Jul 21 2019, 4:56 PM

Correct some SQL stuffs

This revision was automatically updated to reflect the committed changes.