Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
de5c425f18 | ||
|
|
7ee766a1fe | ||
|
|
bcd3c3a9c7 | ||
|
|
4050872698 | ||
|
|
46bbf743ca | ||
|
|
ee4a19cc8a | ||
|
|
32bae70004 | ||
|
|
38ccde3f0b | ||
|
|
84c90e89ee | ||
|
|
c74ab7429a | ||
|
|
4964362ff4 | ||
|
|
b683aca227 |
+67
-11
@@ -16,49 +16,105 @@ 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: 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/}
|
||||
for FILE in build/ntfy-bridge-*; do
|
||||
[ -f "$FILE" ] || continue
|
||||
FNAME=$(basename "$FILE")
|
||||
echo "==> Uploading ${FNAME} to Nexus (${VERSION})..."
|
||||
curl -sf -u "${NEXUS_USER}:${NEXUS_PASSWORD}" \
|
||||
-X PUT \
|
||||
-H "Content-Type: application/octet-stream" \
|
||||
--data-binary "@${FILE}" \
|
||||
"${NEXUS_URL}/repository/raw-hosted/ntfy-bridge/${VERSION}/${FNAME}"
|
||||
echo " OK"
|
||||
done
|
||||
|
||||
- name: Publish Release (tags only)
|
||||
if: startsWith(github.ref, 'refs/tags/v')
|
||||
env:
|
||||
RELEASE_TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
||||
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=$(curl -sf -H "Authorization: token ${RELEASE_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}"
|
||||
curl -sf -X DELETE -H "Authorization: token ${RELEASE_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 "Authorization: token ${RELEASE_TOKEN}" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"tag_name\":\"${VERSION}\",\"name\":\"${VERSION}\",\"body\":\"${BODY}\",\"draft\":false,\"prerelease\":false}" \
|
||||
"${API}/releases")
|
||||
@@ -71,7 +127,7 @@ jobs:
|
||||
FNAME=$(basename "$FILE")
|
||||
echo " Uploading ${FNAME}..."
|
||||
curl -sf -X POST \
|
||||
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
|
||||
-H "Authorization: token ${RELEASE_TOKEN}" \
|
||||
-H "Content-Type: application/octet-stream" \
|
||||
--data-binary "@${FILE}" \
|
||||
"${API}/releases/${RELEASE_ID}/assets?name=${FNAME}"
|
||||
|
||||
@@ -27,17 +27,79 @@ 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
|
||||
# Installer V (si pas déjà fait)
|
||||
# 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`)
|
||||
|
||||
### Raspberry Pi / ARM64
|
||||
|
||||
```bash
|
||||
# Option A : Binaire pré-compilé (CI) — pas besoin de V
|
||||
# Télécharge l'artifact "ntfy-bridge-linux-arm64" depuis Gitea Actions :
|
||||
# https://git.dracodev.net/bruno/ntfy-bridge/actions
|
||||
# ou via API :
|
||||
curl -s -o ntfy-bridge "https://git.dracodev.net/api/v1/repos/bruno/ntfy-bridge/actions/artifacts/latest/zip?name=binaires"
|
||||
unzip binaires.zip ntfy-bridge-linux-arm64
|
||||
mv ntfy-bridge-linux-arm64 ntfy-bridge
|
||||
chmod +x ntfy-bridge
|
||||
|
||||
# Option B : Compiler soi-même (nécessite V)
|
||||
# Installer V sur Debian 12 / Raspberry Pi OS (aarch64) :
|
||||
git clone --depth 1 https://github.com/vlang/v ~/v
|
||||
cd ~/v && make
|
||||
sudo ln -sf ~/v/v /usr/local/bin/v
|
||||
|
||||
# Compiler ntfy-bridge
|
||||
git clone https://git.dracodev.net/bruno/ntfy-bridge.git
|
||||
cd ntfy-bridge
|
||||
v -prod -o ntfy-bridge .
|
||||
|
||||
# Lancer
|
||||
cp ntfy-bridge.example.yaml ntfy-bridge.yaml
|
||||
vim ntfy-bridge.yaml
|
||||
./ntfy-bridge --config ntfy-bridge.yaml
|
||||
```
|
||||
|
||||
### Compilation manuelle
|
||||
|
||||
```bash
|
||||
# Installer V sur Linux x86_64 (Debian/Ubuntu)
|
||||
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 .
|
||||
v -prod .
|
||||
|
||||
# Configurer
|
||||
cp ntfy-bridge.example.yaml ntfy-bridge.yaml
|
||||
|
||||
+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.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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user