I am unable to start the airflow webserver using systemd even though it starts and functions properly outside of systemd like so:
export AIRFLOW_HOME=/path/t
I had the same problem on Ubuntu 18.04 LTS and Apache Airflow version 1.10.1 installed in a virtual environment under /srv/airflow. After lots of trial and errors I ended up with this working solution.
My airflow-webserver.service file:
[Unit]
Description=Airflow webserver daemon
After=network.target
[Service]
Environment="PATH=/srv/airflow/bin"
Environment="AIRFLOW_HOME=/srv/airflow"
User=airflow
Group=airflow
Type=simple
ExecStart=/srv/airflow/bin/airflow webserver --pid /srv/airflow/webserver.pid
Restart=on-failure
RestartSec=5s
PrivateTmp=true
[Install]
WantedBy=multi-user.target
I did this to install the service:
sudo cp airflow-webserver.service /lib/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable airflow-webserver.service
sudo systemctl start airflow-webserver.service
In Ubuntu Bionic, I found that sudo apt-get install python3-gunicorn
first and then sudo apt-get install gunicorn
while in the root python environment resolves this problem.