chore: release v3.12.3

- Test tarball creation script to prevent macOS extended attribute warnings
- Minor improvements to data fetcher
This commit is contained in:
courtmanr@gmail.com
2025-05-29 23:22:42 +01:00
parent e7d53306d1
commit 6de974ebff
5 changed files with 1112 additions and 1310 deletions
+752 -1296
View File
File diff suppressed because it is too large Load Diff
+4 -1
View File
@@ -1,6 +1,6 @@
{
"name": "pulse",
"version": "3.12.3-dev.0",
"version": "3.12.3",
"description": "A lightweight monitoring application for Proxmox VE.",
"main": "server/index.js",
"scripts": {
@@ -51,5 +51,8 @@
"transformIgnorePatterns": [
"/node_modules/(?!p-limit|yocto-queue)/"
]
},
"overrides": {
"glob": "^10.4.5"
}
}
+144
View File
@@ -0,0 +1,144 @@
#!/bin/bash
set -e # Exit immediately if a command exits with a non-zero status.
# This script creates a release tarball for Pulse
# Note: COPYFILE_DISABLE=1 is used when creating the tarball to prevent
# macOS extended attributes from being included, which would cause
# "Ignoring unknown extended header keyword" warnings on extraction
# --- Configuration ---
# Attempt to get version from package.json
PACKAGE_VERSION=$(node -p "require('./package.json').version")
# Suggest a release version by stripping common pre-release suffixes like -dev.X or -alpha.X etc.
SUGGESTED_RELEASE_VERSION=$(echo "$PACKAGE_VERSION" | sed -E 's/-(dev|alpha|beta|rc|pre)[-.0-9]*$//')
# --- User Input for Version ---
echo "Current version in package.json: $PACKAGE_VERSION"
read -p "Enter release version (default: $SUGGESTED_RELEASE_VERSION): " USER_VERSION
RELEASE_VERSION=${USER_VERSION:-$SUGGESTED_RELEASE_VERSION}
if [[ -z "$RELEASE_VERSION" ]]; then
echo "Error: Release version cannot be empty."
exit 1
fi
echo "Creating release for version: v$RELEASE_VERSION"
# --- Definitions ---
APP_NAME="pulse" # Or derive from package.json if preferred
RELEASE_DIR_NAME="${APP_NAME}-v${RELEASE_VERSION}"
STAGING_PARENT_DIR="pulse-release-staging" # Temporary parent for the release content
STAGING_FULL_PATH="$STAGING_PARENT_DIR/$RELEASE_DIR_NAME"
TARBALL_NAME="${RELEASE_DIR_NAME}.tar.gz"
# --- Cleanup Previous Attempts ---
echo "Cleaning up previous attempts..."
rm -rf "$STAGING_PARENT_DIR"
rm -f "$TARBALL_NAME"
mkdir -p "$STAGING_FULL_PATH"
# --- Build Step ---
echo "Building CSS..."
npm run build:css
if [ ! -f "src/public/output.css" ]; then
echo "Error: src/public/output.css not found after build. Aborting."
exit 1
fi
# --- Copy Application Files ---
echo "Copying application files to $STAGING_FULL_PATH..."
# Server files (excluding tests)
echo "Copying server files..."
rsync -av --progress server/ "$STAGING_FULL_PATH/server/" --exclude 'tests/'
# Source files (including built CSS, Tailwind config, and public assets)
echo "Copying source files..."
mkdir -p "$STAGING_FULL_PATH/src" # Ensure parent directory exists
rsync -av --progress src/public/ "$STAGING_FULL_PATH/src/public/"
# Copy CSS build files and config
cp src/index.css "$STAGING_FULL_PATH/src/" 2>/dev/null || echo "Warning: src/index.css not found"
cp src/tailwind.config.js "$STAGING_FULL_PATH/src/" 2>/dev/null || echo "Warning: src/tailwind.config.js not found"
cp src/postcss.config.js "$STAGING_FULL_PATH/src/" 2>/dev/null || echo "Warning: src/postcss.config.js not found"
# Root files
echo "Copying root files..."
cp package.json "$STAGING_FULL_PATH/"
cp package-lock.json "$STAGING_FULL_PATH/"
cp README.md "$STAGING_FULL_PATH/"
cp LICENSE "$STAGING_FULL_PATH/"
cp CHANGELOG.md "$STAGING_FULL_PATH/"
cp .env.example "$STAGING_FULL_PATH/.env.example" # Essential for user configuration
# Scripts (e.g., install-pulse.sh, if intended for end-user)
if [ -d "scripts" ]; then
echo "Copying scripts..."
mkdir -p "$STAGING_FULL_PATH/scripts/"
if [ -f "scripts/install-pulse.sh" ]; then
cp scripts/install-pulse.sh "$STAGING_FULL_PATH/scripts/"
fi
# Add other scripts if they are part of the release
fi
# Docs
if [ -d "docs" ]; then
echo "Copying docs..."
rsync -av --progress docs/ "$STAGING_FULL_PATH/docs/"
fi
# --- Install Production Dependencies ---
echo "Installing production dependencies in $STAGING_FULL_PATH..."
(cd "$STAGING_FULL_PATH" && npm install --omit=dev --ignore-scripts)
# --ignore-scripts prevents any package's own postinstall scripts from running during this build phase.
# If your production dependencies have essential postinstall scripts, you might remove --ignore-scripts.
# --- Verify Essential Files ---
echo "Verifying essential files for tarball installation..."
MISSING_FILES=""
[ ! -f "$STAGING_FULL_PATH/package.json" ] && MISSING_FILES="$MISSING_FILES package.json"
[ ! -f "$STAGING_FULL_PATH/.env.example" ] && MISSING_FILES="$MISSING_FILES .env.example"
[ ! -f "$STAGING_FULL_PATH/server/index.js" ] && MISSING_FILES="$MISSING_FILES server/index.js"
[ ! -f "$STAGING_FULL_PATH/src/public/output.css" ] && MISSING_FILES="$MISSING_FILES src/public/output.css"
[ ! -d "$STAGING_FULL_PATH/node_modules" ] && MISSING_FILES="$MISSING_FILES node_modules/"
if [ -n "$MISSING_FILES" ]; then
echo "Error: Missing essential files for tarball installation:$MISSING_FILES"
echo "The install script expects these files to be present in the tarball."
exit 1
fi
echo "✅ All essential files verified for tarball installation."
# --- Create Tarball ---
echo "Creating tarball: $TARBALL_NAME..."
# Go into the parent of the directory to be tarred to avoid leading paths in tarball
# COPYFILE_DISABLE=1 prevents macOS from adding extended attributes that cause warnings
(cd "$STAGING_PARENT_DIR" && COPYFILE_DISABLE=1 tar -czf "../$TARBALL_NAME" "$RELEASE_DIR_NAME")
# --- Cleanup ---
echo "Cleaning up staging directory ($STAGING_PARENT_DIR)..."
rm -rf "$STAGING_PARENT_DIR"
echo ""
echo "----------------------------------------------------"
echo "Release tarball created: $TARBALL_NAME"
echo "----------------------------------------------------"
echo "📦 This tarball includes:"
echo " ✅ Pre-built CSS assets"
echo " ✅ Production npm dependencies"
echo " ✅ All server and client files"
echo " ✅ Installation scripts"
echo ""
echo "🚀 Installation options:"
echo "1. RECOMMENDED: Use the install script (faster, automated):"
echo " curl -sLO https://raw.githubusercontent.com/rcourtman/Pulse/main/scripts/install-pulse.sh"
echo " chmod +x install-pulse.sh"
echo " sudo ./install-pulse.sh"
echo " (The script will automatically use this tarball for faster installation)"
echo ""
echo "2. Manual installation:"
echo " - Copy $TARBALL_NAME to target server"
echo " - Extract: tar -xzf $TARBALL_NAME"
echo " - Navigate: cd $RELEASE_DIR_NAME"
echo " - Configure: cp .env.example .env && edit .env"
echo " - Start: npm start"
echo "----------------------------------------------------"
+210
View File
@@ -0,0 +1,210 @@
#!/bin/bash
# Pulse CSS Fix Script
# This script fixes CSS issues in broken Pulse installations
# where the frontend shows no styling due to CSS MIME type errors
set -e
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
print_info() {
echo -e "${BLUE}[INFO]${NC} $1"
}
print_success() {
echo -e "${GREEN}[SUCCESS]${NC} $1"
}
print_warning() {
echo -e "${YELLOW}[WARNING]${NC} $1"
}
print_error() {
echo -e "${RED}[ERROR]${NC} $1"
}
# Default installation path
PULSE_DIR="/opt/pulse-proxmox"
print_info "Pulse CSS Fix Script"
print_info "This script fixes CSS issues where the frontend has no styling"
echo ""
# Check if Pulse directory exists
if [ ! -d "$PULSE_DIR" ]; then
print_error "Pulse installation directory not found at $PULSE_DIR"
print_info "Please specify the correct Pulse installation path:"
read -p "Enter Pulse installation path: " PULSE_DIR
if [ ! -d "$PULSE_DIR" ]; then
print_error "Directory $PULSE_DIR does not exist. Exiting."
exit 1
fi
fi
print_info "Using Pulse installation at: $PULSE_DIR"
# Check if this is a Pulse installation
if [ ! -f "$PULSE_DIR/package.json" ] || [ ! -f "$PULSE_DIR/server/index.js" ]; then
print_error "This doesn't appear to be a valid Pulse installation"
print_error "Missing package.json or server/index.js"
exit 1
fi
# Change to Pulse directory
cd "$PULSE_DIR" || {
print_error "Failed to change to $PULSE_DIR"
exit 1
}
print_info "Checking current CSS status..."
# Check if output.css exists and has content
if [ ! -f "src/public/output.css" ]; then
print_warning "output.css file is missing"
CSS_MISSING=1
elif [ ! -s "src/public/output.css" ]; then
print_warning "output.css file is empty"
CSS_EMPTY=1
else
# Check if CSS contains actual CSS content (not HTML error page)
if head -1 "src/public/output.css" | grep -q "<!DOCTYPE\|<html\|<head"; then
print_warning "output.css contains HTML instead of CSS (corrupted)"
CSS_CORRUPTED=1
else
print_info "output.css appears to contain valid CSS"
CSS_VALID=1
fi
fi
# If CSS is valid, check if there's actually a problem
if [ "$CSS_VALID" = "1" ]; then
print_info "CSS file appears to be valid. You may not need this fix."
print_info "Are you experiencing frontend styling issues? (y/N)"
read -r response
if [[ ! "$response" =~ ^[Yy]$ ]]; then
print_info "Exiting without changes."
exit 0
fi
fi
print_info "Attempting to fix CSS..."
# Method 1: Try to rebuild CSS if we have the tools
if [ -f "src/tailwind.config.js" ] && [ -f "src/index.css" ]; then
print_info "Found Tailwind config and source CSS, attempting rebuild..."
# Check if we have npm and tailwindcss
if command -v npm >/dev/null 2>&1; then
# Try to rebuild
if npm run build:css >/dev/null 2>&1; then
print_success "CSS rebuilt successfully using npm run build:css"
# Verify the rebuild worked
if [ -f "src/public/output.css" ] && [ -s "src/public/output.css" ]; then
if ! head -1 "src/public/output.css" | grep -q "<!DOCTYPE\|<html\|<head"; then
print_success "CSS fix completed successfully!"
print_info "Please refresh your browser (Ctrl+F5 or Cmd+Shift+R) to see the changes"
exit 0
fi
fi
else
print_warning "npm run build:css failed (likely missing dev dependencies)"
fi
else
print_warning "npm command not found"
fi
fi
# Method 2: Download pre-built CSS from latest release
print_info "Attempting to download pre-built CSS from latest release..."
# Create backup of current CSS
if [ -f "src/public/output.css" ]; then
cp "src/public/output.css" "src/public/output.css.backup.$(date +%s)"
print_info "Current CSS backed up"
fi
# Try to download CSS from GitHub
if command -v curl >/dev/null 2>&1; then
print_info "Downloading CSS from latest Pulse release..."
# Get latest release info
LATEST_RELEASE=$(curl -s https://api.github.com/repos/rcourtman/Pulse/releases/latest | grep -o '"tag_name": "[^"]*' | cut -d'"' -f4)
if [ -n "$LATEST_RELEASE" ]; then
print_info "Latest release: $LATEST_RELEASE"
# Download and extract just the CSS file
TEMP_DIR=$(mktemp -d)
cd "$TEMP_DIR"
# Download tarball
if curl -sL "https://github.com/rcourtman/Pulse/releases/download/$LATEST_RELEASE/pulse-${LATEST_RELEASE#v}.tar.gz" -o pulse.tar.gz; then
# Extract just the CSS file
if tar -xzf pulse.tar.gz --wildcards "*/src/public/output.css" 2>/dev/null; then
# Find and copy the CSS file
CSS_FILE=$(find . -name "output.css" -path "*/src/public/*" | head -1)
if [ -n "$CSS_FILE" ] && [ -f "$CSS_FILE" ]; then
cp "$CSS_FILE" "$PULSE_DIR/src/public/output.css"
print_success "CSS downloaded and installed from release $LATEST_RELEASE"
# Clean up temp directory
cd "$PULSE_DIR"
rm -rf "$TEMP_DIR"
print_success "CSS fix completed successfully!"
print_info "Please refresh your browser (Ctrl+F5 or Cmd+Shift+R) to see the changes"
exit 0
else
print_error "Could not find CSS file in downloaded release"
fi
else
print_error "Failed to extract CSS from downloaded release"
fi
else
print_error "Failed to download release tarball"
fi
# Clean up temp directory
cd "$PULSE_DIR"
rm -rf "$TEMP_DIR"
else
print_error "Could not determine latest release version"
fi
else
print_warning "curl command not found, cannot download CSS"
fi
# Method 3: Create minimal CSS as last resort
print_warning "All automated fixes failed. Creating minimal CSS as last resort..."
# Create a basic CSS file that will at least make the page usable
cat > "src/public/output.css" << 'EOF'
/* Minimal CSS for Pulse - Emergency Fix */
* { box-sizing: border-box; }
body { font-family: system-ui, sans-serif; margin: 0; padding: 20px; background: #f5f5f5; }
.container { max-width: 1200px; margin: 0 auto; }
.card { background: white; border-radius: 8px; padding: 20px; margin-bottom: 20px; box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
.btn { padding: 8px 16px; border: none; border-radius: 4px; cursor: pointer; }
.btn-primary { background: #3b82f6; color: white; }
.text-red-600 { color: #dc2626; }
.text-green-600 { color: #16a34a; }
.text-yellow-600 { color: #ca8a04; }
.hidden { display: none; }
.flex { display: flex; }
.grid { display: grid; }
.gap-4 { gap: 1rem; }
EOF
print_warning "Created minimal emergency CSS"
print_warning "This provides basic styling but is not the full Pulse theme"
print_info "Consider running the Pulse installer again or manually rebuilding CSS"
print_info "Please refresh your browser (Ctrl+F5 or Cmd+Shift+R) to see the changes"
print_info "CSS fix script completed"
+2 -13
View File
@@ -619,21 +619,10 @@ async function fetchAllPbsTasksForProcessing({ client, config }, nodeName) {
const deduplicatedTasks = Array.from(finalTasksMap.values());
// Debug logging for PBS task processing
// Simplified logging for PBS task processing
const failedTasks = deduplicatedTasks.filter(task => task.status !== 'OK');
if (failedTasks.length > 0) {
console.log(`[PBS Tasks Debug] Found ${failedTasks.length} failed tasks for ${config.name}:`,
failedTasks.map(task => ({
guestId: task.guestId,
guestType: task.guestType,
status: task.status,
starttime: task.starttime,
upid: task.upid,
failureTask: task.failureTask || false
}))
);
} else {
console.log(`[PBS Tasks Debug] No failed tasks found for ${config.name}. Total tasks: ${deduplicatedTasks.length}`);
console.log(`[PBS Tasks] Found ${failedTasks.length} failed tasks for ${config.name}`);
}
// console.log(`[DataFetcher] Final task count for ${config.name}: ${allBackupTasks.length} -> ${deduplicatedTasks.length} (removed ${allBackupTasks.length - deduplicatedTasks.length} duplicates)`); // Removed verbose log