Principle:Apache Airflow Environment Setup
| Knowledge Sources | |
|---|---|
| Domains | DevOps, Infrastructure |
| Last Updated | 2026-02-08 00:00 GMT |
Overview
A process for initializing and bootstrapping an Apache Airflow deployment including database migration and service startup.
Description
Environment Setup encompasses the steps required to prepare an Airflow instance for operation. This includes running database schema migrations via Alembic to ensure the metadata database matches the expected schema, and starting the core Airflow services (scheduler, API server, triggerer, dag-processor) either individually or via the standalone command. The standalone command is particularly useful for development and testing as it manages all components as subprocesses of a single parent process.
Usage
Use this principle when bootstrapping a new Airflow installation, upgrading an existing deployment to a new version, or setting up a local development environment. The standalone command is preferred for single-machine development setups, while production deployments typically start each component separately.
Theoretical Basis
The environment setup follows a two-phase initialization pattern:
Phase 1: Schema Migration
- Alembic revision chain ensures database schema matches code expectations
- Migrations are idempotent and can be re-run safely
- Supports both upgrade and downgrade paths
Phase 2: Service Startup
- Each Airflow component (scheduler, api-server, triggerer, dag-processor) runs as an independent process
- The standalone command orchestrates all components under a single parent process
- Health checks verify each component is operational