Skip to content

gc-stack-deploy wizard to create auth0 app clients and populate stack.yaml - #180

Open
IamJeffG wants to merge 7 commits into
157-wizard-auth0from
157-wizard-ui
Open

IamJeffG wants to merge 7 commits into
157-wizard-auth0from
157-wizard-ui

Conversation

@IamJeffG

@IamJeffG IamJeffG commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Goal

Expose the Auth0 provisioning code from #179 via a TUI runnable as gc-stack-deploy wizard.

The Textual UI walks the operator through auth0 configuration and writes the auth0 apps' IDs & Credentials to stack.yaml.

Closes #157

Screenshots

Screenshot_2026-09-23_20-19-34 Screenshot_2026-09-23_20-19-37 Screenshot_2026-09-23_20-19-52 Screenshot_2026-09-23_20-41-02

After completion:

image

What I changed and why

gc_stack_deploy/wizard/screens.py is uninteresting TUI code, the 4 screens.

gc_stack_deploy/wizard/orchestrator.py invokes the auth0 code to do all the setup as described in auth0/README.md

gc_stack_deploy/wizard/yaml_writer.py writes the auth0 client IDs and secrets back to stack.yaml. Also wriets gc_landing_page.root_domain, which was provided to us in this wizard.

Note for reviewers

The runtime flow is:

stack_deploy.py → wizard.screens.WizardApp → wizard.screens.RunScreen → wizard.orchestrator.run_wizard

Now that you know that, skip all the uninteresting TUI code and just focus on orchestrator.py.

Diff stats

$ git diff 157-wizard-auth0..HEAD --stat
 auth0/README.md                                                      |  51 ++++-
 caprover/INSTALL_GC_STACK.md                                         |  27 ++-
 .../src/gc_stack_deploy/example_configs/stack.example.yaml           |   6 +-
 caprover/gc-stack-deploy/src/gc_stack_deploy/stack_deploy.py         |   8 +-
 caprover/gc-stack-deploy/src/gc_stack_deploy/wizard/orchestrator.py  | 227 ++++++++++++++++++++
 caprover/gc-stack-deploy/src/gc_stack_deploy/wizard/screens.py       | 347 +++++++++++++++++++++++++++++++
 caprover/gc-stack-deploy/src/gc_stack_deploy/wizard/yaml_writer.py   |  95 +++++++++
 caprover/gc-stack-deploy/tests/wizard/yaml_writer_test.py            | 111 ++++++++++

What I'm not doing here

All these are still manual

  • GCP OAuth client creation
  • Mapbox key generation
  • Non-auth0 Secrets for postgres, redis, filebrowser.
  • Setting caproverUrl and caproverPassword

This does create auth0 clients for Windmill and GC-Metrics, but only logs them. We could do a better job of persisting them or alerting the operator they need to copy these down!

I feel like "wizard" is far too generic a name for this. Once we've proven out the functionality here, let's re-visit the entire gc-stack-deploy flow (including init and deploy) and see whether we want to connect those, how we want to name things...

@IamJeffG
IamJeffG added this pull request to stack #181 September 23, 2026 22:29
…ning

Adds Textual screens to input
1. bootstrap credentials
2. which apps to create auth0 client for
3. deployment inputs
4. final run/summary screen.

Adds sequencing in orchestrator.run_wizard() and the 'wizard' CLI subcommand.

Adds module yaml_writer.py:
- apply_auth0_client_results_to_config() writes Auth0 API results (auth0_domain, per-app client id/secret)
- apply_deployment_metadata_to_config() writes community_name/root_domain/admin_email,
  which are separate inputs from `DeploymentInputsScreen` (never sent to Auth0).
The screen walks through the manual GCP OAuth client setup
Community name and Superset admin email are removed from scope.

The root domain is still required since every app client's Auth0 callback and
origin URLs derive from it, and the screen previews those per-app URLs.
@IamJeffG
IamJeffG requested a review from rudokemper September 24, 2026 01:44
@IamJeffG
IamJeffG marked this pull request as ready for review September 24, 2026 01:44
The wizard never needs it: client secrets come back in the create response.

@rudokemper rudokemper left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really great, thank you.

I did not test this, but we can test drive to achieve https://github.com/ConservationMetrics/gc-forge/issues/127 next sprint.

Noting the four 429 errors in your screenshot of the logs, should we increase wait time before making additional requests?

This does create auth0 clients for Windmill and GC-Metrics, but only logs them. We could do a better job of persisting them or alerting the operator they need to copy these down!

I know you plan to work on this in #158, but could leave a comment with the issue just to be super clear for this interim stage. Or skip this, either is fine by me.

I feel like "wizard" is far too generic a name for this. Once we've proven out the functionality here, let's re-visit the entire gc-stack-deploy flow (including init and deploy) and see whether we want to connect those, how we want to name things...

I agree. Can you create an issue as a future container for this? Blocked by #158. I think this should be something we do as part of our work towards https://github.com/ConservationMetrics/gc-roadmap/issues/8 this year.

yield Header()
with Vertical(id="form"):
yield Static(
"Enter the root domain your Guardian Connector stack will be served at."

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"Enter the root domain your Guardian Connector stack will be served at."
"Enter the root domain your Guardian Connector stack will be served at (without https protocol prefix)."

I know it's implied in the examples and the placeholder, but just to be crystal clear.

Comment on lines +1 to +4
"""The run_wizard function dictates the end-to-end wizard order:
1. provisioning of auth0 configs
2. writes the auth0 credentials to stack.yaml.
"""

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it a good idea to add a README to this directory?


logger = logging.getLogger("gc-stack-deploy.wizard")

# Scope lists are copied verbatim from auth0/README.md.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like there is a risk of drift if we change auth0 scopes in the future. How do we make a note to ourselves to update scopes in both places? Maybe redundancy is the best strategy - a helpful note here and in auth0/README?

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Speed creation of auth0 & mapbox keys, and auto-inject them into a new stack.yaml for deployment

2 participants