You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2020/12/31 16:13:57 UTC

[GitHub] [airflow] VBhojawala commented on a change in pull request #13404: Developers Quick Start Guide

VBhojawala commented on a change in pull request #13404:
URL: https://github.com/apache/airflow/pull/13404#discussion_r550522924



##########
File path: contributrs-quick-start.rst
##########
@@ -0,0 +1,976 @@
+ .. Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+ ..   http://www.apache.org/licenses/LICENSE-2.0
+
+ .. Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+
+*************************
+Contributor's Quick Guide
+*************************
+
+.. contents:: :local:
+
+
+Prerequisites
+#############
+
+1. Docker Community Edition
+2. Docker Compose
+3. pyenv (you can also use pyenv-virtualenv or virtualenvwrapper)
+
+
+Installing Prerequisites on Ubuntu
+###################################
+
+
+Docker Community Edition
+-----------------------------------
+
+
+1. Installing required packages for Docker and setting up docker repo
+
+.. code-block:: bash
+
+  $ sudo apt-get update
+
+  $ sudo apt-get install \
+      apt-transport-https \
+      ca-certificates \
+      curl \
+      gnupg-agent \
+      software-properties-common
+
+  $ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
+
+  $ sudo add-apt-repository \
+     "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
+     $(lsb_release -cs) \
+     stable"
+
+2. Install Docker
+
+.. code-block:: bash
+
+  $ sudo apt-get update
+  $ sudo apt-get install docker-ce docker-ce-cli containerd.io
+
+3. Creating group for docker and adding current user to it.
+
+.. code-block:: bash
+
+  $ sudo groupadd docker
+  $ sudo usermod -aG docker $USER
+
+Note : After adding user to docker group Logout and Login again for group membership re-evaluation.
+
+4. Test Docker installation
+
+.. code-block:: bash
+
+  $ docker run hello-world
+
+
+
+
+Docker Compose
+--------------------------
+
+1. Installing latest version of Docker Compose
+
+.. code-block:: bash
+
+  $ COMPOSE_VERSION="$(curl -s https://api.github.com/repos/docker/compose/releases/latest | grep '"tag_name":'\
+  | cut -d '"' -f 4)"
+
+  $ COMPOSE_URL="https://github.com/docker/compose/releases/download/${COMPOSE_VERSION}/\
+  docker-compose-$(uname -s)-$(uname -m)"
+
+  $ sudo curl -L "${COMPOSE_URL}" -o /usr/local/bin/docker-compose
+
+  $ sudo chmod +x /usr/local/bin/docker-compose
+
+2. Verifying installation
+
+.. code-block:: bash
+
+  $ docker-compose --version
+
+
+
+pyenv and setting up virtual-env
+--------------------------------------------
+
+1. Checking required packages
+
+.. code-block:: bash
+
+  $ sudo apt-get install -y build-essential libssl-dev zlib1g-dev libbz2-dev \
+      libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev \
+      xz-utils tk-dev libffi-dev liblzma-dev python-openssl git
+
+  $ sudo apt install build-essentials python3.6-dev python3.7-dev python3.8-dev python-dev openssl \
+       sqlite sqlite-dev default-libmysqlclient-dev libmysqld-dev postgresql
+
+2. Install pyenv
+
+.. code-block:: bash
+
+  $ curl https://pyenv.run | bash
+
+3. Add the lines suggested at the end of installation  to ~/.bashrc
+
+4. Restart your shell so the path changes take effect and verifying installation
+
+.. code-block:: bash
+
+  $ exec $SHELL
+  $ pyenv --version
+
+5. Checking available version, installing required Python version to pyenv and verifying it
+
+.. code-block:: bash
+
+  $ pyenv install --list
+  $ pyenv install 3.8.5
+  $ pyenv versions
+
+6. Creating new virtual environment named ``airflow-env`` for installed version python
+
+.. code-block:: bash
+
+  $ pyenv virtualenv 3.8.5 airflow-env
+
+7. Entering virtual environment ``airflow-env``
+
+.. code-block:: bash
+
+  $ pyenv activate airflow-env
+
+
+
+
+Setup Airflow with Breeze and PyCharm
+#####################################################
+
+
+Forking and cloning Project
+---------------------------
+
+1. Goto |airflow_github| and fork the project.
+
+   .. |airflow_github| raw:: html
+
+     <a href="https://github.com/apache/airflow/" target="_blank">https://github.com/apache/airflow/</a>
+
+   .. raw:: html
+
+     <div align="center" style="padding-bottom:10px">
+       <img src="images/quick_start/airflow_fork.png"
+            alt="Forking Apache Airflow project">
+     </div>
+
+2. Goto your github account's fork of airflow click on ``Code`` and copy the clone link.
+
+   .. raw:: html
+
+      <div align="center" style="padding-bottom:10px">
+        <img src="images/quick_start/airflow_clone.png"
+             alt="Cloning github fork of Apache airflow">
+      </div>
+
+
+
+3. Open PyCharm and click ``Get from Version Control``
+
+   .. raw:: html
+
+      <div align="center" style="padding-bottom:10px">
+        <img src="images/quick_start/pycharm_clone.png"
+             alt="Cloning github fork to Pycharm">
+      </div>
+
+
+4. Paste the copied clone link in URL and click on clone.
+
+   .. raw:: html
+
+      <div align="center" style="padding-bottom:10px">
+        <img src="images/quick_start/click_on_clone.png"
+             alt="Cloning github fork to Pycharm">
+      </div>
+
+
+Setting up Breeze
+-----------------
+1. Open terminal and enter into virtual environment ``airflow-env`` and goto project directory
+
+.. code-block:: bash
+
+  $ pyenv activate airflow-env
+  $ cd ~/PycharmProjects/airflow/
+
+2. Initializing breeze autocomplete
+
+.. code-block:: bash
+
+  $ ./breeze setup-autocomplete
+  $ source ~/.bash_completion.d/breeze-complete
+
+3. Initialize breeze environment with required python version and backend. This may take a while for first time.
+
+.. code-block:: bash
+
+  $ ./breeze --python 3.8 --backend mysql
+
+4. Creating airflow tables and users. ``airflow db reset`` is required to execute at least once for Airflow Breeze to get
+   the database/tables created.
+
+.. code-block:: bash
+
+  $ airflow db reset
+  $ airflow users create --role Admin --username admin --password admin --email admin@example.com --firstname\
+    foo --lastname bar
+
+
+5. Closing Breeze environment. After successfully finishing above command will leave you in container,
+   type ``exit`` to exit the container
+
+.. code-block:: bash
+
+  root@b76fcb399bb6:/opt/airflow#
+  root@b76fcb399bb6:/opt/airflow# exit
+
+.. code-block:: bash
+
+  $ ./breeze stop
+
+6. Linking Local virtual environment ``airflow-env`` with breeze.
+
+   It may requires some packages to be installed.
+
+.. code-block:: bash
+
+  $ sudo apt-get install sqlite libsqlite3-dev default-libmysqlclient-dev postgresql
+  $ ./breeze initialize-local-virtualenv --python 3.8
+
+
+7. Add following line to ~/.bashrc in order to call breeze command from anywhere.
+
+.. code-block:: bash
+
+  export PATH=${PATH}:"/home/${USER}/PycharmProjects/airflow"
+  source ~/.bashrc
+
+Using Breeze
+-----------------------------------------
+
+1. Starting breeze environment using ``breeze start-airflow`` starts Breeze environment with last configuration run(
+   In this case python and backend will be picked up from last execution ``./breeze --python 3.8 --backend mysql``)
+   It also automatically starts webserver, backend and scheduler. It drops you in tmux with scheduler in bottom left
+   and webserver in bottom right. Use ``[Ctrl + B] and Arrow keys`` to navigate.
+
+.. code-block:: bash
+
+  $ breeze start-airflow

Review comment:
       Sure, i will update it when it's merged.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org