idealista / airflow-role

Ansible role to install Apache Airflow
Apache License 2.0
83 stars 52 forks source link

ubuntu, airflow db path - var/lib - opt/airflow #109

Closed t4n1o closed 3 years ago

t4n1o commented 3 years ago

Description

ansible playbook installs to opt/airflow/airflow.db

airflow process launched with systemd uses /opt/airflow/airflow.db ansible/create_user uses /var/lib/airflow/airflow/airflow.db opt/bin/airflow also uses /var/lib/airflow/airflow/airflow.db

Just looking for ideas on how to solve this.

Additional Information

I changed a few settings in the webserver.service and Env variable files to make airflow work on ubuntu server LTS 20.04 But this part was broken before that also.

sudo -u airflow bash -c "/opt/airflow/bin/airflow config get-value core sql_alchemy_conn"
sqlite:////var/lib/airflow/airflow/airflow.db
sudo -u airflow bash -c "export AIRFLOW_CONFIG=/etc/airflow/airflow.cfg; /opt/airflow/bin/airflow config get-value core sql_alchemy_conn"
sqlite:////opt/airflow/airflow.db
t4n1o commented 3 years ago

I fixed it by making sure the user airflow has the environment variable AIRFLOW_CONFIG = /etc/airflow/airflow.cfg while we run the create user tasks.

If you use sudo in ubuntu it santizes the environemnt (which is the only way to run the rest of the scripts).