【发布时间】:2023-01-18 05:01:28
【问题描述】:
我目前正在运行 docker-compose 来运行存储在本地卷中的 Airflow DAG。我如何使用 Github 存储库作为 DAG 的卷?如何设置连接?是否可以将 Github 存储库用作卷?
我在 docker-compose.yaml 中的当前设置
&airflow-common
build: .
env_file:
- ./config/development.env
environment:
&airflow-common-env
AIRFLOW__CORE__EXECUTOR: LocalExecutor
AIRFLOW__DATABASE__SQL_ALCHEMY_CONN: postgresql+psycopg2://airflow:airflow@postgres/airflow
# For backward compatibility, with Airflow <2.3
AIRFLOW__CORE__SQL_ALCHEMY_CONN: postgresql+psycopg2://airflow:airflow@postgres/airflow
AIRFLOW__CORE__FERNET_KEY: ''
AIRFLOW__CORE__DAGS_ARE_PAUSED_AT_CREATION: 'true'
AIRFLOW__CORE__LOAD_EXAMPLES: 'false'
AIRFLOW__API__AUTH_BACKENDS: 'airflow.api.auth.backend.basic_auth'
_PIP_ADDITIONAL_REQUIREMENTS: ${_PIP_ADDITIONAL_REQUIREMENTS:-}
volumes:
- ./dags:/opt/airflow/dags
- ./logs:/opt/airflow/logs
- ./plugins:/opt/airflow/plugins
- ./includes:/opt/airflow/includes
user: "${AIRFLOW_UID:-50000}:0"
depends_on:
&airflow-common-depends-on
postgres:
condition: service_healthy
【问题讨论】:
-
我没有对此进行测试,但您可以在 docker compose yaml 中使用 git clone as a command。我个人只是将代码拉入本地卷,然后为本地开发人员安装。对于使用 K8s 的生产环境,可以选择 git-sync sidecar。
标签: github docker-compose airflow