# 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:
```bash
pip install airflow_deploy_softwrd
```
## Configuration
### AWS Credentials Setup
Set up your AWS credentials using the following command:
```bash
$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:
```bash
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:
NB. you can set SSH to true if you want to clone the repository using SSH.
```json
{
"allowed_branches": ["develop", "main", "Airflow-Changelog"],
"SSH": false
}
```
### 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:
```json
{
"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:
```json
{
"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](mailto:robiuddin@softwrd.ai)
Project Link: [Repository URL](https://github.com/softwrdai/airflow_deploy_softwrd/)
Raw data
{
"_id": null,
"home_page": "https://github.com/softwrdai/airflow_deploy_softwrd",
"name": "airflow-deploy-softwrd",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": null,
"author": "Md Robiuddin",
"author_email": "robiuddin@softwrd.ai",
"download_url": "https://files.pythonhosted.org/packages/db/1d/4af93bef035a3d296bbcb1d1b377f55903126fbcd3803bd622188edfee56/airflow_deploy_softwrd-0.0.8.tar.gz",
"platform": null,
"description": "# Airflow Deploy Softwrd\n\nA 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.\n\n## Features\n- Deploy specified branches of a repository on push events.\n- Bring down specified branches of a repository.\n- Retrieve secrets from AWS Secrets Manager.\n- Automatically configure environment variables from secrets.\n\n## Prerequisites\n- Python 3.9 or higher\n- Docker and Docker Compose\n- AWS credentials setup if using Secrets Manager\n\n## Installation\n\nYou can install the package from PyPI:\n\n```bash\npip install airflow_deploy_softwrd\n```\n\n## Configuration\n\n### AWS Credentials Setup\nSet up your AWS credentials using the following command:\n```bash\n$Env:AWS_ACCESS_KEY_ID = \"your-access-key-id\"\n$Env:AWS_SECRET_ACCESS_KEY = \"your-secret-access-key\"\n```\nyou must have to set up your AWS credentials in your environment variables before running the application.\n\n## Usage\n\nTo run the server, use the following command:\n\n```bash\nairflow_deploy_softwrd /path/to/your/working/directory /path/to/config.json\n```\n\n### Command Line Arguments\n- `/path/to/your/working/directory`: The base directory where repositories will be cloned and operated.\n- `/path/to/config.json`: Path to the configuration file containing allowed branches.\n\n### Configuration File\nCreate a JSON configuration file, e.g., `config.json`, with the following contents to specify allowed branches:\nNB. you can set SSH to true if you want to clone the repository using SSH.\n\n```json\n{\n \"allowed_branches\": [\"develop\", \"main\", \"Airflow-Changelog\"],\n \"SSH\": false\n}\n```\n\n\n\n\n### Secrets in AWS Secrets Manager\nSet up the following secrets in AWS Secrets Manager:\n- `airflow_deployment_env`: Secret containing environment variables for deploying Airflow.\n- `airflow_variables_env`: Secret containing Airflow variable configurations.\n\n### POSTMAN Webhooks\nSet up POSTMAN webhooks to point to the following endpoints of your running Flask application:\n\n- Deploying a branch: \n ```\n http://localhost:6969/payload\n ```\n\n- Bringing down a branch: \n ```\n http://localhost:6969/putdown\n ```\n\n## Example Webhook Payloads\n\n### Deploy a Branch\nThe webhook for deploying a branch should contain information about the branch and repository in the body of the payload:\n\n```json\n{\n \"ref\": \"refs/heads/main\",\n \"repository\": {\n \"clone_url\": \"https://github.com/yourusername/yourrepo.git\",\n \"name\": \"yourrepo\"\n },\n \"head_commit\": {\n \"message\": \"Your commit message\"\n }\n}\n```\n\n### Bring Down a Branch\nThe webhook for bringing down a branch should contain similar information:\n\n```json\n{\n \"ref\": \"refs/heads/main\",\n \"repository\": {\n \"clone_url\": \"https://github.com/yourusername/yourrepo.git\",\n \"name\": \"yourrepo\"\n },\n \"head_commit\": {\n \"message\": \"Your commit message\"\n }\n}\n```\n\n## Contact\n\nMaintainer: [Md Robiuddin](mailto:robiuddin@softwrd.ai)\n\nProject Link: [Repository URL](https://github.com/softwrdai/airflow_deploy_softwrd/)\n",
"bugtrack_url": null,
"license": null,
"summary": "A Flask application to handle postman webhooks for deploying and taking down repositories.",
"version": "0.0.8",
"project_urls": {
"Homepage": "https://github.com/softwrdai/airflow_deploy_softwrd"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "c9ddd8cf2903c966857e52310def3ed2edbd39a2e7482804d4bed02e96d9b86e",
"md5": "85c110dc246a57dc88b8cbf306dfa16e",
"sha256": "08ad385f0dac29b0a8d61ed3020c7669cc1e4a76652a2b7956e76af46963636f"
},
"downloads": -1,
"filename": "airflow_deploy_softwrd-0.0.8-py3-none-any.whl",
"has_sig": false,
"md5_digest": "85c110dc246a57dc88b8cbf306dfa16e",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 8797,
"upload_time": "2024-10-08T05:28:55",
"upload_time_iso_8601": "2024-10-08T05:28:55.512557Z",
"url": "https://files.pythonhosted.org/packages/c9/dd/d8cf2903c966857e52310def3ed2edbd39a2e7482804d4bed02e96d9b86e/airflow_deploy_softwrd-0.0.8-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "db1d4af93bef035a3d296bbcb1d1b377f55903126fbcd3803bd622188edfee56",
"md5": "7f2c10271dc7043cf358c9db00ad4f66",
"sha256": "47f8678f2c0861b5578548e0c49c31b32f77ea081c857b391cecb385d4862bf5"
},
"downloads": -1,
"filename": "airflow_deploy_softwrd-0.0.8.tar.gz",
"has_sig": false,
"md5_digest": "7f2c10271dc7043cf358c9db00ad4f66",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 8033,
"upload_time": "2024-10-08T05:28:59",
"upload_time_iso_8601": "2024-10-08T05:28:59.231768Z",
"url": "https://files.pythonhosted.org/packages/db/1d/4af93bef035a3d296bbcb1d1b377f55903126fbcd3803bd622188edfee56/airflow_deploy_softwrd-0.0.8.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-08 05:28:59",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "softwrdai",
"github_project": "airflow_deploy_softwrd",
"github_not_found": true,
"lcname": "airflow-deploy-softwrd"
}