Initial source: RAPPORT Server-App v0.1.0
- Tauri-2-Admin-UI fuer den Rapport-Compose-Stack - React-Frontend (JSX, kein TS) mit Material-Symbols-Icons - Service-Cards mit Live-Stats (CPU/RAM), Logs, Restart/Stop - Backup-/Restore-System mit pg_dumpall + Retention - Container-Auto-Updates mit Pre-Backup - App-Auto-Updater (Tauri signiert) gegen latest.json im Repo-Root - HTTPS-WebUI (axum/rustls) mit Basic-Auth, CSRF, Rate-Limit, Security-Headers - Setup-Wizard: lädt Docker+Colima+Lima direct von GitHub/docker.com nach ~/.rapport/bin/ - Tray-Modus + macOS-Notifications + Auto-Recovery - Login-Item via tauri-plugin-autostart
This commit is contained in:
Executable
+100
@@ -0,0 +1,100 @@
|
||||
#!/usr/bin/env bash
|
||||
# Laedt fuer die laufende Plattform die Service-Binaries und legt sie unter
|
||||
# binaries/<platform>/ ab. Pinning kommt aus binaries/manifest.json.
|
||||
#
|
||||
# AKTUELL implementiert:
|
||||
# - postgres : echt, via Zonky embedded-postgres-binaries (Maven Central)
|
||||
# - alle anderen : Bash-Placeholder (sleep loop) bis ihre Quellen verdrahtet sind
|
||||
#
|
||||
# Verzeichnis-Layout fuer Postgres: binaries/<platform>/postgres-bundle/
|
||||
# ├── bin/ (postgres, initdb, psql, pg_dumpall, ...)
|
||||
# ├── lib/ (libpq + Sprach-Plugins)
|
||||
# └── share/ (initdb-Templates etc.)
|
||||
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
uname_s=$(uname -s)
|
||||
uname_m=$(uname -m)
|
||||
|
||||
case "$uname_s-$uname_m" in
|
||||
Darwin-arm64) PLATFORM="macos-aarch64"; PG_TARGET="aarch64-apple-darwin"; PGRST_ASSET="macos-aarch64" ;;
|
||||
Darwin-x86_64) PLATFORM="macos-x86_64"; PG_TARGET="x86_64-apple-darwin"; PGRST_ASSET="macos-x86-64" ;;
|
||||
Linux-x86_64) PLATFORM="linux-x86_64"; PG_TARGET="x86_64-unknown-linux-gnu"; PGRST_ASSET="ubuntu-aarch64" ;;
|
||||
*) echo "Unsupported platform: $uname_s-$uname_m"; exit 1 ;;
|
||||
esac
|
||||
|
||||
DEST="binaries/$PLATFORM"
|
||||
mkdir -p "$DEST"
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Postgres (native binary via theseus-rs/postgresql-binaries)
|
||||
# Liefert komplettes bin/ (postgres, initdb, psql, pg_dump, pg_dumpall, ...).
|
||||
# ---------------------------------------------------------------------------
|
||||
PG_VERSION="15.7.0" # keep in sync with binaries/manifest.json
|
||||
PG_BUNDLE_DIR="$DEST/postgres-bundle"
|
||||
PG_VERSION_STAMP="$PG_BUNDLE_DIR/.rapport-version"
|
||||
|
||||
if [[ -x "$PG_BUNDLE_DIR/bin/postgres" && "$(cat "$PG_VERSION_STAMP" 2>/dev/null)" == "theseus-$PG_VERSION-$PG_TARGET" ]]; then
|
||||
echo "Postgres bundle already present (theseus $PG_VERSION $PG_TARGET): $PG_BUNDLE_DIR"
|
||||
else
|
||||
echo "Downloading Postgres $PG_VERSION ($PG_TARGET) from theseus-rs ..."
|
||||
TMP=$(mktemp -d)
|
||||
trap 'rm -rf "$TMP"' EXIT
|
||||
URL="https://github.com/theseus-rs/postgresql-binaries/releases/download/$PG_VERSION/postgresql-$PG_VERSION-$PG_TARGET.tar.gz"
|
||||
curl --fail --location --silent --show-error -o "$TMP/pg.tar.gz" "$URL"
|
||||
|
||||
rm -rf "$PG_BUNDLE_DIR"
|
||||
mkdir -p "$PG_BUNDLE_DIR"
|
||||
tar -xzf "$TMP/pg.tar.gz" -C "$PG_BUNDLE_DIR" --strip-components=1
|
||||
echo "theseus-$PG_VERSION-$PG_TARGET" > "$PG_VERSION_STAMP"
|
||||
echo "Postgres extracted to $PG_BUNDLE_DIR"
|
||||
fi
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# PostgREST (native binary via PostgREST GitHub releases)
|
||||
# ---------------------------------------------------------------------------
|
||||
PGRST_VERSION="v14.12" # keep in sync with binaries/manifest.json
|
||||
PGRST_BIN="$DEST/postgrest"
|
||||
PGRST_STAMP="$DEST/.postgrest-version"
|
||||
|
||||
if [[ -x "$PGRST_BIN" && "$(cat "$PGRST_STAMP" 2>/dev/null)" == "$PGRST_VERSION-$PGRST_ASSET" ]]; then
|
||||
echo "PostgREST already present ($PGRST_VERSION-$PGRST_ASSET): $PGRST_BIN"
|
||||
else
|
||||
echo "Downloading PostgREST $PGRST_VERSION ($PGRST_ASSET) ..."
|
||||
TMP_R=$(mktemp -d)
|
||||
URL="https://github.com/PostgREST/postgrest/releases/download/$PGRST_VERSION/postgrest-$PGRST_VERSION-$PGRST_ASSET.tar.xz"
|
||||
curl --fail --location --silent --show-error -o "$TMP_R/pgrst.tar.xz" "$URL"
|
||||
tar -xJf "$TMP_R/pgrst.tar.xz" -C "$TMP_R"
|
||||
mv "$TMP_R/postgrest" "$PGRST_BIN"
|
||||
chmod +x "$PGRST_BIN"
|
||||
rm -f "$DEST/postgrest.is-placeholder"
|
||||
echo "$PGRST_VERSION-$PGRST_ASSET" > "$PGRST_STAMP"
|
||||
rm -rf "$TMP_R"
|
||||
echo "PostgREST extracted to $PGRST_BIN"
|
||||
fi
|
||||
|
||||
# Reste der ehemaligen Placeholder aufraeumen (gotrue/realtime/storage-api/kong/nginx
|
||||
# laufen jetzt als Docker-Container und brauchen kein lokales Binary mehr).
|
||||
for stale in gotrue realtime storage-api kong nginx; do
|
||||
rm -f "$DEST/$stale" "$DEST/$stale.is-placeholder"
|
||||
done
|
||||
|
||||
for svc in "${PLACEHOLDER_SERVICES[@]}"; do
|
||||
target="$DEST/$svc"
|
||||
if [[ -x "$target" && ! -f "$target.is-placeholder" ]]; then
|
||||
continue
|
||||
fi
|
||||
cat > "$target" <<'PLACEHOLDER'
|
||||
#!/usr/bin/env bash
|
||||
echo "placeholder: $(basename "$0") would run here"
|
||||
sleep 999999
|
||||
PLACEHOLDER
|
||||
chmod +x "$target"
|
||||
touch "$target.is-placeholder"
|
||||
done
|
||||
|
||||
echo "Done."
|
||||
echo " Postgres: $PG_BUNDLE_DIR (real)"
|
||||
echo " GoTrue: $GOTRUE_BIN (real)"
|
||||
echo " Andere: $DEST/{postgrest,realtime,storage-api,kong,nginx} (placeholder)"
|
||||
Reference in New Issue
Block a user