- service.v: --install-service / --uninstall-service / --service-status Windows (sc.exe SCM), Linux systemd, Linux openrc — auto-détection OS - main.v: nouveaux flags service, help mis à jour - Dockerfile: multi-stage (V from source → alpine:3.20 minimal) - docker-compose.yml: prêt à l'emploi avec healthcheck - scripts/install.sh: one-liner Linux (detect OS/arch, build, install) - scripts/install.ps1: one-liner Windows PowerShell Docs: ROADMAP Phase 4.5 marqué DONE, version 0.4.5
This commit is contained in:
@@ -0,0 +1,65 @@
|
||||
# ntfy-bridge Windows installer
|
||||
# Run: powershell -ExecutionPolicy Bypass -File install.ps1
|
||||
|
||||
param(
|
||||
[string]$ConfigPath = "ntfy-bridge.yaml"
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
Write-Host "╔══════════════════════════════════════════════════════════════╗" -ForegroundColor Cyan
|
||||
Write-Host "║ ntfy-bridge Windows installer ║" -ForegroundColor Cyan
|
||||
Write-Host "╚══════════════════════════════════════════════════════════════╝" -ForegroundColor Cyan
|
||||
Write-Host ""
|
||||
|
||||
# Check if V is installed
|
||||
$v = Get-Command v -ErrorAction SilentlyContinue
|
||||
if (-not $v) {
|
||||
Write-Host "V compiler not found. Downloading..."
|
||||
|
||||
# Download V weekly build
|
||||
$vUrl = "https://github.com/vlang/v/releases/download/weekly.2024.32/v_windows.zip"
|
||||
$vZip = "$env:TEMP\v_windows.zip"
|
||||
$vDir = "$env:LOCALAPPDATA\v"
|
||||
|
||||
Invoke-WebRequest -Uri $vUrl -OutFile $vZip
|
||||
Expand-Archive -Path $vZip -DestinationPath $vDir -Force
|
||||
Remove-Item $vZip
|
||||
|
||||
$env:PATH = "$vDir\v;$env:PATH"
|
||||
Write-Host "V installed to $vDir"
|
||||
}
|
||||
|
||||
# Build
|
||||
Write-Host "Building ntfy-bridge..."
|
||||
v -prod -o ntfy-bridge.exe .
|
||||
|
||||
# Copy to a permanent location
|
||||
$installDir = "$env:ProgramFiles\ntfy-bridge"
|
||||
New-Item -ItemType Directory -Force -Path $installDir | Out-Null
|
||||
Copy-Item -Force ntfy-bridge.exe $installDir\
|
||||
Copy-Item -Force dashboard.html $installDir\
|
||||
|
||||
# Copy example config if not exists
|
||||
if (-not (Test-Path "$installDir\ntfy-bridge.yaml")) {
|
||||
Copy-Item ntfy-bridge.example.yaml "$installDir\ntfy-bridge.yaml"
|
||||
Write-Host ""
|
||||
Write-Host " ⚠️ Edit $installDir\ntfy-bridge.yaml to configure your sources!" -ForegroundColor Yellow
|
||||
}
|
||||
|
||||
# Install as Windows service
|
||||
Write-Host "Installing as Windows service..."
|
||||
& "$installDir\ntfy-bridge.exe" --install-service --config "$installDir\ntfy-bridge.yaml" 2>&1 | Out-Null
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "Done! ntfy-bridge is installed and running as a Windows service." -ForegroundColor Green
|
||||
Write-Host ""
|
||||
Write-Host " Install dir: $installDir"
|
||||
Write-Host " Config: $installDir\ntfy-bridge.yaml"
|
||||
Write-Host " Dashboard: http://localhost:9090/"
|
||||
Write-Host " Health: http://localhost:9090/health"
|
||||
Write-Host ""
|
||||
Write-Host " Service commands:"
|
||||
Write-Host " sc query ntfy-bridge"
|
||||
Write-Host " sc stop ntfy-bridge"
|
||||
Write-Host " sc start ntfy-bridge"
|
||||
@@ -0,0 +1,98 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
# ntfy-bridge one-liner installer
|
||||
# Usage: curl -fsSL https://git.dracodev.net/bruno/ntfy-bridge/raw/branch/main/scripts/install.sh | bash
|
||||
|
||||
BINARY="ntfy-bridge"
|
||||
REPO="https://git.dracodev.net/bruno/ntfy-bridge"
|
||||
INSTALL_DIR="/usr/local/bin"
|
||||
CONFIG_DIR="/etc/ntfy-bridge"
|
||||
|
||||
# Detect OS and architecture
|
||||
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
|
||||
ARCH=$(uname -m)
|
||||
|
||||
case "$ARCH" in
|
||||
x86_64|amd64) ARCH="amd64" ;;
|
||||
aarch64|arm64) ARCH="arm64" ;;
|
||||
armv7l) ARCH="armv7" ;;
|
||||
*) echo "Unsupported architecture: $ARCH"; exit 1 ;;
|
||||
esac
|
||||
|
||||
echo "╔══════════════════════════════════════════════════════════════╗"
|
||||
echo "║ ntfy-bridge installer ║"
|
||||
echo "╚══════════════════════════════════════════════════════════════╝"
|
||||
echo ""
|
||||
echo " OS: $OS"
|
||||
echo " Arch: $ARCH"
|
||||
echo ""
|
||||
|
||||
# Check for required tools
|
||||
if ! command -v git >/dev/null 2>&1 && ! command -v curl >/dev/null 2>&1; then
|
||||
echo "Error: git or curl is required. Install one of them."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! command -v make >/dev/null 2>&1 || ! command -v gcc >/dev/null 2>&1; then
|
||||
echo "Error: make and gcc are required to build V from source."
|
||||
echo " Debian/Ubuntu: sudo apt install build-essential git"
|
||||
echo " Alpine: sudo apk add gcc musl-dev make git"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Build from source
|
||||
TMPDIR=$(mktemp -d)
|
||||
cd "$TMPDIR"
|
||||
|
||||
echo "Cloning ntfy-bridge..."
|
||||
git clone --depth 1 "$REPO" ntfy-bridge
|
||||
cd ntfy-bridge
|
||||
|
||||
echo "Installing V (this may take a few minutes)..."
|
||||
if [ ! -d /opt/v ]; then
|
||||
git clone --depth 1 https://github.com/vlang/v /opt/v
|
||||
cd /opt/v && make
|
||||
fi
|
||||
|
||||
echo "Building ntfy-bridge..."
|
||||
/opt/v/v -prod -o "$BINARY" .
|
||||
|
||||
echo "Installing binary to $INSTALL_DIR..."
|
||||
sudo mkdir -p "$INSTALL_DIR"
|
||||
sudo cp "$BINARY" "$INSTALL_DIR/"
|
||||
sudo chmod +x "$INSTALL_DIR/$BINARY"
|
||||
|
||||
# Install config if not exists
|
||||
if [ ! -f "$CONFIG_DIR/ntfy-bridge.yaml" ]; then
|
||||
echo "Installing example config..."
|
||||
sudo mkdir -p "$CONFIG_DIR"
|
||||
sudo cp ntfy-bridge.example.yaml "$CONFIG_DIR/ntfy-bridge.yaml"
|
||||
sudo cp dashboard.html "$CONFIG_DIR/"
|
||||
echo ""
|
||||
echo " ⚠️ Edit $CONFIG_DIR/ntfy-bridge.yaml to configure your sources!"
|
||||
fi
|
||||
|
||||
# Install as service
|
||||
echo ""
|
||||
echo "Installing as system service..."
|
||||
sudo "$INSTALL_DIR/$BINARY" --install-service --config "$CONFIG_DIR/ntfy-bridge.yaml"
|
||||
|
||||
# Cleanup
|
||||
cd /
|
||||
rm -rf "$TMPDIR"
|
||||
|
||||
echo ""
|
||||
echo "Done! ntfy-bridge is installed and running."
|
||||
echo ""
|
||||
echo " Config: $CONFIG_DIR/ntfy-bridge.yaml"
|
||||
echo " Binary: $INSTALL_DIR/$BINARY"
|
||||
echo " Dashboard: http://localhost:9090/"
|
||||
echo " Health: http://localhost:9090/health"
|
||||
echo ""
|
||||
echo " Service:"
|
||||
echo " systemctl status ntfy-bridge (systemd)"
|
||||
echo " rc-service ntfy-bridge status (openrc)"
|
||||
echo ""
|
||||
echo " Tail logs:"
|
||||
echo " journalctl -u ntfy-bridge -f (systemd)"
|
||||
Reference in New Issue
Block a user