From 4c7e77d35eef3fcfea8053acfd55fa75e39d2484 Mon Sep 17 00:00:00 2001 From: "Claude (Chronicler #83 - The Compiler)" Date: Sun, 12 Apr 2026 16:22:43 -0500 Subject: [PATCH] =?UTF-8?q?Add=20ffg-build.sh=20=E2=80=94=20NC1=20build=20?= =?UTF-8?q?router=20for=20NeoForge=201.21.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Routes 1.21.1 builds to NC1 (ffg-builder user) to work around Vineflower -Xmx4G RAM requirement that exceeds Dev Panel capacity. All other versions build locally. - SSH keypair: /home/claude/.ssh/ffg_build_rsa - NC1 user: ffg-builder (non-root, isolated) - rsync source with --exclude build/ .gradle/ - ./gradlew build --no-daemon on NC1 - rsync jar back, jar -tf integrity check - trap cleans workspace on exit/drop --- scripts/ffg-build.sh | 72 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100755 scripts/ffg-build.sh diff --git a/scripts/ffg-build.sh b/scripts/ffg-build.sh new file mode 100755 index 0000000..be5286e --- /dev/null +++ b/scripts/ffg-build.sh @@ -0,0 +1,72 @@ +#!/bin/bash +# ffg-build.sh — Firefrost Gaming mod build router +# Routes NeoForge 1.21.1 builds to NC1 (RAM headroom for Vineflower -Xmx4G) +# All other versions build locally on Dev Panel +# Usage: ffg-build.sh [gradle_args...] + +set -euo pipefail + +VERSION="${1:-}" +WORKSPACE="/opt/mod-builds/firefrost-services/services/discord-rules" +NC1_USER="ffg-builder" +NC1_HOST="216.239.104.130" +NC1_KEY="/home/claude/.ssh/ffg_build_rsa" +NC1_WORKSPACE="/home/ffg-builder/workspaces/build-$$" +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" + +if [[ -z "$VERSION" ]]; then + echo "[ERROR] Usage: ffg-build.sh " + echo " Example: ffg-build.sh 1.21.1" + exit 1 +fi + + +# Route decision +if [[ "$VERSION" == "1.21.1" ]]; then + echo "[ROUTING] NeoForge $VERSION — routing build to NC1 (Vineflower RAM requirement)" + + # Trap: clean up NC1 workspace on exit (covers drops, errors, ctrl+c) + trap 'echo "[CLEANUP] Removing NC1 workspace..."; ssh -i "$NC1_KEY" -o StrictHostKeyChecking=no "$NC1_USER@$NC1_HOST" "rm -rf $NC1_WORKSPACE" 2>/dev/null || true' EXIT + + # Create workspace on NC1 + ssh -i "$NC1_KEY" -o StrictHostKeyChecking=no "$NC1_USER@$NC1_HOST" \ + "mkdir -p $NC1_WORKSPACE" + + # Sync source to NC1 (exclude local build artifacts and gradle cache) + rsync -az --exclude 'build/' --exclude '.gradle/' \ + "$WORKSPACE/$VERSION/" \ + "$NC1_USER@$NC1_HOST:$NC1_WORKSPACE/" + + echo "[NC1] Running Gradle build..." + ssh -i "$NC1_KEY" -o StrictHostKeyChecking=no "$NC1_USER@$NC1_HOST" \ + "cd $NC1_WORKSPACE && ./gradlew build --no-daemon" + + + # Retrieve only the compiled jar + mkdir -p "$WORKSPACE/$VERSION/build/libs" + rsync -az \ + "$NC1_USER@$NC1_HOST:$NC1_WORKSPACE/build/libs/" \ + "$WORKSPACE/$VERSION/build/libs/" \ + --include "*.jar" --exclude "*" + + # Verify jar integrity + JAR=$(find "$WORKSPACE/$VERSION/build/libs/" -name "*.jar" ! -name "*-sources.jar" ! -name "*-dev.jar" | head -1) + if [[ -z "$JAR" ]]; then + echo "[ERROR] No jar found after retrieval." + exit 1 + fi + + if ! jar -tf "$JAR" > /dev/null 2>&1; then + echo "[ERROR] Jar structural integrity check failed: $JAR" + exit 1 + fi + + echo "[SUCCESS] Build complete: $JAR" + +else + # Local build for all other versions + echo "[LOCAL] Building $VERSION locally on Dev Panel..." + cd "$WORKSPACE/$VERSION" + ./gradlew build + echo "[SUCCESS] Local build complete." +fi