Unified log levels

- Logger doesn't start with log level DEBUG by default, instead reads a environment variable
- Secret handler raises exceptions instead of using the module os to exit
- Added extensive debug logging
- Notifications: Added timestamp and category
This commit is contained in:
florian committed 2025-10-18 20:59:50 +02:00
1 parent 3a722eca04
commit f2ffe394ad
9 files changed
+249 -99

No files matched your search

+88 -2
View File
@@ -1,4 +1,90 @@
# docker-repository-query
# 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.
FastAPI service with endpoints that check for updated versions of two applications so far, Suwayomi and Pi-hole.
## 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`