Сервис приложения
Сервисы/Apache Airflow

Сервис Apache Airflow

Сервис оркестрации процессов Apache Airflow, собранный из вашего Git-репозитория: ваши DAG, плагины и Python-пакеты есть в каждом компоненте Airflow, метаданные хранятся в связанном PostgreSQL.

Этот сервис запускает ваш код: его образ собирается из Git-репозитория, а каждая сборка развёртывается в окружение.

В StackMaster

Как Apache Airflow работает в StackMaster

What Wodby sets up for Airflow on this service. It runs the official apache/airflow image built with the app's repository. Configuration is passed as AIRFLOW__<SECTION>__<KEY> environment variables, which take precedence over airflow.cfg.

Processes

One pod runs four containers on the same volume: the API server (main container, port 8080, also the web interface), scheduler, dag-processor and triggerer. Before they start, an init container migrates the metadata database (_AIRFLOW_DB_MIGRATE) and creates the administrator (_AIRFLOW_WWW_USER_CREATE). The executor is LocalExecutor: tasks run inside the scheduler container, so their memory comes from that container's limit, which is set with the other containers' resources on the app service. Airflow itself doesn't cap a task's memory; AIRFLOW__CORE__PARALLELISM and DAG-level max_active_tasks limit how many tasks run at once. The service is not scalable.

Linked services

LinkVariables
PostgreSQL (required)AIRFLOW__DATABASE__SQL_ALCHEMY_CONN

It is the metadata database of Airflow. Do not set the connection elsewhere.

Generated credentials

TokenVariableUse
admin_username, admin_password_AIRFLOW_WWW_USER_USERNAME, _AIRFLOW_WWW_USER_PASSWORDadministrator created by the init container; an existing user is left as it is
fernet_keyAIRFLOW__CORE__FERNET_KEYencrypts connection passwords stored in the database
api_secret_keyAIRFLOW__API__SECRET_KEYAPI server sessions
api_auth_jwt_secretAIRFLOW__API_AUTH__JWT_SECRETtokens between Airflow components and for the API

Users are managed by the FAB auth manager (AIRFLOW__CORE__AUTH_MANAGER). Example DAGs are off (AIRFLOW__CORE__LOAD_EXAMPLES).

Image and DAGs

The image is built from the app's Git repository on top of the apache/airflow image of the service's version, so the service's versions are Airflow versions. Start the repository from the Airflow boilerplate. The build:

  • copies the repository to /opt/airflow-app, outside the /opt/airflow data volume, which would hide files baked into the image;
  • installs the packages in requirements.txt, when the repository has one, with Airflow pinned to the image's version, so packages that need another Airflow fail the build;
  • sets AIRFLOW__CORE__DAGS_FOLDER to /opt/airflow-app/dags and AIRFLOW__CORE__PLUGINS_FOLDER to /opt/airflow-app/plugins.

Every Airflow component runs the built image: the API server, scheduler, DAG processor and triggerer are build containers of the workload, and the setup step gets the image through helm.image.references. DAG and package changes reach Airflow with the next deployment. Airflow's version comes from the service version and the image, not from the repository.

Put DAG files in dags/ and plugins in plugins/ of the repository; the dags and plugins directories on the data volume are not read. The data volume is mounted at /opt/airflow, the Airflow home, in every container and keeps Airflow's logs.

Changing configuration

Add or change AIRFLOW__* environment variables on the service and deploy it. The scheduler, DAG processor and triggerer get only the service's secret variables, from the environment Secret, plus the executor, examples and auth manager settings declared in the manifest; after a change, check that it reached the container that uses it.

Check the result

/api/v2/monitor/health on port 8080 reports the state of the metadata database, scheduler, DAG processor and triggerer.

Обзор

Технический профиль Apache Airflow

Здесь перечислены версии, которые можно выбрать для Apache Airflow в стеке или окружении. Сам сервис публикуется ревизиями, и стек ссылается на конкретную ревизию.

Тип сервиса

Сервис приложения

Версии

3.3

Постоянные тома

Airflow data and logs

Стеки

Стеки, в которые входит Apache Airflow

Apache Airflow входит в этот публичный стек. Можно создать приложение из публичного стека как есть или добавить сервис в собственный стек.

CI/CD

Сборка Apache Airflow из Git-репозитория

Начните с публичного шаблона проекта или подключите собственный репозиторий. В StackMaster CI push в ветку, за которой следит окружение, запускает сборку Apache Airflow, а пайплайн её развёртывает.

Vanilla Airflow project

Используйте его как есть или клонируйте в свой Git-аккаунт.

wodby/airflow-boilerplate

Git-провайдеры

Репозиторий подключается через интеграцию с его Git-провайдером.

CI-провайдеры

StackMaster CI встроен в платформу: пайплайн описывается в файле .wodby/pipeline.yml в репозитории. Для подключённого репозитория те же шаги может выполнять внешний CI-провайдер с помощью StackMaster CLI.

Реестры контейнеров

Собранные образы по умолчанию попадают в StackMaster Registry или во внешний реестр, подключённый как интеграция.

Переменные окружения из интеграций

Интеграция с переменными один раз сохраняет учётные данные стороннего сервиса. Подключите её к Apache Airflow, и StackMaster передаст их в контейнер как переменные окружения во время работы, а не при сборке образа.

Конфигурация

Конфигурация сервиса Apache Airflow

Сервис Apache Airflow объявляет следующее. Если значение можно изменить, его задаёт стек, а каждое окружение может его переопределить.

Технические домены

StackMaster выдаёт каждому публичному HTTP-порту технический домен с TLS-сертификатом и продлевает сертификат. Порт, который сервис помечает как частный, домен не получает. Можно добавить собственные домены.

Тома

Airflow data and logs

Связи сервиса

Каждая связь — это подключение Apache Airflow к другому сервису. На какой сервис указывает связь, задаёт стек. На карточках перечислены публичные сервисы, которые подходят для каждой связи.