**ACLs (Access Control Lists):** - Ajout du type AclConfig dans sources/event.v (allowed_ips CIDR + allowed_tokens) - Chaque source webhook (Gitea, Uptime Kuma, Cron, Generic) supporte les ACLs - Validation IP via X-Forwarded-For / X-Real-IP avant HMAC - Validation Bearer token via Authorization header - Tests: 7 tests ACL (IP exact, CIDR, parse IPv4, ACL vide, IP+token combiné) **Plugin system:** - sources/plugin.v: runner exécutable externe, stdout JSON → Event - Exit 0 = publish, exit ≠ 0 = skip. Timeout configurable - Plugin loop dans server.v (goroutine, toutes les 60s) - Example: scripts/example-plugin-disk.sh (vérifie espace disque) **Docs:** - README.md: ajout source Plugin + section Features complète - ARCHITECTURE.md: flux Plugin, flux ACL, endpoints /metrics /api/silence - ROADMAP.md: Phase 5 → 8/8 complet, ajout v0.6.0 - ntfy-bridge.example.yaml: sections ACLs et Plugins commentées - Version bump: 0.5.0 → 0.6.0
This commit is contained in:
@@ -1,76 +1,90 @@
|
||||
# ntfy-bridge
|
||||
|
||||
Hub central de notifications pour homelab — agrège des sources multiples (Gitea, Docker, Uptime Kuma, health checks HTTP, scripts cron) et les transforme en notifications [Ntfy](https://ntfy.sh/) intelligentes, formatées, avec priorités et contexte.
|
||||
|
||||
```
|
||||
┌─────────────────┐
|
||||
│ Gitea webhook │──┐
|
||||
├─────────────────┤ │
|
||||
│ Uptime Kuma │──┤
|
||||
├─────────────────┤ │ ┌──────────────┐ ┌───────────┐ ┌──────────────┐
|
||||
│ Docker events │──┤────→│ ntfy-bridge │─────→│ Ntfy Srv │─────→│ Ton phone │
|
||||
├─────────────────┤ │ └──────────────┘ └───────────┘ └──────────────┘
|
||||
│ HTTP health │──┤
|
||||
├─────────────────┤ │
|
||||
│ Scripts cron │──┘
|
||||
└─────────────────┘
|
||||
```
|
||||
|
||||
## Pourquoi ntfy-bridge ?
|
||||
|
||||
Dans un homelab avec 8+ hôtes Docker, Gitea, Uptime Kuma et des dizaines de services, les alertes arrivent de partout. `ntfy-bridge` centralise tout dans une seule file de notifications intelligentes — avec le bon niveau de priorité, le bon format, et le bon topic Ntfy.
|
||||
|
||||
| Sans ntfy-bridge | Avec ntfy-bridge |
|
||||
|---|---|
|
||||
| Webhook Gitea → email (noyé) | Push = notif Ntfy formatée avec auteur, commit, message |
|
||||
| Uptime Kuma → alerte brute | "🚨 Gitea DOWN — 503 — since 14:32" avec priority=5 |
|
||||
| Container qui crashe → logs Docker | "🐳 flowdeck exited OOMKilled on docker-prod-1" |
|
||||
| Script cron → email perdu | Résumé quotidien disque à 9h dans ta poche |
|
||||
|
||||
## Quick Start
|
||||
|
||||
```bash
|
||||
# Installer V (si pas déjà fait)
|
||||
curl -s https://github.com/vlang/v/releases/latest/download/v_linux.zip -o /tmp/v.zip
|
||||
unzip /tmp/v.zip -d /tmp && sudo /tmp/v/v symlink
|
||||
|
||||
# Compiler
|
||||
git clone https://git.dracodev.net/bruno/ntfy-bridge.git
|
||||
cd ntfy-bridge
|
||||
v .
|
||||
|
||||
# Configurer
|
||||
cp ntfy-bridge.example.yaml ntfy-bridge.yaml
|
||||
vim ntfy-bridge.yaml
|
||||
|
||||
# Lancer
|
||||
./ntfy-bridge --config ntfy-bridge.yaml
|
||||
```
|
||||
|
||||
## Sources supportées
|
||||
|
||||
| Source | Type | Description |
|
||||
|--------|------|-------------|
|
||||
| **Gitea** | Webhook | Push, PR, issues, releases → notifs formatées |
|
||||
| **Uptime Kuma** | Webhook | Statut up/down avec priorité critique |
|
||||
| **Docker** | Socket | Container start/die/oom/health_status |
|
||||
| **HTTP Poll** | Polling | Health checks périodiques |
|
||||
| **Cron** | Webhook | Reçoit des notifs depuis des scripts shell |
|
||||
| **Generic** | Webhook | Endpoint passe-partout pour tout script custom |
|
||||
|
||||
## Exemple de config minimale
|
||||
|
||||
```yaml
|
||||
server:
|
||||
url: https://ntfy.dracodev.net
|
||||
listen: ":9090"
|
||||
|
||||
sources:
|
||||
gitea:
|
||||
- webhook_path: /webhooks/gitea
|
||||
topic: dev-notifs
|
||||
```
|
||||
|
||||
## Licence
|
||||
|
||||
MIT
|
||||
# ntfy-bridge
|
||||
|
||||
Hub central de notifications pour homelab — agrège des sources multiples (Gitea, Docker, Uptime Kuma, health checks HTTP, scripts cron) et les transforme en notifications [Ntfy](https://ntfy.sh/) intelligentes, formatées, avec priorités et contexte.
|
||||
|
||||
```
|
||||
┌─────────────────┐
|
||||
│ Gitea webhook │──┐
|
||||
├─────────────────┤ │
|
||||
│ Uptime Kuma │──┤
|
||||
├─────────────────┤ │ ┌──────────────┐ ┌───────────┐ ┌──────────────┐
|
||||
│ Docker events │──┤────→│ ntfy-bridge │─────→│ Ntfy Srv │─────→│ Ton phone │
|
||||
├─────────────────┤ │ └──────────────┘ └───────────┘ └──────────────┘
|
||||
│ HTTP health │──┤
|
||||
├─────────────────┤ │
|
||||
│ Scripts cron │──┘
|
||||
└─────────────────┘
|
||||
```
|
||||
|
||||
## Pourquoi ntfy-bridge ?
|
||||
|
||||
Dans un homelab avec 8+ hôtes Docker, Gitea, Uptime Kuma et des dizaines de services, les alertes arrivent de partout. `ntfy-bridge` centralise tout dans une seule file de notifications intelligentes — avec le bon niveau de priorité, le bon format, et le bon topic Ntfy.
|
||||
|
||||
| Sans ntfy-bridge | Avec ntfy-bridge |
|
||||
|---|---|
|
||||
| Webhook Gitea → email (noyé) | Push = notif Ntfy formatée avec auteur, commit, message |
|
||||
| Uptime Kuma → alerte brute | "🚨 Gitea DOWN — 503 — since 14:32" avec priority=5 |
|
||||
| Container qui crashe → logs Docker | "🐳 flowdeck exited OOMKilled on docker-prod-1" |
|
||||
| Script cron → email perdu | Résumé quotidien disque à 9h dans ta poche |
|
||||
|
||||
## Quick Start
|
||||
|
||||
```bash
|
||||
# Installer V (si pas déjà fait)
|
||||
curl -s https://github.com/vlang/v/releases/latest/download/v_linux.zip -o /tmp/v.zip
|
||||
unzip /tmp/v.zip -d /tmp && sudo /tmp/v/v symlink
|
||||
|
||||
# Compiler
|
||||
git clone https://git.dracodev.net/bruno/ntfy-bridge.git
|
||||
cd ntfy-bridge
|
||||
v .
|
||||
|
||||
# Configurer
|
||||
cp ntfy-bridge.example.yaml ntfy-bridge.yaml
|
||||
vim ntfy-bridge.yaml
|
||||
|
||||
# Lancer
|
||||
./ntfy-bridge --config ntfy-bridge.yaml
|
||||
```
|
||||
|
||||
## Sources supportées
|
||||
|
||||
| Source | Type | Description |
|
||||
|--------|------|-------------|
|
||||
| **Gitea** | Webhook | Push, PR, issues, releases → notifs formatées |
|
||||
| **Uptime Kuma** | Webhook | Statut up/down avec priorité critique |
|
||||
| **Docker** | Socket | Container start/die/oom/health_status |
|
||||
| **HTTP Poll** | Polling | Health checks périodiques |
|
||||
| **Cron** | Webhook | Reçoit des notifs depuis des scripts shell |
|
||||
| **Generic** | Webhook | Endpoint passe-partout pour tout script custom |
|
||||
| **Plugin** | Exec | Exécutable externe appelé périodiquement (bash, python, …) |
|
||||
|
||||
## Features
|
||||
|
||||
- **ACLs** — Restriction par IP (CIDR) ou Bearer token sur chaque webhook
|
||||
- **Plugins** — Scripts externes exécutés toutes les 60s, contrat JSON stdout
|
||||
- **Dashboard** — Interface web avec stats, statuts, historique temps réel
|
||||
- **Filtres** — Règles conditionnelles drop/set_priority/add_tag par source
|
||||
- **Actions Ntfy** — Boutons click, vues, broadcast intégrés
|
||||
- **Prometheus** — Endpoint `/metrics` pour Grafana
|
||||
- **Outgoing webhooks** — Forward vers Slack, Discord, JSON
|
||||
- **Silence rules** — Mute temporaire des notifs via API
|
||||
- **Grouping** — Regroupement intelligent des notifs identiques
|
||||
- **State persistence** — Sauvegarde de l'état up/down et silence sur disque
|
||||
|
||||
## Exemple de config minimale
|
||||
|
||||
```yaml
|
||||
server:
|
||||
url: https://ntfy.dracodev.net
|
||||
listen: ":9090"
|
||||
|
||||
sources:
|
||||
gitea:
|
||||
- webhook_path: /webhooks/gitea
|
||||
topic: dev-notifs
|
||||
```
|
||||
|
||||
## Licence
|
||||
|
||||
MIT
|
||||
|
||||
Reference in New Issue
Block a user