Giter VIP home page Giter VIP logo

airflow-single-server's Introduction

Image 1 Image 2

Airflow on a single server

 Simply deploy and manage airflow on a small server or personal computer, with bash scripts

0. Quickstart

cd deployment # go to the `deployment` folder
chmod +x health.sh init.sh kill.sh run.sh wait-backend.sh teardown.sh # allow these scripts to be executed
./init.sh # Initilize postgres server, and create default user "Admin"
./run.sh # Run and connect airflow to postgres server.
  • The installed Airflow version will be 2.7.3, and be hosted at the port 8080
  • To login as admin user, the user name is "airflow", and password is "airflow"
  • Example dags and plugins have been created for you in the folder src/
  • For more customization and management, see the below steps.

1. Deployment.

1.1. Setup Environment.

1.1.1. Install Prerequisites.

  • *Using a python virtual environment is recommended, you can use the commands below to quickly create and use a python venv
    python3 -m venv airflow-venv # create a virtual env called: airflow-venv
    source ./airflow-venv/bin/activate # activate the virtual environment.
  • Please install docker (and docker compose) in your system/server.
  • Allow bash cripts to be executed, using chmod:
    cd deployment
    chmod +x health.sh init.sh kill.sh run.sh wait-backend.sh teardown.sh

1.1.2. Customize Airflow to your needs

  • config/requirements.txt is for you, to add custom πŸ“¦ python packages needed for your DAG
  • config/airflow.secret.env is for:
    • πŸ€“ User login credential
    • πŸ“š Airflow versions.
    • πŸ“‚ Path to your airflow source folder (that will hold dags, plugins, logs, etc.). default is src/
    • πŸ“‚ Path to airflow.cfg folder. default is config/airflow.cfg
    • πŸ”— Airflow exposed ports
    • πŸ” Your Fernet Key for airflow to encrypt sensitive info
  • config/airflow.cfg is for common configurations (without secrets) for airflow, Examples: 🌏timezone
    [core]
    default_timezone = 	Asia/Ho_Chi_Minh # timezone of your apps
    [webserver]
    default_ui_timezone = Asia/Ho_Chi_Minh #timezone of the web UI
  • config/postgres.env, is for postgresql database credential, This will be used by docker compose to create a containerized Postgres server, to be used as airflow backend.
  • config/docker-compose.yaml is for building postgres server container.

1.2. Initialize airflow backend

Execute the command: ./deployment/init.sh, to perform these tasks:

  • Install neccessary linux packages
  • Create the airflow backend (postgres server).
  • Connect Airflow to airflow backend
  • Create Admin user.

1.3. Run the Airflow Webserver and Scheduler

Execute ./deployment/run.sh, to:

  • Run the airflow scheduler in the backgound
  • Run the airflow webserver in the backgound

2. Management

  • To kill airflow scheduler and webserver (without deleting data): ./deployment/kill.sh
  • to check health of airflow (using airflow exposed ports, setup in config/airflow.secret.env): ./deployment/health.sh
  • To Fully remove airflow-backend (container, images, mounted volume):
    cd deployment
    ./teardown.sh # you will be prompted to delete the mounted volume and docker image postgres:15 

airflow-single-server's People

Contributors

duriandan avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.