From 90e3df1c6007ea06bcf09596e02963d2f2486198 Mon Sep 17 00:00:00 2001 From: Zane Bartlett <85081861+ZaneBartlett1@users.noreply.github.com> Date: Sun, 23 Apr 2023 13:41:28 -0500 Subject: [PATCH] Improve Quick Start instructions (#30820) Co-authored-by: Jarek Potiuk (cherry picked from commit f5f35b3b6bd67d7a3cfef207f9b3e72fe68033f1) --- docs/apache-airflow/start.rst | 57 +++++++++++++++++++++-------------- 1 file changed, 35 insertions(+), 22 deletions(-) diff --git a/docs/apache-airflow/start.rst b/docs/apache-airflow/start.rst index 5ce49decd2bd4..6f198dfded563 100644 --- a/docs/apache-airflow/start.rst +++ b/docs/apache-airflow/start.rst @@ -40,28 +40,41 @@ This quick start guide will help you bootstrap an Airflow standalone instance on The installation of Airflow is painless if you follow the instructions below. Airflow uses constraint files to enable reproducible installation, so using ``pip`` and constraint files is recommended. -.. code-block:: bash - :substitutions: - - # Airflow needs a home. `~/airflow` is the default, but you can put it - # somewhere else if you prefer (optional) - export AIRFLOW_HOME=~/airflow - - # Install Airflow using the constraints file - AIRFLOW_VERSION=|version| - PYTHON_VERSION="$(python --version | cut -d " " -f 2 | cut -d "." -f 1-2)" - # For example: 3.7 - CONSTRAINT_URL="https://raw.githubusercontent.com/apache/airflow/constraints-${AIRFLOW_VERSION}/constraints-${PYTHON_VERSION}.txt" - # For example: https://raw.githubusercontent.com/apache/airflow/constraints-|version|/constraints-3.7.txt - pip install "apache-airflow==${AIRFLOW_VERSION}" --constraint "${CONSTRAINT_URL}" - - # The Standalone command will initialise the database, make a user, - # and start all components for you. - airflow standalone - - # Visit localhost:8080 in the browser and use the admin account details - # shown on the terminal to login. - # Enable the example_bash_operator DAG in the home page +1. Set Airflow Home (optional): + + Airflow requires a home directory, and uses ``~/airflow`` by default, but you can set a different location if you prefer. The ``AIRFLOW_HOME`` environment variable is used to inform Airflow of the desired location. This step of setting the environment variable should be done before installing Airflow so that the installation process knows where to store the necessary files. + + .. code-block:: bash + + export AIRFLOW_HOME=~/airflow + +2. Install Airflow using the constraints file, which is determined based on the URL we pass: + + .. code-block:: bash + :substitutions: + + + AIRFLOW_VERSION=|version| + + # Extract the version of Python you have installed. If you're currently using Python 3.11 you may want to set this manually as noted above, Python 3.11 is not yet supported. + PYTHON_VERSION="$(python --version | cut -d " " -f 2 | cut -d "." -f 1-2)" + + CONSTRAINT_URL="https://raw.githubusercontent.com/apache/airflow/constraints-${AIRFLOW_VERSION}/constraints-${PYTHON_VERSION}.txt" + # For example this would install |version| with python 3.7: https://raw.githubusercontent.com/apache/airflow/constraints-|version|/constraints-3.7.txt + + pip install "apache-airflow==${AIRFLOW_VERSION}" --constraint "${CONSTRAINT_URL}" + +3. Run Airflow Standalone: + + The ``airflow standalone`` command initializes the database, creates a user, and starts all components. + + .. code-block:: bash + + airflow standalone + +4. Access the Airflow UI: + + Visit ``localhost:8080`` in your browser and log in with the admin account details shown in the terminal. Enable the ``example_bash_operator`` DAG in the home page. Upon running these commands, Airflow will create the ``$AIRFLOW_HOME`` folder and create the "airflow.cfg" file with defaults that will get you going fast.