Skip to content

Getting Started

Run the Airflow stack locally, configure API credentials, and trigger a first pipeline. These steps match a fresh clone of the GitLab project.

Prerequisites

Requirement Notes
Docker Desktop / Docker Engine ≥ 4 GB RAM recommended (Neo4j is memory-heavy)
Docker Compose v2 docker compose command
Git Clone this repository
API access YouTube Data API key, TikTok Research API client credentials
Optional (production) Azure Cosmos DB, remote Neo4j, Azure OpenAI

Ports used locally

Service Port
Airflow UI 8080
MongoDB 27017
Neo4j Browser 7474
Neo4j Bolt 7687

1. Clone and configure environment

git clone https://gitlab.com/new-momentum/reading-between-the-lines/rbtl_airlflow.git
cd rbtl_airlflow
cp .env.example .env

The GitLab project slug is rbtl_airlflow. A local folder name such as rbtl_data_collection_gitlab is fine.

Edit .env:

  • Set AIRFLOW_UID to your user id (id -u on macOS/Linux).
  • Keep AIRFLOW_ENV=development for local Docker Mongo/Neo4j.
  • Add OpenAI / Azure keys if you will run analysis DAGs.

Never commit .env — it is gitignored. Use .env.example as the template.

2. Prepare data inputs

Edit the influencer CSV files (mounted into containers at /opt/airflow/data/input/):

File Columns Used by
data/input/youtube_influencers.csv username, channel_id YouTube ingest DAGs
data/input/tiktok_influencers.csv username TikTok ingest DAGs

3. Start the stack

mkdir -p logs config data/tmp_openai_batches
docker compose up airflow-init    # one-time DB migration + admin user
docker compose up -d              # start all services

Open http://localhost:8080 — login with _AIRFLOW_WWW_USER_USERNAME / _AIRFLOW_WWW_USER_PASSWORD from .env (defaults: airflow / airflow).

4. Configure Airflow (required before ingest)

Admin → Variables

Platform API keys are Airflow Variables, not .env keys.

Variable Description
YOUTUBE_API_KEY Google Cloud YouTube Data API v3 key
TIKTOK_CLIENT_KEY TikTok Research API client key
TIKTOK_CLIENT_SECRET TikTok Research API client secret
TIKTOK_TOKEN Optional; refreshed automatically if expired
TIKTOK_TOKEN_EXPIRES_AT Optional Unix timestamp

Admin → Connections

Create four connections (Conn Id → Conn Type → Host / login / password / extras).

Development (AIRFLOW_ENV=development)

Conn Id Type Example
mongo_default Mongo mongodb://airflow:<MONGO_PASSWORD>@mongodb:27017/
neo4j_default Neo4j Host neo4j, port 7687, login neo4j, password from .env (NEO4J_PASSWORD_DEV)
mongo_prod Mongo Your Cosmos/Atlas URI (same as production if you test against prod DB)
neo4j_prod Neo4j Production Neo4j URI (NEO4J_URI, NEO4J_USER, NEO4J_PASSWORD)

Use mongo_default + neo4j_default when AIRFLOW_ENV=development.

5. Unpause DAGs

New DAGs are paused by default (DAGS_ARE_PAUSED_AT_CREATION=true). In the Airflow UI, unpause the DAGs you need, or run a pipeline DAG once.

Next: run a pipeline.