github-webhook-handler architecture

What are we building?

We are building an API capable of handling and triggering automation workflows based on Github webhook events.

What is a github webhook?

Github Webhook is an event based integration provided by Github and other version control systems such as Bitbucket. [1]

Why do we need a github webhook handler?

We need a webhook handler to trigger automation workflows such as CI/CD pipelines, ML training jobs e.t.c.

Sample use-cases:

  • Trigger a CI/CD Pipeline on git push/pull_request
  • Run unit tests/integration tests
  • Run static code analysis/Linting

Architecture:


This post talks about creating a CI/CD pipeline for Serverless applications using AWS Serverless Application Model(SAM), AWS CodeBuild and AWS Cloudformation.

This pipeline can be used to automate deployments for AWS Lambda, API Gateway and other services supported by SAM.List of supported services can be found here.

This post follows a bottom-up approach as described below.

  1. Automate the build and deploy process using AWS Codebuild.
  2. Automate the creation of AWS Codebuild and other resources using AWS Cloudformation.

Part 1: Develop and Deploy Lambda application using SAM CLI

pre-requisites:

  1. Install SAM CLI
  2. Install Docker


API-Architecture

In this post, I will guide you through the process of setting up a simple Flask application with data persisted in AWS DynamoDB ,and deploying the application using the popular Serverless Framework.

Part 1 — Setting up DynamoDB

Step 1: Creating DynamoDB table

Create a DynamoDB table with a partition key of your choice[1].
For this example, I am using an application created for senior citizens and my table is called ‘citizens’.

create_table.py

Step 2: Load data into Dynamodb

The table partition key is a string called ‘citizenId’ and for optimum performance , I am using the uuid module to generate a unique uuid values for each item. You can read more about optimizing DynamoDB performance here.


This article goes through the full process of setting up a CI/CD pipeline for a Django application with Github, Travis CI and AWS ElasticBeanstalk

High-level architecture

Components used:

This article is going to focus on setting up the CI/CD pipeline and not the Django application as the steps used in this pipeline are common across all Django applications. However, I am including a small note on the application to add some context.

Application details:

The application is the simple ‘polls’ app discussed…

Sourabh Mokhasi

Ex-AWS engineer currently pursuing Masters in Software engineering at UOFC

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store