Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a3e10a68d3 | ||
|
|
3474b8207a | ||
|
|
b27c0fd496 | ||
|
|
de5c425f18 | ||
|
|
7ee766a1fe | ||
|
|
bcd3c3a9c7 | ||
|
|
4050872698 | ||
|
|
46bbf743ca | ||
|
|
ee4a19cc8a | ||
|
|
32bae70004 | ||
|
|
38ccde3f0b | ||
|
|
84c90e89ee | ||
|
|
c74ab7429a | ||
|
|
4964362ff4 | ||
|
|
b683aca227 |
+51
-35
@@ -16,65 +16,81 @@ jobs:
|
||||
|
||||
- name: Install V
|
||||
run: |
|
||||
git clone --depth 1 https://github.com/vlang/v /opt/v
|
||||
cd /opt/v && make
|
||||
ln -s /opt/v/v /usr/local/bin/v
|
||||
set -e
|
||||
mkdir -p $HOME/.local/bin
|
||||
echo "Trying to download V from GitHub..."
|
||||
mkdir -p /opt/v
|
||||
if curl -fsSL --connect-timeout 10 https://github.com/vlang/v/releases/latest/download/v_linux.zip -o /tmp/v.zip; then
|
||||
unzip -q /tmp/v.zip -d /opt/v
|
||||
# V binary may be at /opt/v/v or /opt/v/v/v depending on zip structure
|
||||
V_BIN=$(find /opt/v -name v -type f | head -1)
|
||||
if [ -n "$V_BIN" ]; then
|
||||
ln -sf "$V_BIN" /usr/local/bin/v 2>/dev/null || ln -sf "$V_BIN" $HOME/.local/bin/v
|
||||
fi
|
||||
else
|
||||
echo "GitHub unreachable — installing V from source (no submodules)..."
|
||||
git clone --depth 1 --single-branch --recurse-submodules=no https://github.com/vlang/v /opt/v 2>/dev/null || true
|
||||
if [ -f /opt/v/v ]; then
|
||||
ln -sf /opt/v/v $HOME/.local/bin/v
|
||||
else
|
||||
cd /opt/v && make without_tcc 2>/dev/null || make 2>/dev/null || true
|
||||
ln -sf /opt/v/v $HOME/.local/bin/v 2>/dev/null || true
|
||||
fi
|
||||
fi
|
||||
export PATH="$HOME/.local/bin:$PATH"
|
||||
echo "V version:" && v version
|
||||
|
||||
- name: Install cross-compilers
|
||||
run: |
|
||||
sudo apt-get update -qq
|
||||
sudo apt-get install -y -qq gcc-mingw-w64-x86-64 gcc-aarch64-linux-gnu
|
||||
|
||||
- name: Build Linux x86_64
|
||||
run: |
|
||||
export PATH="$HOME/.local/bin:$PATH"
|
||||
mkdir -p build
|
||||
v -prod -os linux -arch amd64 -o build/ntfy-bridge-linux-x86_64 .
|
||||
|
||||
- name: Build Linux arm64 (Raspberry Pi)
|
||||
run: v -prod -os linux -arch arm64 -o build/ntfy-bridge-linux-arm64 .
|
||||
run: |
|
||||
export PATH="$HOME/.local/bin:$PATH"
|
||||
v -prod -os linux -arch arm64 -o build/ntfy-bridge-linux-arm64 .
|
||||
|
||||
- name: Build Windows x86_64
|
||||
run: v -prod -os windows -arch amd64 -o build/ntfy-bridge-windows-x86_64.exe .
|
||||
run: |
|
||||
export PATH="$HOME/.local/bin:$PATH"
|
||||
v -prod -os windows -arch amd64 -o build/ntfy-bridge-windows-x86_64.exe .
|
||||
|
||||
- name: Test
|
||||
run: v test .
|
||||
run: |
|
||||
export PATH="$HOME/.local/bin:$PATH"
|
||||
v test .
|
||||
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: binaires
|
||||
path: build/*
|
||||
|
||||
- name: Publish Release (tags only)
|
||||
- name: Upload to Nexus raw repository (tags only)
|
||||
if: startsWith(github.ref, 'refs/tags/v')
|
||||
env:
|
||||
NEXUS_URL: ${{ secrets.NEXUS_URL }}
|
||||
NEXUS_USER: ${{ secrets.NEXUS_USER }}
|
||||
NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
VERSION=${GITHUB_REF#refs/tags/}
|
||||
API="${GITHUB_SERVER_URL}/api/v1/repos/${GITHUB_REPOSITORY}"
|
||||
echo "==> Creating release ${VERSION}..."
|
||||
|
||||
# Supprimer release existante (idempotent)
|
||||
EXISTING=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" "${API}/releases/tags/${VERSION}")
|
||||
EXISTING_ID=$(echo "$EXISTING" | grep -o '"id":[0-9]*' | head -1 | cut -d: -f2)
|
||||
if [ -n "$EXISTING_ID" ]; then
|
||||
echo " Deleting existing release #${EXISTING_ID}..."
|
||||
curl -sf -X DELETE -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" "${API}/releases/${EXISTING_ID}"
|
||||
fi
|
||||
|
||||
# Creer la release
|
||||
BODY="## ntfy-bridge ${VERSION}\n\nBinaires statiques — zero dependance.\n\n### Linux\n- \`ntfy-bridge-linux-x86_64\` (x86_64)\n- \`ntfy-bridge-linux-arm64\` (Raspberry Pi)\n\n### Windows\n- \`ntfy-bridge-windows-x86_64.exe\`"
|
||||
RESP=$(curl -sf -X POST \
|
||||
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"tag_name\":\"${VERSION}\",\"name\":\"${VERSION}\",\"body\":\"${BODY}\",\"draft\":false,\"prerelease\":false}" \
|
||||
"${API}/releases")
|
||||
RELEASE_ID=$(echo "$RESP" | grep -o '"id":[0-9]*' | head -1 | cut -d: -f2)
|
||||
echo "Release ID: ${RELEASE_ID}"
|
||||
|
||||
# Uploader chaque binaire
|
||||
for FILE in build/ntfy-bridge-*; do
|
||||
[ -f "$FILE" ] || continue
|
||||
FNAME=$(basename "$FILE")
|
||||
echo " Uploading ${FNAME}..."
|
||||
curl -sf -X POST \
|
||||
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
|
||||
echo "==> Uploading ${FNAME} to Nexus (${VERSION})..."
|
||||
curl -sf -u "${NEXUS_USER}:${NEXUS_PASSWORD}" \
|
||||
-X PUT \
|
||||
-H "Content-Type: application/octet-stream" \
|
||||
--data-binary "@${FILE}" \
|
||||
"${API}/releases/${RELEASE_ID}/assets?name=${FNAME}"
|
||||
"${NEXUS_URL}/repository/raw-hosted/ntfy-bridge/${VERSION}/${FNAME}"
|
||||
echo " OK"
|
||||
done
|
||||
|
||||
echo "==> Release ${VERSION} complete!"
|
||||
|
||||
|
||||
@@ -27,24 +27,183 @@ 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
|
||||
|
||||
Les binaires pré-compilés sont disponibles sur le dépôt Nexus :
|
||||
|
||||
```
|
||||
https://nexus.dracodev.net/repository/raw-hosted/ntfy-bridge/{VERSION}/
|
||||
```
|
||||
|
||||
Remplacer `{VERSION}` par la version souhaitée (ex: `v0.7.0`).
|
||||
Chaque release contient trois binaires statiques — **zéro dépendance** :
|
||||
|
||||
| Fichier | Plateforme |
|
||||
|---------|-----------|
|
||||
| `ntfy-bridge-linux-x86_64` | Linux 64-bit (Intel/AMD) |
|
||||
| `ntfy-bridge-linux-arm64` | Linux ARM64 (Raspberry Pi 3/4/5) |
|
||||
| `ntfy-bridge-windows-x86_64.exe` | Windows 64-bit |
|
||||
|
||||
> 💡 **Pas besoin de V, Git, ni compilateur.** Les binaires sont compilés statiquement — un seul fichier, prêt à exécuter.
|
||||
|
||||
---
|
||||
|
||||
### Linux (x86_64)
|
||||
|
||||
#### Option A : Service système (recommandé)
|
||||
|
||||
```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
|
||||
# 1. Télécharger le binaire (remplacer v0.7.0 par la version désirée)
|
||||
sudo curl -fsSL -o /usr/local/bin/ntfy-bridge \
|
||||
https://nexus.dracodev.net/repository/raw-hosted/ntfy-bridge/v0.7.0/ntfy-bridge-linux-x86_64
|
||||
sudo chmod +x /usr/local/bin/ntfy-bridge
|
||||
|
||||
# Compiler
|
||||
git clone https://git.dracodev.net/bruno/ntfy-bridge.git
|
||||
cd ntfy-bridge
|
||||
v .
|
||||
# 2. Créer le répertoire de config et copier l'exemple
|
||||
sudo mkdir -p /etc/ntfy-bridge
|
||||
sudo curl -fsSL -o /etc/ntfy-bridge/ntfy-bridge.yaml \
|
||||
https://nexus.dracodev.net/repository/raw-hosted/ntfy-bridge/v0.7.0/ntfy-bridge.example.yaml
|
||||
sudo curl -fsSL -o /etc/ntfy-bridge/dashboard.html \
|
||||
https://nexus.dracodev.net/repository/raw-hosted/ntfy-bridge/v0.7.0/dashboard.html
|
||||
|
||||
# Configurer
|
||||
cp ntfy-bridge.example.yaml ntfy-bridge.yaml
|
||||
# 3. Éditer la configuration
|
||||
sudo vim /etc/ntfy-bridge/ntfy-bridge.yaml
|
||||
|
||||
# 4. Installer comme service systemd (ou openrc si détecté)
|
||||
sudo ntfy-bridge --install-service --config /etc/ntfy-bridge/ntfy-bridge.yaml
|
||||
|
||||
# 5. Vérifier
|
||||
curl http://localhost:9090/health
|
||||
```
|
||||
|
||||
**Commandes utiles :**
|
||||
```bash
|
||||
systemctl status ntfy-bridge # État du service
|
||||
systemctl restart ntfy-bridge # Redémarrer après modif de config
|
||||
journalctl -u ntfy-bridge -f # Logs en temps réel
|
||||
ntfy-bridge --uninstall-service # Désinstaller le service
|
||||
```
|
||||
|
||||
#### Option B : Docker
|
||||
|
||||
```bash
|
||||
# 1. Créer un dossier et générer la stack docker-compose
|
||||
mkdir -p /opt/ntfy-bridge && cd /opt/ntfy-bridge
|
||||
ntfy-bridge --install-docker .
|
||||
|
||||
# 2. Éditer la configuration
|
||||
vim ntfy-bridge.yaml
|
||||
|
||||
# Lancer
|
||||
./ntfy-bridge --config ntfy-bridge.yaml
|
||||
# 3. Démarrer
|
||||
docker compose up -d
|
||||
|
||||
# 4. Vérifier
|
||||
curl http://localhost:9090/health
|
||||
```
|
||||
|
||||
Ce que contient la stack Docker :
|
||||
- Le binaire exposé sur `127.0.0.1:9090`
|
||||
- `ntfy-bridge.yaml` monté en read-only dans `/etc/ntfy-bridge/`
|
||||
- `dashboard.html` monté automatiquement
|
||||
- Variables d'environnement `NTFY_TOKEN` et `NTFY_HMAC_SECRET`
|
||||
- Healthcheck intégré (`/health` toutes les 30s)
|
||||
- Redémarrage automatique (`restart: unless-stopped`)
|
||||
|
||||
---
|
||||
|
||||
### Raspberry Pi (ARM64)
|
||||
|
||||
Mêmes étapes que Linux, avec le binaire `linux-arm64` :
|
||||
|
||||
```bash
|
||||
# 1. Télécharger le binaire ARM64
|
||||
sudo curl -fsSL -o /usr/local/bin/ntfy-bridge \
|
||||
https://nexus.dracodev.net/repository/raw-hosted/ntfy-bridge/v0.7.0/ntfy-bridge-linux-arm64
|
||||
sudo chmod +x /usr/local/bin/ntfy-bridge
|
||||
|
||||
# 2. Récupérer la config et le dashboard
|
||||
sudo mkdir -p /etc/ntfy-bridge
|
||||
sudo curl -fsSL -o /etc/ntfy-bridge/ntfy-bridge.yaml \
|
||||
https://nexus.dracodev.net/repository/raw-hosted/ntfy-bridge/v0.7.0/ntfy-bridge.example.yaml
|
||||
sudo curl -fsSL -o /etc/ntfy-bridge/dashboard.html \
|
||||
https://nexus.dracodev.net/repository/raw-hosted/ntfy-bridge/v0.7.0/dashboard.html
|
||||
|
||||
# 3. Éditer la config
|
||||
sudo vim /etc/ntfy-bridge/ntfy-bridge.yaml
|
||||
|
||||
# 4. Installer le service
|
||||
sudo ntfy-bridge --install-service --config /etc/ntfy-bridge/ntfy-bridge.yaml
|
||||
|
||||
# 5. Vérifier
|
||||
curl http://localhost:9090/health
|
||||
```
|
||||
|
||||
**Docker sur Raspberry Pi :** identique à l'option B Linux — le binaire est déjà dans l'image Docker, pas besoin de le télécharger séparément. Utiliser `ntfy-bridge --install-docker .` pour générer la stack.
|
||||
|
||||
---
|
||||
|
||||
### Windows
|
||||
|
||||
```powershell
|
||||
# 1. Créer le dossier d'installation (PowerShell administrateur)
|
||||
New-Item -ItemType Directory -Force -Path "$env:ProgramFiles\ntfy-bridge"
|
||||
|
||||
# 2. Télécharger le binaire Windows
|
||||
Invoke-WebRequest -Uri "https://nexus.dracodev.net/repository/raw-hosted/ntfy-bridge/v0.7.0/ntfy-bridge-windows-x86_64.exe" `
|
||||
-OutFile "$env:ProgramFiles\ntfy-bridge\ntfy-bridge.exe"
|
||||
|
||||
# 3. Télécharger la config et le dashboard
|
||||
Invoke-WebRequest -Uri "https://nexus.dracodev.net/repository/raw-hosted/ntfy-bridge/v0.7.0/ntfy-bridge.example.yaml" `
|
||||
-OutFile "$env:ProgramFiles\ntfy-bridge\ntfy-bridge.yaml"
|
||||
Invoke-WebRequest -Uri "https://nexus.dracodev.net/repository/raw-hosted/ntfy-bridge/v0.7.0/dashboard.html" `
|
||||
-OutFile "$env:ProgramFiles\ntfy-bridge\dashboard.html"
|
||||
|
||||
# 4. Éditer la configuration (dans le Bloc-notes)
|
||||
notepad "$env:ProgramFiles\ntfy-bridge\ntfy-bridge.yaml"
|
||||
|
||||
# 5. Installer NSSM (requis pour le service Windows)
|
||||
# Télécharger depuis https://nssm.cc/download
|
||||
# ou avec scoop : scoop install nssm
|
||||
# Placer nssm.exe dans le PATH ou dans $env:ProgramFiles\ntfy-bridge\
|
||||
|
||||
# 6. Installer comme service Windows
|
||||
& "$env:ProgramFiles\ntfy-bridge\ntfy-bridge.exe" --install-service `
|
||||
--config "$env:ProgramFiles\ntfy-bridge\ntfy-bridge.yaml"
|
||||
|
||||
# 7. Vérifier
|
||||
Invoke-WebRequest -Uri http://localhost:9090/health
|
||||
```
|
||||
|
||||
**Commandes utiles (PowerShell) :**
|
||||
```powershell
|
||||
nssm status ntfy-bridge # État du service
|
||||
nssm restart ntfy-bridge # Redémarrer
|
||||
nssm stop ntfy-bridge # Arrêter
|
||||
nssm start ntfy-bridge # Démarrer
|
||||
nssm remove ntfy-bridge confirm # Désinstaller le service
|
||||
```
|
||||
|
||||
Logs du service : `C:\ProgramData\ntfy-bridge\service.log`
|
||||
|
||||
---
|
||||
|
||||
### Mise à jour
|
||||
|
||||
Pour mettre à jour vers une nouvelle version, remplacer le binaire et redémarrer :
|
||||
|
||||
```bash
|
||||
# Linux / Raspberry Pi
|
||||
sudo curl -fsSL -o /usr/local/bin/ntfy-bridge \
|
||||
https://nexus.dracodev.net/repository/raw-hosted/ntfy-bridge/v0.8.0/ntfy-bridge-linux-x86_64
|
||||
sudo chmod +x /usr/local/bin/ntfy-bridge
|
||||
sudo systemctl restart ntfy-bridge
|
||||
```
|
||||
|
||||
```powershell
|
||||
# Windows (PowerShell administrateur)
|
||||
nssm stop ntfy-bridge
|
||||
Invoke-WebRequest -Uri "https://nexus.dracodev.net/repository/raw-hosted/ntfy-bridge/v0.8.0/ntfy-bridge-windows-x86_64.exe" `
|
||||
-OutFile "$env:ProgramFiles\ntfy-bridge\ntfy-bridge.exe"
|
||||
nssm start ntfy-bridge
|
||||
```
|
||||
|
||||
## Sources supportées
|
||||
|
||||
+21
-8
@@ -252,15 +252,15 @@ ntfy-bridge/
|
||||
// v.mod
|
||||
Module {
|
||||
name: 'ntfy-bridge'
|
||||
version: '0.1.0'
|
||||
dependencies: [] // zéro dépendance externe
|
||||
version: '0.7.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
|
||||
|
||||
@@ -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
|
||||
|
||||
+2
-1
@@ -174,4 +174,5 @@ Ces features ont été ajoutées en cours de route :
|
||||
| v0.4.0 | ✅ Terminé | Templates, silence, grouping, HMAC global, CI/CD |
|
||||
| v0.4.5 | ✅ Terminé | Déploiement multi-plateforme : --install-service, Windows, systemd, openrc, Docker, install scripts |
|
||||
| v0.5.0 | ✅ Terminé | Dashboard, filtres, actions Ntfy, Prometheus, outgoing webhooks, state file |
|
||||
| v0.6.0 | ✅ Terminé | ACLs multi-utilisateurs, plugin system (scripts externes) |
|
||||
| v0.6.0 | ✅ Terminé | ACLs multi-utilisateurs, plugin system (scripts externes) |
|
||||
| v0.7.0 | ✅ Terminé | CI cross-compilation (Windows ARM64, MinGW), fixes compatibilité V latest |
|
||||
|
||||
@@ -3,7 +3,7 @@ module main
|
||||
import os
|
||||
import flag
|
||||
|
||||
const version = '0.6.0'
|
||||
const version = '0.7.0'
|
||||
const author = 'Bruno Charest'
|
||||
|
||||
fn main() {
|
||||
|
||||
Reference in New Issue
Block a user