VisaalPathak / VisaalPathak.github.io

A repository to write blogs to make your learning easier.
1 stars 0 forks source link

systemd%20service%20for%20airflow%20webserver%20and%20scheduler/creating-airflow-services/ #4

Open utterances-bot opened 1 year ago

utterances-bot commented 1 year ago

Creating Airflow Services to run airflow as a daemon using systemd in Ubuntu - Visaal’s Blogs

A tutorial about how to create Airflow daemon using systemd in Ubuntu 22.04. To know the basics of airflow and how to install it, please go through the blog Getting Started With Airflow.

https://visaalpathak.github.io/systemd%20service%20for%20airflow%20webserver%20and%20scheduler/creating-airflow-services/

blackswan1 commented 1 year ago

Thanks for your quick guide which I followed to run airflow as a service. Unfortunately it did not work for me: UBUNTU / AIRFLOW 2.7.1 Following output when I try to start systemd:

● airflow-webserver.service - Airflow webserver daemon Loaded: loaded (/etc/systemd/system/airflow-webserver.service; disabled; >vendor preset: enabled) Active: activating (auto-restart) (Result: exit-code) since Sun 2023-09-24 >19:37:30 CEST; 890ms ago Process: 29687 ExecStart=/home/pi/airflow_env/bin/airflow webserver >(code=exited, status=203/EXEC) Main PID: 29687 (code=exited, status=203/EXEC) CPU: 16ms

I can't find a path ~airflow/airflow_env/bin

I exactly followed these steps: https://airflow.apache.org/docs/apache-airflow/stable/start.html

My systemd file looks as follows:

[Unit] Description=Airflow webserver daemon After=network.target mysql.service Wants=mysql.service [Service] Environment="PATH=$PATH:/home/pi/airflow/airflow_env/bin:/home/pi/airflow/" User=pi Group=pi Type=simple ExecStart=/home/pi/airflow_env/bin/airflow webserver Restart=on-failure RestartSec=5s PrivateTmp=true [Install] WantedBy=multi-user.target/home

VisaalPathak commented 1 year ago

I think you might have mistaken your airflow environment path in either Environment section or ExecStart section. You have added /home/pi/airflow/airflow_env/bin in Environment but in ExecStart you have /home/pi/airflow_env/bin/airflow webserver.

So, I think /home/pi/airflow/airflow_env/bin in ExecStart will fix it. @blackswan1