Via the CLI, how do I make sure I'm in the right workspace and deployment?


#1

If you’ve installed our CLI and started a project (perhaps called hello-astro if you’re just getting started and following this guide), you need to make sure that the following is true before you’re ready for your first astro airflow deploy.

1. You’ve authenticated correctly.

To pull your workspaces and deployments from our app, you need to make sure you’re logged in first.

To do so, run the following:

astro auth login astronomer.cloud

If you’ve already made an account on our app (app.astronomer.cloud), then press enter when you see something like:

 "Paolas-MBP-2:hello-astro paola$ astro auth login astronomer.cloud
 CLUSTER                             WORKSPACE                           
 astronomer.cloud                    4a6cb370-c361-440d-b02b-c90b07ef15f6

 Switched cluster
Username (leave blank for oAuth): 

Once you press enter, you’ll be prompted to go back into our UI to this link: https://app.astronomer.cloud/token.

Grab that token, paste it back into your command line, and you’re good to go. Your success message should read:

Successfully authenticated to registry.astronomer.cloud

2. You’re in the right workspace

Now that you’re logged in, you need to make sure you’re in the right workspace. To start, run: astro workspace list

You should see a list of 1 or more workspaces in the output. To “pick” one to create and jump into deployments to, run our switch command followed by the corresponding ID you’ll have to copy and paste:

astro workspace switch <workspace UUID> (no syntax needed around the ID)

3. You have a deployment to work from

If you have a deployment up, skip to step 4. If not, you can create a deployment from our UI or via the CLI.

(1) Creating a deployment via app.astronomer.cloud

  • Start from https://app.astronomer.cloud/workspaces
  • Click into the workspace you want to create a deployment from
  • Hit “New Deployment” on the top right of the page
  • Give your deployment a name and description
  • Wait a few minutes (might have to refresh) for your webserver, scheduler, and celery flower (worker monitoring) to spin up

Once you see an active URL under “Apache Airflow” in the middle of the page, you are set and ready to deploy your DAGs.

(2) Creating a deployment via the Astronomer CLI

To create a deployment directly from our CLI, run:

astro deployment create <deployment name>

Note: This is a bit misleading. deployment name here is your workspace ID (that you pulled above), NOT the name of your new deployment (which doesn’t exist yet).

Once your webserver, scheduler, and celery flower are up, you should see the following success message and URLs:

Successfully created deployment. Deployment can be accessed at the following URLs 

 Airflow Dashboard: https://popular-orbit-2745-airflow.astronomer.cloud
 Flower Dashboard: https://popular-orbit-2745-flower.astronomer.cloud

From here, you’re set.

4. You have the right deployment

To “pick” a deployment (a bit different than picking a workspace), just do:

astro airflow deploy

Your list of deployments will come up, like below:

 #    RELEASE NAME                  WORKSPACE                     DEPLOYMENT UUID                                   
 1    false-wavelength-5456         Paola Peraza Calderon's Workspace90b3dc76-2022-4e0f-9bac-74a03d0dffa7              

> 

Hit the single number that corresponds to the deployment you want to push to, and you’re good!