Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

fix: fall back to Pulse server when GitHub download fails for pulse-sensor-proxy

rcourtmanf81d77bb9887
diff --git a/install.sh b/install.sh
index d90821c976..95f9826cd3 100755
--- a/install.sh
+++ b/install.sh
@@ -1108,6 +1108,8 @@ create_lxc_container() {
# Run proxy installer if downloaded
if [[ -f "$proxy_script" ]]; then
chmod +x "$proxy_script"
+ # Set fallback URL to download from Pulse server inside the LXC
+ export PULSE_SENSOR_PROXY_FALLBACK_URL="http://${IP}:${frontend_port}/api/install/pulse-sensor-proxy"
if bash "$proxy_script" --ctid "$CTID" 2>&1 | tee /tmp/proxy-install-${CTID}.log; then
print_info "Temperature proxy installed successfully"
else
diff --git a/scripts/install-sensor-proxy.sh b/scripts/install-sensor-proxy.sh
index 0456a35e7a..a59e814b6f 100755
--- a/scripts/install-sensor-proxy.sh
+++ b/scripts/install-sensor-proxy.sh
@@ -191,36 +191,41 @@ else
esac
# If fallback URL is provided (e.g., from Pulse setup script), use it directly
- if [[ -n "$FALLBACK_BASE" ]]; then
- FALLBACK_URL="${FALLBACK_BASE%/}?arch=${ARCH_LABEL}"
- print_info "Downloading $BINARY_NAME from Pulse server..."
- if ! curl -fsSL "$FALLBACK_URL" -o "$BINARY_PATH.tmp"; then
- print_error "Failed to download proxy binary from $FALLBACK_URL"
- exit 1
- fi
- else
- # Fallback not provided, download from GitHub release
- GITHUB_REPO="rcourtman/Pulse"
- if [[ "$VERSION" == "latest" ]]; then
- RELEASE_URL="https://api.github.com/repos/$GITHUB_REPO/releases/latest"
- print_info "Fetching latest release info..."
- RELEASE_DATA=$(curl -fsSL "$RELEASE_URL")
- VERSION=$(echo "$RELEASE_DATA" | grep -o '"tag_name": "[^"]*"' | cut -d'"' -f4)
- if [[ -z "$VERSION" ]]; then
- print_error "Failed to determine latest version"
- exit 1
- fi
+ # Try GitHub first for releases
+ GITHUB_REPO="rcourtman/Pulse"
+ DOWNLOAD_SUCCESS=false
+
+ if [[ "$VERSION" == "latest" ]]; then
+ RELEASE_URL="https://api.github.com/repos/$GITHUB_REPO/releases/latest"
+ print_info "Fetching latest release info..."
+ RELEASE_DATA=$(curl -fsSL "$RELEASE_URL" 2>/dev/null)
+ VERSION=$(echo "$RELEASE_DATA" | grep -o '"tag_name": "[^"]*"' | cut -d'"' -f4)
+
+ if [[ -n "$VERSION" ]]; then
print_info "Latest version: $VERSION"
+ DOWNLOAD_URL="https://github.com/$GITHUB_REPO/releases/download/$VERSION/$BINARY_NAME"
+ print_info "Downloading $BINARY_NAME from GitHub..."
+ if curl -fsSL "$DOWNLOAD_URL" -o "$BINARY_PATH.tmp" 2>/dev/null; then
+ DOWNLOAD_SUCCESS=true
+ fi
fi
+ fi
- DOWNLOAD_URL="https://github.com/$GITHUB_REPO/releases/download/$VERSION/$BINARY_NAME"
- print_info "Downloading $BINARY_NAME from GitHub..."
- if ! curl -fsSL "$DOWNLOAD_URL" -o "$BINARY_PATH.tmp"; then
- print_error "Failed to download binary from $DOWNLOAD_URL"
- exit 1
+ # Fall back to Pulse server if GitHub failed or fallback is provided
+ if [[ "$DOWNLOAD_SUCCESS" != true ]] && [[ -n "$FALLBACK_BASE" ]]; then
+ FALLBACK_URL="${FALLBACK_BASE%/}?arch=${ARCH_LABEL}"
+ print_info "Downloading $BINARY_NAME from Pulse server..."
+ if curl -fsSL "$FALLBACK_URL" -o "$BINARY_PATH.tmp" 2>/dev/null; then
+ DOWNLOAD_SUCCESS=true
fi
fi
+ # Exit if both methods failed
+ if [[ "$DOWNLOAD_SUCCESS" != true ]]; then
+ print_error "Failed to download binary from GitHub or Pulse server"
+ exit 1
+ fi
+
# Make executable and move to final location
chmod +x "$BINARY_PATH.tmp"
mv "$BINARY_PATH.tmp" "$BINARY_PATH"