This directory contains configuration templates for deploying Apache Airflow using the Astro CLI (Astronomer distribution). This deployment method is recommended for local development on macOS or Windows.
The Astro CLI deployment uses:
- PostgreSQL/TimescaleDB: Installed locally for the analytics database (
lens). - Astro CLI + Docker Desktop: Runs Airflow in containers.
- Containerized PostgreSQL: Airflow's metadata database (separate from analytics database).
- Port 5433: For Airflow metadata database to avoid conflict with analytics database on port 5432.
Before setting up Astro CLI, ensure you have:
-
PostgreSQL or TimescaleDB installed and running locally
- Analytics database (
lens) must be initialized. - See Database Installation and Initialization.
- Analytics database (
-
Astro CLI installed
- macOS:
brew install astro. - Other: See Astro CLI installation docs.
- macOS:
-
Docker Desktop installed and running
- Required for Astro CLI to run Airflow containers
Navigate to the repository root and follow these steps:
cd /path/to/openetl
astro dev initThis creates:
.astro/directory with configuration.Dockerfilewith Astronomer Runtime base image..dockerignorefile.airflow_settings.yamlfor Airflow configuration.packages.txtfor system packages.plugins/directory for Airflow plugins.
cp iac/astro_cli_docker/config.yaml.template .astro/config.yamlThis sets:
- Metadata database port to
5433(avoids conflict with analytics database). - Project name to
openetl.
cp iac/astro_cli_docker/docker-compose.override.yml.template docker-compose.override.ymlThis configures essential volume mounts and environment variables for:
- Database credentials directory (
SQL_CREDENTIALS_DIR). - Pipeline data directory (
DATA_DIR). - Custom files for data processing.
cp iac/astro_cli_docker/.env.template .envEdit the .env file and configure at minimum:
SQL_CREDENTIALS_DIR=/absolute/path/to/your/sql_credentialsImportant:
- Use absolute paths (Docker Compose does NOT expand
~).SQL_DB_HOSTdefaults tohost.docker.internal(works on Docker Desktop for Mac/Windows).DATA_DIRdefaults to{repo_root}/data/if not set.
See .env.template for all available configuration options.
mkdir -p dataThis directory stores pipeline data organized by state (ingest, process, store, quarantine). Creating it manually ensures correct file permissions.
Export environment variables and start Astro:
export $(cat .env | grep -v "^#" | grep -v "^$" | xargs)
astro dev startImportant: You must export
.envvariables before eachastro dev startto enable Docker Compose variable substitution in volume mounts.
Airflow will be accessible at:
- Webserver: http://localhost:8080
- Default credentials: admin / admin
Located at .astro/config.yaml after setup. Configures:
- Metadata database port (
5433). - Project name.
- Other Astro-specific settings.
Environment variables for Airflow and pipeline execution:
SQL_CREDENTIALS_DIR: Path to database credential JSON files (required).SQL_DB_HOST: Analytics database host (default:host.docker.internal).DATA_DIR: Pipeline data storage directory (default:{repo_root}/data/).TEST_DB_URL: Test database connection string (optional).
Configures Docker Compose environment variables and volume mounts:
SQL_CREDENTIALS_DIRvolume mount for database credentialsDATA_DIRvolume mount for pipeline data~/.garminconnectvolume mount for Garmin authentication tokens- Environment variables passed to Airflow containers
This file is created in step 3 of the setup instructions and is required for the deployment to function properly.
The update procedure varies based on what changed:
Use astro dev restart for:
- Changes to
.envfile (environment variables). - Changes to
config.yaml(Airflow configuration). - Changes to
docker-compose.override.yml(volume mounts, container settings).
astro dev restartUse astro dev stop && astro dev start for:
- Changes to
requirements.txt(new Python packages). - Changes to
packages.txt(new system packages). - Changes to DAG code or Python modules.
astro dev stop
astro dev startNote: Astro CLI automatically detects changes to
requirements.txtand rebuilds the Docker image duringastro dev start.
To stop all Airflow containers:
astro dev stopTo stop and remove all containers and volumes:
astro dev killPort conflicts:
- If port 8080 is already in use, modify
webserver.portin.astro/config.yaml. - If port 5433 is already in use, modify
postgres.portin.astro/config.yaml.
Database connection issues:
- Verify
SQL_CREDENTIALS_DIRis set and contains valid credential files. - Ensure PostgreSQL is running on the host.
- Check
SQL_DB_HOSTin.envis correct for your platform.
Volume mount issues:
- Ensure you exported
.envvariables beforeastro dev start. - Use absolute paths in
.env(no~expansion). - Verify the
data/directory exists.
Container issues:
- Run
astro dev logsto view container logs. - Run
docker psto verify containers are running. - Try
astro dev kill && astro dev startfor a clean restart.