Loading...
Loading...
Compare original and translation side by side
| Command | What It Does |
|---|---|
| Full project deploy — builds Docker image and deploys DAGs |
| DAG-only deploy — pushes only DAG files (fast, no image build) |
| Image-only deploy — pushes only the Docker image (for multi-repo CI/CD) |
| dbt project deploy — deploys a dbt project to run alongside Airflow |
| 命令 | 功能说明 |
|---|---|
| 完整项目部署——构建Docker镜像并部署DAG |
| 仅DAG部署——仅推送DAG文件(速度快,无需构建镜像) |
| 仅镜像部署——仅推送Docker镜像(适用于多仓库CI/CD场景) |
| dbt项目部署——将dbt项目部署至Airflow并协同运行 |
astro deployrequirements.txtDockerfilepackages.txtastro deployrequirements.txtDockerfilepackages.txtdags/astro deploy --dagsdags/astro deploy --dagsastro deploy --imageastro deploy --imageastro deploy --dbtastro deploy --dbtmaindevelopmaindevelopastro deploy --dagsastro deploy--image--dagsastro deploy --dagsastro deploy--image--dagsapache/airflowapache/airflowcurl -LfO 'https://airflow.apache.org/docs/apache-airflow/stable/docker-compose.yaml'| Service | Purpose |
|---|---|
| REST API and UI (port 8080) |
| Schedules DAG runs |
| Parses and processes DAG files |
| Executes tasks (CeleryExecutor) |
| Handles deferrable/async tasks |
| Metadata database |
| Celery message broker |
curl -LfO 'https://airflow.apache.org/docs/apache-airflow/stable/docker-compose.yaml'| 服务 | 用途 |
|---|---|
| REST API与UI(端口8080) |
| 调度DAG运行 |
| 解析与处理DAG文件 |
| 执行任务(CeleryExecutor) |
| 处理可延迟/异步任务 |
| 元数据库 |
| Celery消息代理 |
docker-compose.yamlx-airflow-common: &airflow-common
image: apache/airflow:3 # Use the latest Airflow 3.x release
environment: &airflow-common-env
AIRFLOW__CORE__EXECUTOR: LocalExecutor
AIRFLOW__DATABASE__SQL_ALCHEMY_CONN: postgresql+psycopg2://airflow:airflow@postgres/airflow
AIRFLOW__CORE__LOAD_EXAMPLES: 'false'
AIRFLOW__CORE__DAGS_FOLDER: /opt/airflow/dags
volumes:
- ./dags:/opt/airflow/dags
- ./logs:/opt/airflow/logs
- ./plugins:/opt/airflow/plugins
depends_on:
postgres:
condition: service_healthy
services:
postgres:
image: postgres:16
environment:
POSTGRES_USER: airflow
POSTGRES_PASSWORD: airflow
POSTGRES_DB: airflow
volumes:
- postgres-db-volume:/var/lib/postgresql/data
healthcheck:
test: ["CMD", "pg_isready", "-U", "airflow"]
interval: 10s
retries: 5
start_period: 5s
airflow-init:
<<: *airflow-common
entrypoint: /bin/bash
command:
- -c
- |
airflow db migrate
airflow users create \
--username admin \
--firstname Admin \
--lastname User \
--role Admin \
--email admin@example.com \
--password admin
depends_on:
postgres:
condition: service_healthy
airflow-apiserver:
<<: *airflow-common
command: airflow api-server
ports:
- "8080:8080"
healthcheck:
test: ["CMD", "curl", "--fail", "http://localhost:8080/health"]
interval: 30s
timeout: 10s
retries: 5
start_period: 30s
airflow-scheduler:
<<: *airflow-common
command: airflow scheduler
airflow-dag-processor:
<<: *airflow-common
command: airflow dag-processor
airflow-triggerer:
<<: *airflow-common
command: airflow triggerer
volumes:
postgres-db-volume:Airflow 3 architecture note: The webserver has been replaced by the API server (), and the DAG processor now runs as a standalone process separate from the scheduler.airflow api-server
docker-compose.yamlx-airflow-common: &airflow-common
image: apache/airflow:3 # Use the latest Airflow 3.x release
environment: &airflow-common-env
AIRFLOW__CORE__EXECUTOR: LocalExecutor
AIRFLOW__DATABASE__SQL_ALCHEMY_CONN: postgresql+psycopg2://airflow:airflow@postgres/airflow
AIRFLOW__CORE__LOAD_EXAMPLES: 'false'
AIRFLOW__CORE__DAGS_FOLDER: /opt/airflow/dags
volumes:
- ./dags:/opt/airflow/dags
- ./logs:/opt/airflow/logs
- ./plugins:/opt/airflow/plugins
depends_on:
postgres:
condition: service_healthy
services:
postgres:
image: postgres:16
environment:
POSTGRES_USER: airflow
POSTGRES_PASSWORD: airflow
POSTGRES_DB: airflow
volumes:
- postgres-db-volume:/var/lib/postgresql/data
healthcheck:
test: ["CMD", "pg_isready", "-U", "airflow"]
interval: 10s
retries: 5
start_period: 5s
airflow-init:
<<: *airflow-common
entrypoint: /bin/bash
command:
- -c
- |
airflow db migrate
airflow users create \
--username admin \
--firstname Admin \
--lastname User \
--role Admin \
--email admin@example.com \
--password admin
depends_on:
postgres:
condition: service_healthy
airflow-apiserver:
<<: *airflow-common
command: airflow api-server
ports:
- "8080:8080"
healthcheck:
test: ["CMD", "curl", "--fail", "http://localhost:8080/health"]
interval: 30s
timeout: 10s
retries: 5
start_period: 30s
airflow-scheduler:
<<: *airflow-common
command: airflow scheduler
airflow-dag-processor:
<<: *airflow-common
command: airflow dag-processor
airflow-triggerer:
<<: *airflow-common
command: airflow triggerer
volumes:
postgres-db-volume:Airflow 3架构说明:Webserver已被API服务器()取代,DAG处理器现在作为独立进程运行,与调度器分离。airflow api-server
undefinedundefinedundefinedundefinedrequirements.txtundefinedrequirements.txtundefined
Or use a custom Dockerfile:
```dockerfile
FROM apache/airflow:3 # Pin to a specific version (e.g., 3.1.7) for reproducibility
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txtdocker-compose.yamlx-airflow-common: &airflow-common
build:
context: .
dockerfile: Dockerfile
# ... rest of config
或使用自定义Dockerfile:
```dockerfile
FROM apache/airflow:3 # Pin to a specific version (e.g., 3.1.7) for reproducibility
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txtdocker-compose.yamlx-airflow-common: &airflow-common
build:
context: .
dockerfile: Dockerfile
# ... rest of configdocker-compose.yamlenvironment:
# Core settings
AIRFLOW__CORE__EXECUTOR: LocalExecutor
AIRFLOW__CORE__PARALLELISM: 32
AIRFLOW__CORE__MAX_ACTIVE_TASKS_PER_DAG: 16
# Email
AIRFLOW__EMAIL__EMAIL_BACKEND: airflow.utils.email.send_email_smtp
AIRFLOW__SMTP__SMTP_HOST: smtp.example.com
# Connections (as URI)
AIRFLOW_CONN_MY_DB: postgresql://user:pass@host:5432/dbdocker-compose.yamlenvironment:
# 核心设置
AIRFLOW__CORE__EXECUTOR: LocalExecutor
AIRFLOW__CORE__PARALLELISM: 32
AIRFLOW__CORE__MAX_ACTIVE_TASKS_PER_DAG: 16
# 邮件设置
AIRFLOW__EMAIL__EMAIL_BACKEND: airflow.utils.email.send_email_smtp
AIRFLOW__SMTP__SMTP_HOST: smtp.example.com
# 连接配置(URI格式)
AIRFLOW_CONN_MY_DB: postgresql://user:pass@host:5432/dbkubectlhelmkubectlhelmundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefined
---
---astro devastro dev