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
Built Distribution
File details
Details for the file airflow_deploy_softwrd-0.0.3.tar.gz
.
File metadata
- Download URL: airflow_deploy_softwrd-0.0.3.tar.gz
- Upload date:
- Size: 7.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2b7dfe9eaa2264bbb9bc0a2a68ff20f0b11e5e9dd306848af23a9b94ba340d97 |
|
MD5 | 090d0a3866401cb3716869bfc43382a1 |
|
BLAKE2b-256 | 80d2ae9046a97b6c7a919fd5bb466ce742e699b0da4db545e8c2909ba766319c |
File details
Details for the file airflow_deploy_softwrd-0.0.3-py3-none-any.whl
.
File metadata
- Download URL: airflow_deploy_softwrd-0.0.3-py3-none-any.whl
- Upload date:
- Size: 8.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0d7f1a4f71da3eec91edcb2a1c608ef7a68885ae6866ca790caeb8777b96977b |
|
MD5 | 7aa19ad6f900426d867ab1b1b861fb6b |
|
BLAKE2b-256 | 55ed4bce164729ac926ea460dd920d2bff011cdf46f1f7a8922836e94fc9e3c1 |