Skip to content

Commit 54a2b42

Browse files
authored
Docs(tcloud): Update scheduler facade docs for OAuth (#3992)
1 parent c832db8 commit 54a2b42

6 files changed

Lines changed: 47 additions & 14 deletions

File tree

docs/cloud/features/scheduler/airflow.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ $ pip install tobiko-cloud-scheduler-facade[airflow]
5252

5353
### Connect Airflow to Tobiko Cloud
5454

55+
First, provision an OAuth Client for Airflow to use by following the guide on how to [provision client credentials](../single_sign_on.md#provisioning-client-credentials).
56+
57+
After provisioning the credentials, you can obtain the `Client ID` and `Client Secret` values for Airflow to use to connect to Tobiko Cloud.
58+
5559
Next, add an Airflow [connection](https://airflow.apache.org/docs/apache-airflow/stable/howto/connection.html#creating-a-connection-with-the-ui) containing your Tobiko Cloud credentials.
5660

5761
Specify these fields when adding the connection:
@@ -60,9 +64,8 @@ Specify these fields when adding the connection:
6064
- May not contain spaces, single quotes `'`, or double quotes `"`
6165
- **Connection Type**: always HTTP
6266
- **Host**: URL for your Tobiko Cloud project
63-
- **Password**: your Tobiko Cloud API token
64-
65-
The host URL and password values will be provided to you during your Tobiko Cloud onboarding.
67+
- **Login**: OAuth `Client ID` for Airflow
68+
- **Password**: OAuth `Client Secret` for Airflow
6669

6770
It is convenient to specify the connection in the Airflow UI, as in this example with the name `tobiko_cloud`:
6871

62.7 KB
Loading

docs/cloud/features/scheduler/dagster.md

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,18 @@ Dagster recommends [injecting secret values using Environment Variables](https:/
5757

5858
On this page, we demonstrate the secrets method Dagster recommends for **local development**.
5959

60-
In your Dagster project, create an `.env` file if it does not already exist. Next, specify environment variables containing the Tobiko Cloud URL and token secrets:
60+
First, provision an OAuth Client for Dagster to use by following the guide on how to [provision client credentials](../single_sign_on.md#provisioning-client-credentials).
61+
62+
After provisioning the credentials, you can obtain the `Client ID` and `Client Secret` values for Dagster to use to connect to Tobiko Cloud.
63+
64+
In your Dagster project, create an `.env` file if it does not already exist. Next, specify environment variables containing the Tobiko Cloud URL and OAuth secrets:
6165

6266
```sh title=".env"
63-
TOBIKO_CLOUD_BASE_URL=<URL for your Tobiko Cloud project> # ex: https://cloud.tobikodata.com/sqlmesh/tobiko/public-demo/
64-
TOBIKO_CLOUD_TOKEN=<your Tobiko Cloud API token> # ex: 'ioawjioefja1'
67+
TCLOUD_BASE_URL=<URL for your Tobiko Cloud project> # ex: https://cloud.tobikodata.com/sqlmesh/tobiko/public-demo/
68+
TCLOUD_CLIENT_ID=<your OAuth Client ID for Dagster> # ex: '5ad2938d-e607-489a-8bec-bdfb5924b79b'
69+
TCLOUD_CLIENT_SECRET=<your OAuth Client Secret for Dagster> # ex: 'psohFoOcgweYnbx-bmYn3XXRDSNIP'
6570
```
6671

67-
Your Solutions Architect will provide the base URL and token values during your Tobiko Cloud onboarding.
68-
6972
### Create Dagster objects
7073

7174
You are now ready to create Dagster objects connected to Tobiko Cloud.
@@ -84,8 +87,9 @@ from dagster import EnvVar # for accessing variables in .env file
8487

8588
# create and configure SQLMeshEnterpriseDagster instance named `sqlmesh`
8689
sqlmesh = SQLMeshEnterpriseDagster(
87-
url=EnvVar("TOBIKO_CLOUD_BASE_URL").get_value(), # environment variable from .env file
88-
token=EnvVar("TOBIKO_CLOUD_TOKEN").get_value(), # environment variable from .env file
90+
url=EnvVar("TCLOUD_BASE_URL").get_value(), # environment variable from .env file
91+
oauth_client_id=EnvVar("TCLOUD_CLIENT_ID").get_value(), # environment variable from .env file
92+
oauth_client_secret=EnvVar("TCLOUD_CLIENT_SECRET").get_value(), # environment variable from .env file
8993
)
9094

9195
# create Definitions object with `sqlmesh` object's `create_definitions()` method
@@ -186,8 +190,8 @@ Specifically, we must use Dagster's GraphQL API, which is not enabled by default
186190

187191
```python title="definitions.py" linenums="1" hl_lines="4 5"
188192
sqlmesh = SQLMeshEnterpriseDagster(
189-
url=EnvVar("TOBIKO_CLOUD_BASE_URL").get_value(),
190-
token=EnvVar("TOBIKO_CLOUD_TOKEN").get_value(),
193+
url=EnvVar("TCLOUD_BASE_URL").get_value(),
194+
#...SNIP...,
191195
dagster_graphql_host="localhost", # Example GraphQL host (could be passed in an environment variable instead)
192196
dagster_graphql_port=3000 # Example GraphQL port (could be passed in an environment variable instead)
193197
)
@@ -370,7 +374,8 @@ customer_revenue_by_day = AssetKey(["postgres", "sushi", "customer_revenue_by_da
370374
| Option | Description | Type | Required |
371375
|----------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:----:|:--------:|
372376
| `url` | The Base URL to your Tobiko Cloud instance | str | Y |
373-
| `token` | Your Tobiko Cloud API Token | str | N |
377+
| `oauth_client_id` | OAuth Client ID of the credentials you [provisioned](../single_sign_on.md#provisioning-client-credentials) for Dagster | str | N |
378+
| `oauth_client_secret` | OAuth Client Secret of the credentials you [provisioned](../single_sign_on.md#provisioning-client-credentials) for Dagster | str | N |
374379
| `dagster_graphql_host` | Hostname of the Dagster Webserver GraphQL endpoint | str | N |
375380
| `dagster_graphql_port` | Port of the Dagster Webserver GraphQL endpoint | int | N |
376381
| `dagster_graphql_kwargs` | Extra args to pass to the [DagsterGraphQLClient](https://docs.dagster.io/api/python-api/libraries/dagster-graphql#dagster_graphql.DagsterGraphQLClient) class when it is instantiated | dict | N |

docs/cloud/features/single_sign_on.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ $ tcloud auth status
153153

154154
### Login
155155

156-
To initiliaze the login process you can run the `login` command:
156+
Run the `login` command to begin the login process:
157157

158158
``` bash
159159
$ tcloud auth login
@@ -193,3 +193,28 @@ Not currently authenticated
193193
![tcloud_logout](./single_sign_on/tcloud_logout.png)
194194

195195
Otherwise, you will be logged out automatically when the SSO session expires (every 24 hours).
196+
197+
## OAuth Clients
198+
199+
Sometimes, you want to grant an external service access to your Tobiko Cloud project. For example, the external service could be the [CICD bot](../../integrations/github.md) or a [scheduler integration](./scheduler/airflow.md).
200+
201+
These services take `Client ID` and `Client Secret` credentials.
202+
203+
!!! Info "One set of credentials per service"
204+
It's best practice to provision a separate set of credentials for each service that you wish to connect to Tobiko Cloud. This gives you the flexibility to revoke credentials for a specific service without affecting access for other services.
205+
206+
### Provisioning client credentials
207+
208+
To provision OAuth credentials for a new service, browse to `Settings -> OAuth Clients` in the lefthand navigation menu.
209+
210+
In the page's Create new Client section, enter a client name and human readable description:
211+
212+
![Add new OAuth Client](./single_sign_on/oauth_client_1.png)
213+
214+
Once you click `Save`, the client will be added to the list:
215+
216+
![OAuth Client List](./single_sign_on/oauth_client_2.png)
217+
218+
To fetch the Client ID or Client Secret, click `Copy ID` or `Copy Secret`. The values will be copied to the system clipboard.
219+
220+
Paste these values into an external service's authentication configuration so it can connect to your Tobiko Cloud project.
223 KB
Loading
80.7 KB
Loading

0 commit comments

Comments
 (0)