A comprehensive ETL (Extract, Transform, Load) pipeline built with Apache Airflow for processing DevOps data. This project combines data orchestration with containerized deployment for scalable data processing workflows.
devops-etl/
├── airflow_db/ # PostgreSQL database for Airflow
├── dags/ # Airflow DAG definitions
├── devops/ # Core ETL package
│ ├── src/ # Source code
│ │ ├── api.py # API integrations
│ │ ├── devops.py # Main DevOps logic
│ │ ├── orchestration.py # Workflow orchestration
│ │ ├── orm.py # Database ORM models
│ │ ├── parser.py # Data parsing utilities
│ │ ├── requests.py # HTTP request handling
│ │ ├── schema.py # Data schemas
│ │ └── utils.py # Utility functions
│ └── tests/ # Test files
├── scripts/ # Utility scripts
├── docker-compose.yaml # Development environment
├── docker-compose.prod.yaml # Production environment
├── Dockerfile # Container definition
├── .example.env # Environment variables
└── requirements.txt # Python dependencies
- Docker and Docker Compose
- Python 3.12+
- UV package manager (0.7.2 or higher)
-
Clone the repository
git clone <repository-url> cd devops-etl
-
Start the development environment
docker compose up -d
-
Access services
- Airflow UI: http://localhost:8000
- MySQL Database: localhost:3306
- PostgreSQL (Airflow): localhost:5432
docker compose -f docker-compose.prod.yaml up -dCreate a .env file in the root directory with the following variables:
# Airflow Configuration
AIRFLOW_HOME=/app/airflow
AIRFLOW__CORE__DAGS_FOLDER=/app/dags
AIRFLOW__CORE__LOAD_EXAMPLES=False
AIRFLOW__DATABASE__SQL_ALCHEMY_CONN=postgresql+psycopg2://airflow:airflow@airflow-db:5432/airflow
AIRFLOW__CORE__EXECUTOR=LocalExecutor
EXTERNAL_PYTHON_PATH=/app/devops/.venv/bin/python
PACKAGE_HOME=/app
# Database Configuration
# (Use a user that has only SELECT, INSERT, DELETE permissions, as pandas will mess up the schema if given more permissions)
DB_HOST=devops_db
DB_PORT=3306
DB_USER=devops_user
DB_PASSWORD=PAssWORD123
DB_NAME=internal_devopsThe project uses two databases:
- MySQL: For application data storage (connection to database is done using SQLAlchemy ORM)
- PostgreSQL: For Airflow metadata
Run the following command to initialize the application database:
source scripts/init_db.shSince ORMs don't support creating views, you will need to create the views manually in the database. The SQL scripts for creating views are located in scripts/sql/.
uv venv --python 3.12
uv pip install -r requirements.txt
cd devops/
uv sync- Create your DAG file in the
dags/directory - Follow Airflow best practices for DAG definition
- Restart the Airflow scheduler to pick up new DAGs (Or use the Airflow UI to reparse DAGs)
The core devops package contains:
- API Layer: Handle external API integrations
- Data Processing: ETL pipeline implementations
- ORM Models: Database schema definitions
- Utilities: Common helper functions
- Airflow Logs: Available in
$AIRFLOW_HOME/logs/ - Container Logs: Use
docker compose logs <service-name> - Health Checks: All services include health check configurations