# Docker Repository Query Service A FastAPI-based service that monitors Docker repositories (Docker Hub and GitHub Container Registry) for new image versions and sends notifications when updates are detected. ## Features - **Multi-Registry Support**: Queries both Docker Hub and GitHub Container Registry (GHCR) - **Version Tracking**: Maintains local state of latest known versions in MySQL - **Automatic Notifications**: Sends alerts when new versions are detected - **Prometheus Metrics**: Built-in request monitoring - **Scheduled Queries**: Designed to be called by external schedulers (cron, Kubernetes CronJob, etc.) ## Use Case This service is ideal for: - Monitoring self-hosted applications for updates - Automating update notifications for Docker-based infrastructure - Tracking specific image tags across different registries ## Prerequisites - Python 3.8+ - MySQL database - Required Python packages (see Installation) ## Installation ```bash pip install -r requirements.txt ``` ## Running the Application ```bash python main.py ``` This starts two servers: - **Main API**: `http://0.0.0.0:5000` - **Metrics Server**: `http://0.0.0.0:9000` ## API Endpoints ### Health Check ``` GET /health ``` Returns 200 status code if the service is running. ### Check Suwayomi Updates ``` GET /suwayomi ``` Queries GitHub Container Registry for the latest stable version of Suwayomi/Tachidesk. **Response:** - `200 OK`: New version detected and notification sent - `204 No Content`: No new version available - `500 Internal Server Error`: Query or database error **Registry:** GitHub Container Registry (ghcr.io) **Repository:** Suwayomi/tachidesk **Tag:** stable ### Check Pi-hole Updates ``` GET /pihole ``` Queries Docker Hub for the latest version of Pi-hole. **Response:** - `200 OK`: New version detected and notification sent - `204 No Content`: No new version available - `500 Internal Server Error`: Query or database error **Registry:** Docker Hub **Repository:** pihole/pihole **Tag:** latest ## Monitoring ### Prometheus Metrics Prometheus metrics are exposed on port 9000 and include: - HTTP request counters by method, path, and status code - Success/failure rates for version checks Access metrics at: `http://0.0.0.0:9000/metrics`