diff --git a/README.md b/README.md index 34ac435..ed281c7 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,40 @@ Dans un homelab avec 8+ hôtes Docker, Gitea, Uptime Kuma et des dizaines de ser | 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 +## Installation + +### Docker (recommandé) + +```bash +# 1. Cloner le repo +git clone https://git.dracodev.net/bruno/ntfy-bridge.git +cd ntfy-bridge + +# 2. Compiler le binaire Linux (cross-compilation depuis Windows/Mac) +v -os linux -prod -o ntfy-bridge . + +# Ou compiler directement sur Linux : +# v -prod -o ntfy-bridge . + +# 3. Configurer +cp ntfy-bridge.example.yaml ntfy-bridge.yaml +vim ntfy-bridge.yaml + +# 4. Lancer avec docker compose +docker compose up -d + +# 5. Vérifier +curl http://localhost:9090/health +``` + +Le `docker-compose.yml` inclus monte : +- `ntfy-bridge.yaml` → `/etc/ntfy-bridge/ntfy-bridge.yaml` (read-only) +- `dashboard.html` → `/etc/ntfy-bridge/dashboard.html` (read-only) +- Port `9090` exposé sur localhost +- Variables d'environnement `NTFY_TOKEN` et `NTFY_HMAC_SECRET` +- Healthcheck intégré (`/health`) + +### Compilation manuelle ```bash # Installer V (si pas déjà fait) @@ -37,7 +70,7 @@ 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 . +v -prod . # Configurer cp ntfy-bridge.example.yaml ntfy-bridge.yaml diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md index 811fb17..4cba8ea 100644 --- a/docs/ARCHITECTURE.md +++ b/docs/ARCHITECTURE.md @@ -252,15 +252,15 @@ ntfy-bridge/ // v.mod Module { name: 'ntfy-bridge' - version: '0.1.0' - dependencies: [] // zéro dépendance externe + version: '0.6.0' + dependencies: ['https://github.com/vlang/yaml'] // parsing YAML } ``` -Le projet utilise **uniquement la stdlib V** : +Le projet utilise la stdlib V + le module `yaml` : - `net.http` — serveur HTTP + client Ntfy - `x.json2` — parsing JSON -- `yaml` — parsing YAML +- `yaml` — parsing YAML (module externe vlang/yaml) - `crypto.hmac`, `crypto.sha256`, `encoding.hex` — validation HMAC - `time`, `os`, `flag` — utilitaires - `net.unix` — socket Docker (Linux/macOS seulement, via `$if`) @@ -300,13 +300,26 @@ WantedBy=multi-user.target ``` ### Option B : Conteneur Docker + +```bash +# Quick start avec docker compose +cp ntfy-bridge.example.yaml ntfy-bridge.yaml +vim ntfy-bridge.yaml +docker compose up -d +``` + ```dockerfile -FROM alpine:latest -COPY ntfy-bridge /usr/local/bin/ -COPY ntfy-bridge.yaml dashboard.html /etc/ntfy-bridge/ +# Dockerfile (build hôte + runtime Alpine minimal) +FROM alpine:3.20 +RUN apk add --no-cache ca-certificates tzdata curl +COPY ntfy-bridge /usr/local/bin/ntfy-bridge +RUN chmod +x /usr/local/bin/ntfy-bridge WORKDIR /etc/ntfy-bridge EXPOSE 9090 -CMD ["/usr/local/bin/ntfy-bridge", "--quiet", "--config", "/etc/ntfy-bridge/ntfy-bridge.yaml"] +HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \ + CMD wget --no-verbose --tries=1 --spider http://localhost:9090/health || exit 1 +ENTRYPOINT ["/usr/local/bin/ntfy-bridge"] +CMD ["--quiet", "--config", "/etc/ntfy-bridge/ntfy-bridge.yaml"] ``` ### Option C : Compilation croisée diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md index 924f4eb..82f2423 100644 --- a/docs/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -3,7 +3,7 @@ ## Stack - **Langage** : [V](https://vlang.io/) — compilé, rapide, syntaxe proche de Go -- **Dépendances** : Zéro dépendance externe (stdlib V uniquement) +- **Dépendances** : Module `yaml` (vlang/yaml) pour le parsing YAML, stdlib V pour le reste - **Build** : `v .` → binaire natif statique ## Setup développement diff --git a/v.mod b/v.mod index 82cf3c4..6806ca8 100644 --- a/v.mod +++ b/v.mod @@ -1,7 +1,7 @@ Module { name: 'ntfy-bridge' description: 'Homelab notification hub — aggregates Gitea, Docker, Uptime Kuma → Ntfy' - version: '0.5.0' + version: '0.6.0' license: 'MIT' dependencies: ['https://github.com/vlang/yaml'] subdirs: ['sources']