From 80c21679794c695976f89e999a1b31e68bfaaf00 Mon Sep 17 00:00:00 2001 From: lb584 <lb584@cam.ac.uk> Date: Thu, 4 Apr 2024 17:06:10 +0100 Subject: [PATCH] updating docs --- docs/_source/iaas_setup.rst | 73 +++++++++++++++++++++++++++++++++++++ docs/api.rst | 2 +- 2 files changed, 74 insertions(+), 1 deletion(-) diff --git a/docs/_source/iaas_setup.rst b/docs/_source/iaas_setup.rst index fa90fcb..5ed349b 100644 --- a/docs/_source/iaas_setup.rst +++ b/docs/_source/iaas_setup.rst @@ -626,4 +626,77 @@ can run as demons with the -D flag connect to the webserver http://<server_ip>:8090 +**set up airflow as a service** + +Once you have got airflow running from the command line, you will need to set it up as a service (which will run at startup and in the background) + +1: create a service file for airflow scheduler and webserver: + +sudo touch /etc/systemd/system/airflow-scheduler.service +sudo touch /etc/systemd/system/airflow-webserver.service + +edit the contents of both files to be: + +.. code-block:: bash + + [Unit] + Description=Airflow scheduler daemon + After=network.target mysql.service + Wants=mysql.service + [Service] + EnvironmentFile=/storage/airflow/airflow.cfg + User=ewsmanager + Group=ewsmanager + Type=simple + ExecStart=/usr/bin/bash -c 'export AIRFLOW_HOME=/storage/airflow ; source /storage/airflow/airflow-env/bin/activate ; airflow webserver' + Restart=no + RestartSec=5s + PrivateTmp=true + [Install] + WantedBy=multi-user.target + +.. code-block:: bash + + [Unit] + Description=Airflow scheduler daemon + After=network.target mysql.service + Wants=mysql.service + [Service] + EnvironmentFile=/storage/airflow/airflow.cfg + User=ewsmanager + Group=ewsmanager + Type=simple + ExecStart=/usr/bin/bash -c 'export AIRFLOW_HOME=/storage/airflow ; source /storage/airflow/airflow-env/bin/activate ; airflow scheduler' + Restart=no + RestartSec=5s + PrivateTmp=true + [Install] + WantedBy=multi-user.target + +2: reload the service daemon, enable and start the services + +sudo systemctl daemon-reload + +sudo systemctl enable airflow-scheduler.service +sudo systemctl enable airflow-webserver.service + +sudo systemctl start airflow-scheduler.service +sudo systemctl start airflow-webserver.service + +sudo systemctl restart airflow-scheduler.service +sudo systemctl restart airflow-webserver.service + +sudo systemctl stop airflow-scheduler.service +sudo systemctl stop airflow-webserver.service + +3: check the status of the services + +sudo systemctl status airflow-scheduler.service +sudo systemctl status airflow-webserver.service + +4: check the logs + +sudo journalctl -r -u airflow-scheduler.service +sudo journalctl -r -u airflow-webserver.service + diff --git a/docs/api.rst b/docs/api.rst index 92c6af1..3d57073 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -6,7 +6,7 @@ API :template: custom-module-template.rst :recursive: - coordinator +.. coordinator plotting ews_postprocessing met_processing -- GitLab