The purpose of this project is to setup Github to push notifications to a monitoring server whenever a developer pushes changes to a repository using Github's webhooks. Webhooks allow you to send HTTP POST requests to a specified URL in response to certain events, such as code pushes.
docker run -d -p 15672:15672 -p 5672:5672 --name rabbitmq rabbitmq:3-managementThis server first verifies the payload's signature to ensure the request is from GitHub. Then handles incoming webhook requests. It reads the request body, verifies the signature, parses the JSON payload, and sends it to RabbitMQ.
- Build image
docker build -t github-webhook github-webhook/- Run container
docker run -d -p 5000:5000 -e WEBHOOK_SECRET='super-secret' \
-e AMQP_URL='amqp://guest:guest@rabbitmq_ip:5672/' \
-e QUEUE_NAME='github_webhook' \
-e LISTEN_PORT=':5000' \
--name github-webhook github-webhookThis server connects to RabbitMQ and listens for messages from the specified queue. Then parses the JSON payload and processes the push event data by printing commit messages and author names.
- Build image
docker build -t worker worker/- Run container
docker run -d -e QUEUE_NAME='github_webhook' \
-e AMQP_URL='amqp://guest:guest@rabbitmq_ip:5672/' \
--name worker worker- Go to your repository on GitHub.
- Navigate to
Settings>Webhooks. - Click the
Add webhookbutton. - In the
Payload URLfield, enter the URL of theendpointon yourmonitoring serverwhere you want to receive the notifications. - Set the
Content typetoapplication/json. - Optionally, enter a
Secret. This secret will be used to ensure that the incoming webhook is indeed from GitHub. - In the Which events would you like to trigger this webhook? section, select
Just the push event. - Click the
Add webhookbutton to save the webhook configuration.
Create any changes in the repository and then run docker logs --follow worker to check the logs. It should look like this:



