Skip to main content

A Flask application to handle postman webhooks for deploying and taking down repositories.

Project description

Airflow Deploy Softwrd

A Flask application to handle POSTMAN webhooks for deploying and taking down repositories using Docker Compose. This application is particularly designed for managing Airflow deployment of softwrd in house hosted repositories.

Features

  • Deploy specified branches of a repository on push events.
  • Bring down specified branches of a repository.
  • Retrieve secrets from AWS Secrets Manager.
  • Automatically configure environment variables from secrets.

Prerequisites

  • Python 3.9 or higher
  • Docker and Docker Compose
  • AWS credentials setup if using Secrets Manager

Installation

You can install the package from PyPI:

pip install airflow_deploy_softwrd

Configuration

AWS Credentials Setup

Set up your AWS credentials using the following command:

$Env:AWS_ACCESS_KEY_ID = "your-access-key-id"
$Env:AWS_SECRET_ACCESS_KEY = "your-secret-access-key"

you must have to set up your AWS credentials in your environment variables before running the application.

Usage

To run the server, use the following command:

airflow_deploy_softwrd /path/to/your/working/directory /path/to/config.json

Command Line Arguments

  • /path/to/your/working/directory: The base directory where repositories will be cloned and operated.
  • /path/to/config.json: Path to the configuration file containing allowed branches.

Configuration File

Create a JSON configuration file, e.g., config.json, with the following contents to specify allowed branches:

{
  "allowed_branches": ["develop", "main", "Airflow-Changelog"]
}

Secrets in AWS Secrets Manager

Set up the following secrets in AWS Secrets Manager:

  • airflow_deployment_env: Secret containing environment variables for deploying Airflow.
  • airflow_variables_env: Secret containing Airflow variable configurations.

POSTMAN Webhooks

Set up POSTMAN webhooks to point to the following endpoints of your running Flask application:

  • Deploying a branch:

    http://localhost:6969/payload
    
  • Bringing down a branch:

    http://localhost:6969/putdown
    

Example Webhook Payloads

Deploy a Branch

The webhook for deploying a branch should contain information about the branch and repository in the body of the payload:

{
  "ref": "refs/heads/main",
  "repository": {
    "clone_url": "https://github.com/yourusername/yourrepo.git",
    "name": "yourrepo"
  },
  "head_commit": {
    "message": "Your commit message"
  }
}

Bring Down a Branch

The webhook for bringing down a branch should contain similar information:

{
  "ref": "refs/heads/main",
  "repository": {
    "clone_url": "https://github.com/yourusername/yourrepo.git",
    "name": "yourrepo"
  },
  "head_commit": {
    "message": "Your commit message"
  }
}

Contact

Maintainer: Md Robiuddin

Project Link: Repository URL

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

airflow_deploy_softwrd-0.0.4.tar.gz (7.9 kB view details)

Uploaded Source

Built Distribution

airflow_deploy_softwrd-0.0.4-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

Details for the file airflow_deploy_softwrd-0.0.4.tar.gz.

File metadata

File hashes

Hashes for airflow_deploy_softwrd-0.0.4.tar.gz
Algorithm Hash digest
SHA256 7614c9336a2b891f8d55522089b10b2f89089e39f10fe47dab3f1ece8f19747f
MD5 ae293ae81754785c953b69d554d68246
BLAKE2b-256 4f622a717602fdd5f215337dd30717904d3dda53a5a9437257fbd2772fb03cd3

See more details on using hashes here.

File details

Details for the file airflow_deploy_softwrd-0.0.4-py3-none-any.whl.

File metadata

File hashes

Hashes for airflow_deploy_softwrd-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 cf9526b0c9565d21a976849e48f02cee922a9a56019c1bdf7353e12d2f1b8a71
MD5 40499fc0f06e67ea568ab3735a67ade3
BLAKE2b-256 3f38306c756d0473b35794a54ce0c93dc7d1f998a8a52195c12ca264cc83c6cc

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page