managing-astro-deployments

作者: astronomer

使用 Astro CLI 管理 Astronomer 生产部署。当用户想要进行身份验证、切换工作区、创建/更新/删除部署或……时使用。

npx skills add https://github.com/astronomer/agents --skill managing-astro-deployments

Astro Deployment Management

This skill helps you manage production Astronomer deployments using the Astro CLI.

For local development, see the managing-astro-local-env skill. For production troubleshooting, see the troubleshooting-astro-deployments skill.


Authentication

All deployment operations require authentication:

# Login to Astronomer (opens browser for OAuth)
astro login

Authentication tokens are stored locally for subsequent commands. Run this before any deployment operations.


Workspace Management

Deployments are organized into workspaces:

# List all accessible workspaces
astro workspace list

# Switch to a specific workspace
astro workspace switch <WORKSPACE_ID>

Workspace context is maintained between sessions. Most deployment commands operate within the current workspace context.


List and Inspect Deployments

# List deployments in current workspace
astro deployment list

# List deployments across all workspaces
astro deployment list --all

# Inspect specific deployment (detailed info)
astro deployment inspect <DEPLOYMENT_ID>

# Inspect by name (alternative to ID)
astro deployment inspect --deployment-name data-service-stg

What inspect Shows

  • Deployment status (HEALTHY, UNHEALTHY)
  • Runtime version and Airflow version
  • Executor type (CELERY, KUBERNETES, LOCAL)
  • Scheduler configuration (size, count)
  • Worker queue settings (min/max workers, concurrency, worker type)
  • Resource quotas (CPU, memory)
  • Environment variables
  • Last deployment timestamp and current tag
  • Webserver and API URLs
  • High availability status

Create Deployments

# Create with default settings
astro deployment create

# Create with specific executor
astro deployment create --label production --executor celery
astro deployment create --label staging --executor kubernetes

# Executor options:
#   - celery: Best for most production workloads
#   - kubernetes: Best for dynamic scaling, isolated tasks
#   - local: Best for development only

Update Deployments

# Enable DAG-only deploys (faster iteration)
astro deployment update <DEPLOYMENT_ID> --dag-deploy-enabled

# Update other settings (use --help for full options)
astro deployment update <DEPLOYMENT_ID> --help

Delete Deployments

# Delete a deployment (requires confirmation)
astro deployment delete <DEPLOYMENT_ID>

Destructive: This cannot be undone. All DAGs, task history, and metadata will be lost.


Deploy Code to Production

Full Deploy

Deploy both DAGs and Docker image (required when dependencies change):

astro deploy <DEPLOYMENT_ID>

Use when:

  • Dependencies changed (requirements.txt, packages.txt, Dockerfile)
  • First deployment of new project
  • Significant infrastructure changes

DAG-Only Deploy (Recommended for Iteration)

Deploy only DAG files, skip Docker image rebuild:

astro deploy <DEPLOYMENT_ID> --dags

Use when:

  • Only DAG files changed (Python files in dags/ directory)
  • Quick iteration during development
  • Much faster than full deploy (seconds vs minutes)

Requires: --dag-deploy-enabled flag set on deployment (see Update Deployments)

Image-Only Deploy

Deploy only Docker image, skip DAG sync:

astro deploy <DEPLOYMENT_ID> --image-only

Use when:

  • Only dependencies changed
  • Dockerfile or requirements updated
  • No DAG changes

Force Deploy

Bypass safety checks and deploy:

astro deploy <DEPLOYMENT_ID> --force

Caution: Skips validation that could prevent broken deployments.


Deployment API Tokens

Manage API tokens for programmatic access to deployments:

# List tokens for a deployment
astro deployment token list --deployment-id <DEPLOYMENT_ID>

# Create a new token
astro deployment token create \
  --deployment-id <DEPLOYMENT_ID> \
  --name "CI/CD Pipeline" \
  --role DEPLOYMENT_ADMIN

# Create token with expiration
astro deployment token create \
  --deployment-id <DEPLOYMENT_ID> \
  --name "Temporary Access" \
  --role DEPLOYMENT_ADMIN \
  --expiry 30  # Days until expiration (0 = never expires)

Roles:

  • DEPLOYMENT_ADMIN: Full access to deployment

Note: Token value is only shown at creation time. Store it securely.


Common Workflows

First-Time Production Deployment

# 1. Login
astro login

# 2. Switch to production workspace
astro workspace list
astro workspace switch <PROD_WORKSPACE_ID>

# 3. Create deployment
astro deployment create --label production --executor celery

# 4. Note the deployment ID, then deploy
astro deploy <DEPLOYMENT_ID>

Iterative DAG Development

# 1. Enable fast deploys (one-time setup)
astro deployment update <DEPLOYMENT_ID> --dag-deploy-enabled

# 2. Make DAG changes locally

# 3. Deploy quickly
astro deploy <DEPLOYMENT_ID> --dags

Promoting Code from Staging to Production

# 1. Deploy to staging first
astro workspace switch <STAGING_WORKSPACE_ID>
astro deploy <STAGING_DEPLOYMENT_ID>

# 2. Test in staging

# 3. Deploy same code to production
astro workspace switch <PROD_WORKSPACE_ID>
astro deploy <PROD_DEPLOYMENT_ID>

Configuration Management

# View CLI configuration
astro config get

# Set configuration value
astro config set <KEY> <VALUE>

# Check CLI version
astro version

# Upgrade CLI to latest version
astro upgrade

Tips

  • Use --dags flag for fast iteration (seconds vs minutes)
  • Always test in staging workspace before production
  • Use deployment inspect to verify deployment health before deploying
  • Deployment IDs are permanent, names can change
  • Most commands work with deployment ID; inspect also accepts --deployment-name
  • Set --dag-deploy-enabled once per deployment for fast deploys
  • Keep workspace context visible with astro workspace list (shows asterisk for current)

Related Skills

  • troubleshooting-astro-deployments: Investigate deployment issues, view logs, manage environment variables
  • managing-astro-local-env: Manage local Airflow development environment
  • setting-up-astro-project: Initialize and configure Astro projects

来自 astronomer 的更多技能

airflow
astronomer
查询、管理和排查Apache Airflow的DAG、运行记录、任务及系统配置。支持30多种命令,涵盖DAG检查、运行管理、任务日志、配置查询及直接REST API访问。通过持久化配置管理多个Airflow实例;自动发现本地和Astro部署。同步(等待完成)或异步触发DAG运行,诊断故障,清除运行记录以重试,并通过重试/映射索引过滤访问任务日志。输出...
official
airflow-hitl
astronomer
在Airflow DAG中使用可延迟操作符实现人工审批关卡、表单输入和分支。四种操作符类型:用于批准/拒绝决策的ApprovalOperator、带表单的多选项选择HITLOperator、人工驱动的任务路由HITLBranchOperator,以及表单数据收集HITLEntryOperator。所有操作符均为可延迟设计,在通过Airflow UI的"必需操作"标签页或REST API等待人工响应时释放工作槽位。支持包括自定义在内的可选功能...
official
airflow-state-store
astronomer
Persists task and asset state across retries and DAG runs using Airflow 3.3's AIP-103 key/value stores (`task_state_store`, `asset_state_store`) and the…
official
analyzing-data
astronomer
查询数据仓库,利用缓存的模式和概念映射来回答业务问题。支持对重复问题类型进行模式查找和缓存,并通过记录结果来改进后续查询。包含概念到表的映射缓存,以及通过INFORMATION_SCHEMA或代码库grep进行表结构发现。提供run_sql()和run_sql_pandas()内核函数,返回Polars或Pandas DataFrame用于分析。提供CLI命令用于管理概念、模式和表缓存,以及...
official
annotating-task-lineage
astronomer
使用入口和出口为Airflow任务标注数据血缘。支持使用OpenLineage Dataset对象、Airflow Assets和Airflow Datasets定义跨数据库、数据仓库及云存储的输入输出。当运算符缺少内置OpenLineage提取器时作为备用方案;遵循四级优先级系统,其中自定义提取器和OpenLineage方法优先。包含针对Snowflake、BigQuery、S3和PostgreSQL的数据集命名辅助工具,以确保一致性...
official
authoring-dags
astronomer
创建Apache Airflow DAG的引导式工作流,集成验证与测试。采用六阶段结构化方法:发现环境与现有模式、规划DAG结构、遵循最佳实践实现、通过af CLI命令验证、经用户同意测试、迭代修复。用于发现(af config connections、af config providers、af dags list)和验证(af dags errors、af dags get、af dags explore)的CLI命令可提供DAG的即时反馈...
official
authoring-go-sdk-tasks
astronomer
Writes Airflow task logic in Go using the Airflow Go SDK. Use when the user wants to implement Airflow tasks in Go, asks about `BundleProvider`/`RegisterDags`,…
official
authoring-java-sdk-tasks
astronomer
使用 Airflow Java SDK 编写 Java、Kotlin 或任何 JVM 语言的 Airflow 任务逻辑。当用户想要在 Java/JVM 中实现 Airflow 任务时使用,询问……
official