managing-astro-deployments

Quản lý các deployment sản xuất Astronomer bằng Astro CLI. Sử dụng khi người dùng muốn xác thực, chuyển đổi không gian làm việc, tạo/cập nhật/xóa deployment, hoặc…

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

Thêm skills từ astronomer

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…
creating-openlineage-extractors
astronomer
Các extractor OpenLineage tùy chỉnh cho các toán tử Airflow không được hỗ trợ và các kịch bản lineage phức tạp. Hai cách tiếp cận: thêm các phương thức OpenLineage trực tiếp vào các toán tử bạn sở hữu (khuyến nghị), hoặc tạo các extractor tùy chỉnh cho các toán tử bên thứ ba mà bạn không thể sửa đổi. Extractor can thiệp vào quá trình thực thi toán tử tại ba điểm: trước khi thực thi để lấy lineage tĩnh, sau khi thành công để lấy đầu ra được xác định trong thời gian chạy, và tùy chọn sau khi thất bại để lấy lineage một phần. Đăng ký extractor thông qua airflow.cfg hoặc môi trường...
debugging-dags
astronomer
Phân tích nguyên nhân gốc rễ có hệ thống và khắc phục cho các DAG Airflow bị lỗi với quy trình điều tra có cấu trúc. Hướng dẫn qua quy trình chẩn đoán bốn bước: xác định lỗi, trích xuất chi tiết lỗi, thu thập thông tin ngữ cảnh và đưa ra các bước khắc phục khả thi. Phân loại lỗi thành bốn loại (dữ liệu, mã, cơ sở hạ tầng, phụ thuộc) để tập trung điều tra và đề xuất các bản sửa lỗi phù hợp. Cung cấp các lệnh CLI sẵn sàng sử dụng để truy xuất nhật ký, so sánh lần chạy, xóa tác vụ và DAG...
delegating-to-otto
astronomer
Drives Astronomer's Otto agent (`astro otto`) as a delegated sub-agent for Airflow, dbt, and data-engineering work. Use when the user explicitly asks to "use…
deploying-airflow
astronomer
Triển khai Airflow DAGs và các dự án. Sử dụng khi người dùng muốn triển khai mã, đẩy DAGs, thiết lập CI/CD, triển khai lên môi trường sản xuất hoặc hỏi về các chiến lược triển khai…
deploying-go-sdk-bundles
astronomer
Xây dựng, đóng gói và triển khai các gói Airflow Go SDK đã biên dịch để ExecutableCoordinator có thể chạy chúng. Sử dụng khi người dùng muốn biên dịch một gói tác vụ Go, yêu cầu…
testing-dags
astronomer
Các chu trình kiểm tra-gỡ lỗi-sửa lỗi lặp đi lặp lại cho Airflow DAG với chẩn đoán lỗi toàn diện. Bắt đầu bằng af runs trigger-wait <dag_id> để chạy một DAG và chờ hoàn tất; không cần kiểm tra trước khi chạy. Khi gặp lỗi, sử dụng af runs diagnose để có bản tóm tắt lỗi toàn diện và af tasks logs để kiểm tra chi tiết lỗi từ các tác vụ cụ thể. Hỗ trợ cấu hình tùy chỉnh, thời gian chờ và số lần thử lại; xử lý các tình huống thành công, thất bại và hết thời gian chờ với diễn giải phản hồi rõ ràng. Có sẵn tính năng xác th
tracing-downstream-lineage
astronomer
Truy xuất dòng dữ liệu xuôi dòng để đánh giá tác động của thay đổi trước khi sửa đổi bảng hoặc DAG. Xác định người tiêu dùng trực tiếp của bảng hoặc DAG mục tiêu thông qua tìm kiếm mã nguồn, phụ thuộc view và kết nối công cụ BI. Xây dựng cây phụ thuộc đầy đủ ánh xạ tất cả tác động xuôi dòng, từ bảng đến dashboard đến mô hình ML. Phân loại phụ thuộc theo mức độ quan trọng (quan trọng, cao, trung bình, thấp) để ưu tiên giao tiếp với các bên liên quan và kiểm thử. Tạo báo cáo tác động với đánh giá rủi ro, các thành phần bị