endlessm / azafea

Service to track device activations and usage metrics
Mozilla Public License 2.0
10 stars 2 forks source link

Add a sphinx module to upload documentation on metabase #129

Closed liZe closed 3 years ago

liZe commented 3 years ago

See https://phabricator.endlessm.com/T30895.

This PR has to be merged after #127.

The documentation for known tables and their fields can be uploaded using: ~sphinx-build docs/source/ docs/build/html/ -b metabase -D metabase_session=<key> -D metabase_url=<url> -E~ sphinx-build docs/source/ docs/build/html/ -b metabase -D metabase_username=<username> -D metabase_password=<password> -D metabase_url=<url> -E

Environment variables (uppercase) can also be used instead of Sphinx properties.

This code uses Sphinx to gather docstrings from the documentation, translate them from ReST to plain text, and upload them on Metabase. It suffers from many problems that can be solved in other pull requests later if needed.

You can see the result on the dev platform: https://metabase.dev.endlessm-sf.com/browse/2

dbnicholson commented 3 years ago
  • The only way I found to get a metabase authetication token is to login with my account and get the session token from the HTTP headers. There’s probably a better way to do this.

I didn't review any of this, but that statement seemed odd. Indeed, it seems the only way to use the REST API is via a session token - https://github.com/metabase/metabase/wiki/Using-the-REST-API. That's kinda odd for these types of services, but not insurmountable. What I suggest is we create a dedicated user with standard username/password credentials and then make those credentials available to this code so that it can generate a session token as needed. Whether this is done via travis or our jenkins, I'd allow those credentials to come from environment variables as that's how most CI systems would expose them to you.

wjt commented 3 years ago

Looks like this needs to be refreshed after some parallel changes to the event documentation.

liZe commented 3 years ago

Looks like this needs to be refreshed after some parallel changes to the event documentation.

I’ve included the latest changes of the wiki page.

liZe commented 3 years ago

@wjt I’ve rebased this branch onto master, it’s ready to be reviewed and merged.

wjt commented 3 years ago

I believe the deployment happens in https://github.com/endlessm/azafea/pull/139, right?

liZe commented 3 years ago

I believe the deployment happens in #139, right?

Yes, in #139.