A Sophisticated Telegram Bot For Tracking GitHub Repository Events With Real-Time Notifications, Comprehensive Logging, And Production-Grade Deployment Capabilities.
- Real-Time GitHub Tracking: Monitor Push Events, Pull Requests, Issues, and Releases
- Telegram Notifications: Beautiful, Formatted Messages With Emojis And Developer Branding
- Webhook Security: HMAC Signature Verification For GitHub Webhooks
- Database Integration: MySQL With Connection Pooling For Reliable Data Storage
- Comprehensive Logging: Structured Logging With File Rotation and Multiple Log Levels
- Health Monitoring: Built-In Health Checks and Monitoring Endpoints
- Docker Support: Containerized Deployment With Multi-Stage Builds
- Coolify Deployment: One-Click Deployment With Coolify Platform
- Environment Configuration: Secure Configuration Management Via Environment Variables
- Error Handling: Robust Error Handling With Graceful Degradation
- Python 3.11+
- MySQL 8.0+
- Telegram Bot Token (From @BotFather)
- GitHub OAuth App Credentials
-
Clone The Repository
git clone https://github.com/i8o8i-Developer/GitTracker_Bot.git cd GitTracker_Bot -
Create Environment File
cp .env.example .env # Edit .env with your configuration -
Install Dependencies
pip install -r Requirements.txt
-
Setup Database
mysql -u root -p < Database.sql -
Run The Bot
python Bot.py
# Build The Image
docker build -t gittracker-bot .
# Run With Docker Compose (If You Have docker-compose.yml)
docker-compose up -d- Connect Your Repository To Coolify
- Use The Provided
coolify.yamlConfiguration - Set Environment Variables In Coolify Dashboard
- Deploy!
| Variable | Description | Required | Default |
|---|---|---|---|
TELEGRAM_TOKEN |
Telegram Bot Token From BotFather | β | - |
DB_HOST |
MySQL Database Host | β | 127.0.0.1 |
DB_PORT |
MySQL Database Port | β | 3306 |
DB_NAME |
MySQL Database Name | β | Tracer_Bot |
DB_USER |
MySQL Database User | β | root |
DB_PASSWORD |
MySQL Database Password | β | "" |
GITHUB_CLIENT_ID |
GitHub OAuth App Client ID | β | - |
GITHUB_CLIENT_SECRET |
GitHub OAuth App Client Secret | β | - |
GITHUB_WEBHOOK_SECRET |
GitHub Webhook Secret For Signature Verification | β | - |
WEBHOOK_URL |
Public URL For Webhooks | β | - |
SERVER_HOST |
Server Bind Host | β | 0.0.0.0 |
SERVER_PORT |
Server Bind Port | β | 5000 |
DEBUG |
Enable Debug Mode | β | false |
LOG_LEVEL |
Logging Level (DEBUG, INFO, WARNING, ERROR) | β | INFO |
The Bot Uses The Following Main Tables:
Users: Telegram User InformationRepositories: Tracked GitHub RepositoriesEvents: GitHub Webhook Events Log
/start- Initialize The Bot And Get Welcome Message/help- Show Available Commands/track <repo>- Start Tracking A GitHub Repository/untrack <repo>- Stop Tracking A Repository/list- List All Tracked Repositories/status- Show Bot Status and Statistics
Set Up GitHub Webhooks For Your Repositories:
- Go To Repository Settings β Webhooks
- Add Webhook URL:
https://your-domain.com/webhook - Content Type:
application/json - Secret: Your Webhook Secret
- Events: Push, Pull Request, Issues, Releases
GitTracker_Bot/
βββ Bot.py # Main Application File
βββ Config.py # Configuration Management
βββ DataBase.py # Database Operations
βββ Logging_Config.py # Logging Configuration
βββ Requirements.txt # Python Dependencies
βββ Database.sql # Database Schema
βββ Dockerfile # Docker Configuration
βββ .env.example # Environment Variables Template
βββ README.md # Project Documentation
βββ Logs/ # Application Logs (Created At Runtime)
- Type Hints: Full Type Annotation Support
- Error Handling: Comprehensive Exception Handling
- Logging: Structured Logging With Multiple Levels
- Security: Input Validation And Secure Practices
# Run Tests (When Implemented)
python -m pytest tests/
# Check Code Quality
python -m flake8
python -m mypy- Fork The Repository
- Create A Feature Branch (
git checkout -b feature/amazing-feature) - Commit Your Changes (
git commit -m 'Add Amazing Feature') - Push To The Branch (
git push origin feature/amazing-feature) - Open A Pull Request
The Application Provides Health Check Endpoints:
GET /health- General Health StatusGET /health/db- Database Connectivity CheckGET /health/telegram- Telegram Bot Connectivity Check
Logs Are Written To:
- Console (For Development)
logs/bot.log(Rotating File Logs)- Structured JSON Format For Production Monitoring
- Import Your Repository Into Coolify
- Use The Provided
coolify.yamlConfiguration - Configure Environment Variables
- Deploy With One Click
# Build Image
docker build -t gittracker-bot .
# Run Container
docker run -d \
--name gittracker-bot \
-p 5000:5000 \
-e TELEGRAM_TOKEN=your_token \
-e DB_HOST=your_db_host \
gittracker-bot- Set Up MySQL Database
- Configure Environment Variables
- Install Dependencies:
pip install -r Requirements.txt - Run:
python Bot.py
- Webhook Verification: HMAC Signature Validation
- Input Sanitization: All User Inputs Are Validated
- Secure Configuration: Sensitive Data Via Environment Variables
- Database Security: Prepared Statements And Connection Pooling
- Logging Security: No Sensitive Data In Logs
This Project Is Licensed Under The MIT License - See The LICENSE File For Details.
I8O8I DEVELOPER
- Telegram: @I8O8I_Developer
- GitHub: i8o8i-Developer
Made With β€οΈ By I8O8I DEVELOPER
Now You Can Do Your Edits And Changes In New Branch Named Developement