Skip to content

Commit

Permalink
Improve Quick Start instructions (#30820)
Browse files Browse the repository at this point in the history
Co-authored-by: Jarek Potiuk <[email protected]>
(cherry picked from commit f5f35b3)
  • Loading branch information
ZaneBartlett1 authored and ephraimbuddy committed May 8, 2023
1 parent 3f4a10f commit 90e3df1
Showing 1 changed file with 35 additions and 22 deletions.
57 changes: 35 additions & 22 deletions docs/apache-airflow/start.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 90e3df1

Please sign in to comment.