From caefe1ca4e4289ab8518d3357d4940d1e1fd99bd Mon Sep 17 00:00:00 2001 From: Dorian Date: Sun, 8 Mar 2026 02:27:58 +0000 Subject: [PATCH] fix: add electrs-ui to ISO build and first-boot for flawless installs - Add electrs-ui to ISO capture patterns (captured from live server) - Bundle nginx:alpine base image in ISO for UI container builds - Copy docker UI source files (bitcoin-ui, lnd-ui, electrs-ui) into ISO - First-boot: create electrs-ui container from pre-built image or source - First-boot: create bitcoin-ui and lnd-ui containers (same pattern) - Installer: copy docker/ source dir to target for first-boot fallback - Nginx: minor config sync from linter changes Co-Authored-By: Claude Opus 4.6 --- image-recipe/build-auto-installer-iso.sh | 23 +++++++++++- image-recipe/configs/nginx-archipelago.conf | 2 + scripts/first-boot-containers.sh | 41 +++++++++++++++++++++ 3 files changed, 64 insertions(+), 2 deletions(-) diff --git a/image-recipe/build-auto-installer-iso.sh b/image-recipe/build-auto-installer-iso.sh index 5303a45c..736e85c9 100755 --- a/image-recipe/build-auto-installer-iso.sh +++ b/image-recipe/build-auto-installer-iso.sh @@ -501,7 +501,7 @@ mkdir -p "$IMAGES_DIR" IMAGES_CAPTURED_FROM_SERVER=0 if [ -n "$DEV_SERVER" ] && [ "$DEV_SERVER" != "localhost" ] && [ "$DEV_SERVER" != "127.0.0.1" ]; then echo " Capturing container images from live server ($DEV_SERVER)..." - CAPTURE_PATTERNS="bitcoin-ui bitcoin-knots lnd lnd-ui filebrowser mempool mempool-electrs tailscale homeassistant btcpayserver nbxplorer postgres nostr-rs-relay strfry alpine-tor" + CAPTURE_PATTERNS="bitcoin-ui bitcoin-knots lnd lnd-ui electrs-ui filebrowser mempool mempool-electrs tailscale homeassistant btcpayserver nbxplorer postgres nostr-rs-relay strfry alpine-tor" REMOTE_TMP="/tmp/archipelago-image-capture-$$" SAVED_LIST=$(ssh "$DEV_SERVER" "mkdir -p $REMOTE_TMP && for p in $CAPTURE_PATTERNS; do img=\$(sudo podman images --format '{{.Repository}}:{{.Tag}}' 2>/dev/null | grep -i \"\$p\" | head -1); [ -n \"\$img\" ] && sudo podman save -o \"$REMOTE_TMP/\$p.tar\" \"\$img\" 2>/dev/null && echo \"\$p\"; done" 2>/dev/null) || true for p in $SAVED_LIST; do @@ -535,6 +535,7 @@ scsibug/nostr-rs-relay:latest nostr-rs-relay.tar hoytech/strfry:latest strfry.tar tailscale/tailscale:latest tailscale.tar docker.io/andrius/alpine-tor:latest alpine-tor.tar +docker.io/library/nginx:alpine nginx-alpine.tar " # Pull and save each image (force AMD64 for x86_64 target) only if not already present @@ -719,6 +720,19 @@ FBCSERVICE cp "$WORK_DIR/archipelago-first-boot-containers.service" "$ARCH_DIR/scripts/" fi +# Bundle docker UI source files for building custom UIs on first boot (fallback if images not captured) +DOCKER_UI_DIR="$SCRIPT_DIR/../docker" +if [ -d "$DOCKER_UI_DIR" ]; then + echo " Bundling docker UI source files..." + mkdir -p "$ARCH_DIR/docker" + for ui_dir in bitcoin-ui lnd-ui electrs-ui; do + if [ -d "$DOCKER_UI_DIR/$ui_dir" ]; then + cp -r "$DOCKER_UI_DIR/$ui_dir" "$ARCH_DIR/docker/" + echo " ✅ Bundled $ui_dir source" + fi + done +fi + echo " ✅ Container images bundled (including Tor + first-boot)" # ============================================================================= @@ -967,7 +981,12 @@ if [ -d "$BOOT_MEDIA/archipelago/container-images" ]; then if [ -f "$BOOT_MEDIA/archipelago/scripts/archipelago-first-boot-containers.service" ]; then cp "$BOOT_MEDIA/archipelago/scripts/archipelago-first-boot-containers.service" /mnt/target/etc/systemd/system/ fi - + # Copy docker UI source files for first-boot container builds + if [ -d "$BOOT_MEDIA/archipelago/docker" ]; then + mkdir -p /mnt/target/opt/archipelago/docker + cp -r "$BOOT_MEDIA/archipelago/docker/"* /mnt/target/opt/archipelago/docker/ 2>/dev/null || true + fi + echo " ✅ Container images staged for first-boot loading" fi diff --git a/image-recipe/configs/nginx-archipelago.conf b/image-recipe/configs/nginx-archipelago.conf index 351717ab..323ea9c7 100644 --- a/image-recipe/configs/nginx-archipelago.conf +++ b/image-recipe/configs/nginx-archipelago.conf @@ -63,6 +63,7 @@ server { proxy_set_header X-Real-IP $remote_addr; proxy_buffering off; proxy_cache off; + proxy_connect_timeout 120s; proxy_read_timeout 300s; proxy_set_header Connection ""; } @@ -441,6 +442,7 @@ server { proxy_set_header X-Real-IP $remote_addr; proxy_buffering off; proxy_cache off; + proxy_connect_timeout 120s; proxy_read_timeout 300s; proxy_set_header Connection ""; } diff --git a/scripts/first-boot-containers.sh b/scripts/first-boot-containers.sh index eafa2a30..d72f1233 100644 --- a/scripts/first-boot-containers.sh +++ b/scripts/first-boot-containers.sh @@ -94,6 +94,24 @@ if ! $DOCKER ps --format '{{.Names}}' 2>/dev/null | grep -qE 'archy-mempool-web| docker.io/mempool/frontend:v2.5.0 2>>"$LOG" || true fi +# 2b. Electrs UI (status dashboard on port 50002, host network for backend access) +if ! $DOCKER ps --format '{{.Names}}' 2>/dev/null | grep -q electrs-ui; then + if $DOCKER images --format '{{.Repository}}:{{.Tag}}' 2>/dev/null | grep -q 'electrs-ui'; then + log "Starting Electrs UI from pre-built image..." + $DOCKER run -d --name archy-electrs-ui --network host --restart unless-stopped \ + localhost/electrs-ui:latest 2>>"$LOG" || \ + $DOCKER run -d --name archy-electrs-ui --network host --restart unless-stopped \ + electrs-ui:latest 2>>"$LOG" || true + elif [ -d /opt/archipelago/docker/electrs-ui ]; then + log "Building and starting Electrs UI from source..." + $DOCKER build -t electrs-ui:latest /opt/archipelago/docker/electrs-ui 2>>"$LOG" && \ + $DOCKER run -d --name archy-electrs-ui --network host --restart unless-stopped \ + electrs-ui:latest 2>>"$LOG" || true + else + log "Electrs UI: no image or source found, skipping" + fi +fi + # 3. BTCPay stack (matches deploy) if ! $DOCKER ps -a --format '{{.Names}}' 2>/dev/null | grep -qE 'archy-btcpay-db|postgres-btcpay'; then log "Creating PostgreSQL for BTCPay..." @@ -341,4 +359,27 @@ if $DOCKER images --format '{{.Repository}}:{{.Tag}}' 2>/dev/null | grep -q 'str fi fi +# 9. Custom UI containers (bitcoin-ui, lnd-ui) +# These are built from Dockerfiles in /opt/archipelago/docker/ or loaded from pre-built images. +for ui in bitcoin-ui lnd-ui; do + if $DOCKER ps --format '{{.Names}}' 2>/dev/null | grep -q "$ui"; then + continue + fi + case $ui in + bitcoin-ui) PORT_ARG="-p 8334:80"; NET_ARG="" ;; + lnd-ui) PORT_ARG="-p 8081:80"; NET_ARG="" ;; + esac + CONTAINER_NAME="archy-$ui" + if $DOCKER images --format '{{.Repository}}:{{.Tag}}' 2>/dev/null | grep -q "$ui"; then + log "Starting $ui from pre-built image..." + IMG=$($DOCKER images --format '{{.Repository}}:{{.Tag}}' 2>/dev/null | grep "$ui" | head -1) + $DOCKER run -d --name "$CONTAINER_NAME" $PORT_ARG --restart unless-stopped $NET_ARG "$IMG" 2>>"$LOG" || true + elif [ -d "/opt/archipelago/docker/$ui" ]; then + log "Building $ui from source..." + if $DOCKER build -t "$ui:latest" "/opt/archipelago/docker/$ui" 2>>"$LOG"; then + $DOCKER run -d --name "$CONTAINER_NAME" $PORT_ARG --restart unless-stopped $NET_ARG "$ui:latest" 2>>"$LOG" || true + fi + fi +done + log "First-boot container creation complete"