-
Notifications
You must be signed in to change notification settings - Fork 6
Migrate to Airflow 3 #60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Pierlou
wants to merge
7
commits into
master
Choose a base branch
from
chore/airlfow-3
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
a47dfd3
chore: migrate to airflow 3
Pierlou c4f84d3
chore: remove unused lib
Pierlou 0690b5a
docs: remove old insight
Pierlou f0e2d08
fix: from feeback
Pierlou 0640d10
fix: inconsistency in env var usage
estellebertrand 78dee92
fix: avoid false secret leak alarms
estellebertrand 8eb8732
fix: inconsistency in env var usage
estellebertrand File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,24 +1,19 @@ | ||
| AIRFLOW_UID=1000 | ||
| POSTGRES_USER=<fill here> | ||
| POSTGRES_PASSWORD=<fill here> | ||
| POSTGRES_DB=<fill here> | ||
| AIRFLOW_ADMIN_MAIL=<fill here> | ||
| AIRFLOW_ADMIN_FIRSTNAME=<fill here> | ||
| AIRFLOW_ADMIN_NAME=<fill here> | ||
| AIRFLOW_ADMIN_PASSWORD=<fill here> | ||
| AIRFLOW__SMTP__SMTP_HOST=mail.data.gouv.fr | ||
| _AIRFLOW_WWW_USER_USERNAME=<fill here> | ||
| _AIRFLOW_WWW_USER_PASSWORD=<fill here> | ||
| AIRFLOW_POSTGRES_PORT=5432 | ||
| AIRFLOW_WEBSERVER_PORT=8080 | ||
| AIRFLOW_LOG_SERVER_PORT=5894 | ||
| AIRFLOW__SMTP__SMTP_PORT=587 | ||
| AIRFLOW__WEBSERVER__BASE_URL=http://localhost:$AIRFLOW_WEBSERVER_PORT | ||
| AIRFLOW__SMTP__SMTP_USER=<fill here> | ||
| AIRFLOW__SMTP__SMTP_PASSWORD=<fill here> | ||
| AIRFLOW__SMTP__SMTP_MAIL_FROM=<fill here> | ||
| AIRFLOW__CORE__LOAD_DEFAULT_CONNECTIONS=False | ||
| AIRFLOW__CORE__SQL_ALCHEMY_CONN=postgres+psycopg2://$POSTGRES_USER:$POSTGRES_PASSWORD@postgres:5432/$POSTGRES_DB | ||
| AIRFLOW__CORE__FERNET_KEY=81HqDtbqAywKSOumSha3BhWNOdQ26slT6K0YaZeZyPs= | ||
| AIRFLOW__DATABASE__SQL_ALCHEMY_CONN=postgres+psycopg2://$POSTGRES_USER:$POSTGRES_PASSWORD@postgres:5432/$POSTGRES_DB | ||
| AIRFLOW_CONN_METADATA_DB=postgres+psycopg2://$POSTGRES_USER:$POSTGRES_PASSWORD@postgres:5432/$POSTGRES_DB | ||
| AIRFLOW_VAR__METADATA_DB_SCHEMA=$POSTGRES_DB | ||
| AIRFLOW_ENV_TYPE=demo | ||
| AIRFLOW_ENV_NAME=test | ||
|
|
||
| AIRFLOW_ENV=dev | ||
| AIRFLOW_DAG_HOME=/opt/airflow/dags | ||
| AIRFLOW_DAG_TMP=/tmp/ | ||
| DATAGOUV_URL=https://demo.data.gouv.fr | ||
| DATAGOUV_SECRET_API_KEY=<fill here> |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,39 +1,39 @@ | ||
| # Infrastructure Airflow | ||
|
|
||
| Ce repository a pour objectif de mettre en place rapidement une infrastructure Airflow permettant à chacun de tester son DAG avant mise en production. | ||
|
|
||
| L'infrastructure actuelle est basée sur du LocalExecutor (le scheduler, le webserver et worker sont hébergés sur le même container) | ||
| Ce repository a pour objectif de mettre en place rapidement une infrastructure Airflow permettant à chacun.e de tester son DAG avant mise en production. Il est basé sur le [guide d'initialisation](https://airflow.apache.org/docs/apache-airflow/3.1.7/howto/docker-compose/index.html) d'une instance Airflow (s'y référer pour plus de détails). Version actuelle : 3.1.7 | ||
|
|
||
| ## Installation | ||
|
|
||
| ``` | ||
| ```bash | ||
| git clone git@github.com:etalab/data-engineering-stack.git | ||
| cd data-engineering-stack | ||
|
|
||
| # Create directories necessary for Airflow to work | ||
| ./1_prepareDirs.sh | ||
| ./prepareDirs.sh | ||
|
|
||
| # Prepare .env file | ||
| ./2_prepare_env.sh | ||
| nano .env | ||
| # Edit POSTGRES_USER ; POSTGRES_PASSWORD ; POSTGRES_DB ; AIRFLOW_ADMIN_MAIL ; AIRFLOW_ADMIN_FIRSTNAME ; AIRFLOW_ADMIN_NAME ; AIRFLOW_ADMIN_PASSWORD | ||
| # Prepare .env file: | ||
| # Create a .env file from the .envExample and fill in the required variables. | ||
| # You may also add more variables there for specific DAGs to run. | ||
|
|
||
| # For MacOS with ARM: | ||
| # export DOCKER_DEFAULT_PLATFORM="linux/amd64" | ||
| # Initialize | ||
| docker compose up airflow-init | ||
|
|
||
| # Launch services | ||
| docker-compose up --build -d | ||
| docker compose up -d | ||
|
|
||
| # After few seconds, you can connect to http://localhost:<AIRFLOW_WEBSERVER_PORT> with login : AIRFLOW_ADMIN_MAIL and password : AIRFLOW_ADMIN_PASSWORD | ||
Pierlou marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| # If you have kept the default values: http://localhost:8080 and airflow:airflow as user:pwd | ||
| ``` | ||
|
|
||
| # After few seconds, you can connect to http://localhost:8080 with login : AIRFLOW_ADMIN_MAIL and password : AIRFLOW_ADMIN_PASSWORD | ||
| ## Import our DAGs | ||
| ```bash | ||
| cd dags | ||
| git clone git@github.com:datagouv/datagouvfr_data_pipelines.git | ||
| ``` | ||
|
|
||
| ## Refresh dags | ||
|
|
||
| ``` | ||
| ```bash | ||
| # Airflow used to have a little time before dag refreshing when dag is created. You can force refreshing with : | ||
| ./refreshBagDags.sh | ||
| ``` | ||
|
|
||
| ## Connections | ||
|
|
||
| Connections can be created manually or with python scripts `createConn.py` (using Airflow API) inside each projects. You need also to add your ssh key inside `ssh` folder of repository for the container to be able to see it in `/home/airflow/.ssh/` folder of container. | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those env vars are not used anymore from what I see in docker-compose.yml, but I'd advice to add the new login vars to .envExample so we know the login details by default + where to update them without going into the docker compose file:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm weird because I have not set the two ones in the docker-compose, but the ones in .env instead, and they are the ones that worked in the UI 🤔