Files
edgeguard-native/scripts/apt-repo/publish.sh
Debian 35b7308ce2 feat: umfangreiches UI+API-Polish (v1.1.36–1.1.42)
Backend:
- Audit-Log: Search-Endpoint mit ILIKE-Filter (actor/action/subject/date)
- NTP: /ntp/status via chronyc tracking (Stratum, Offset, Quelle)
- System: /service-restart mit Allowlist (haproxy/squid/unbound/chrony/scheduler)
- Domain-Response-Headers + Rate-Limit (Migration 0024)
- Join-Tokens (Migration 0025), Cluster-mTLS, Aggregator-Fan-Out
- apt-Service für Update-Banner (apt-get update + Versionsprüfung)
- Backup-Retry mit exponential backoff (retry_apt 3×)
- publish.sh fail-fast + cleanup-old.sh (max 10 Versionen)

Frontend:
- Audit-Log-Page (/audit) mit Filter + Pagination
- ErrorBoundary an React-Root + Vite build-target festgenagelt (iOS 15+)
- Storage-Schema-Stamp: auto-wipe bei Versions-Mismatch (blank-page-Fix)
- EmptyState-Komponente überall ausgerollt
- SSL: Aggregate-Karte (total/expiring/expired/errors)
- Backups: Aggregate-Karte (letzter Backup/Größe/Fehlschläge 24h) + Backup-Now
- NTP: Sync-Status-Karte (chronyc tracking live)
- Domains: Backend-UP/DOWN-Chip aus HAProxy-Stats
- Backends: HAProxy-Status-Spalte (UP/DEGRADED/DOWN)
- Settings: Service-Neustart-Karte (haproxy/squid/unbound/chrony/scheduler)
- Settings: Upgrade-Status-Card, Wartungsmodus, Auto-Update, Retention
- Dashboard: Recent-Alerts, Cluster-Health, License-Chip, Onboarding-Hint
- System-Regeln im Firewall als eigener Tab

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-19 16:18:41 +02:00

92 lines
2.8 KiB
Bash
Executable File

#!/bin/bash
# Publish EdgeGuard deb packages to the Gitea Package Registry in
# the correct dependency order, with fail-fast on partial failure.
#
# Wichtig: das Meta-Paket `edgeguard` deklariert harte Versions-
# Dependencies auf `edgeguard-api (= X.Y.Z)` und `edgeguard-ui (= X.Y.Z)`.
# Wenn beim Upload die api/ui-Pakete fehlschlagen, darf das Meta NICHT
# hochgeladen werden — sonst sieht apt eine inkonsistente Lage:
# "edgeguard X.Y.Z available, depends api X.Y.Z, but api only Y.Z-1 in
# Packages" → "no choices are installable" → Self-Service-Update broken.
# Befund 2026-05-17 nach Gitea-Disk-Full-Vorfall.
#
# Aufruf:
# ./publish.sh <version> <arch>
# arch = amd64 | arm64. arm64 publiziert NUR edgeguard-api (das einzige
# arch-spezifische Paket); amd64 publiziert alle drei.
set -euo pipefail
VERSION="${1:?usage: publish.sh <version> <arch>}"
ARCH="${2:?usage: publish.sh <version> <arch>}"
BASE="https://git.netcell-it.de/api/packages/projekte/debian/pool/trixie/main/upload"
if [ -z "${GITEA_TOKEN:-}" ]; then
if [ -r "$HOME/.gitea-token" ]; then
GITEA_TOKEN="$(tr -d '\n' < "$HOME/.gitea-token")"
else
echo "publish: missing ~/.gitea-token and GITEA_TOKEN env" >&2
exit 1
fi
fi
TOK="$GITEA_TOKEN"
# upload_one <local-deb-path>
# 201 → OK, frisch hochgeladen
# 409 → bereits vorhanden (idempotent, OK)
# alles andere → harter Fehler, abort
upload_one() {
local file="$1"
if [ ! -f "$file" ]; then
echo "$file: not found" >&2
return 1
fi
local name
name="$(basename "$file")"
echo " -> publish $name"
# curl -w schreibt HTTP-Code in stdout-tail, body in /tmp.
local body http
body="$(mktemp)"
http="$(curl -sS -o "$body" -w '%{http_code}' \
-H "Authorization: token $TOK" \
--upload-file "$file" "$BASE")"
case "$http" in
201)
rm -f "$body"
;;
409)
echo " (already exists in registry — OK, idempotent skip)"
rm -f "$body"
;;
*)
echo " ✗ HTTP $http"
cat "$body" >&2
rm -f "$body"
return 1
;;
esac
}
# Upload order: api zuerst, dann ui, dann zuletzt das Meta-Paket.
# Diese Reihenfolge garantiert: wenn ein Schritt failt, ist das Meta
# NICHT im Registry (die strikte Dep-Constraint bleibt erfüllbar).
case "$ARCH" in
amd64)
upload_one "build/deb/edgeguard-api_${VERSION}_amd64.deb"
upload_one "build/deb/edgeguard-ui_${VERSION}_all.deb"
upload_one "build/deb/edgeguard_${VERSION}_all.deb"
;;
arm64)
upload_one "build/deb/edgeguard-api_${VERSION}_arm64.deb"
# Meta + UI sind arch=all → werden vom amd64-Publish abgedeckt.
# arm64-Publish lädt NUR das api-Binary.
;;
*)
echo "publish: unknown arch '$ARCH' (expected amd64 or arm64)" >&2
exit 2
;;
esac
echo "publish: ok ($VERSION/$ARCH)"