Pulse/hot-dev.sh
Pulse Monitor b316510a2b fix: resolve WebSocket metric updates and improve polling efficiency
- Fix alternating zero I/O metrics by implementing rate caching for stale data from Proxmox
- Hardcode polling interval to 10 seconds (matching Proxmox cluster/resources update cycle)
- Remove polling interval settings from UI (no longer user-configurable)
- Implement efficient VM/container polling using single cluster/resources API call
- Remove 'Remove Password' feature (auth is now mandatory)
- Fix CSRF validation for Basic Auth (exempt from CSRF checks)
- Fix Generate API Token modal and authentication
- Remove redundant 'Active' status from Authentication section
- Remove Connection Timeout setting from frontend (backend-only)
- Clean up frontend console logging (reduce verbosity)
- Remove PBS polling interval setting (fixed at 10s)
- Add frontend rebuild detection to backend-watch script
- Improve first-run setup flow and error handling
2025-08-16 12:12:10 +00:00

86 lines
No EOL
2.1 KiB
Bash
Executable file

#!/bin/bash
# Hot-reload development setup
# Frontend runs on Vite dev server on port 7655 with instant hot-reload
# Backend API runs on port 7656 (one port up)
# Just change frontend code and see changes instantly!
echo "========================================="
echo "Starting HOT-RELOAD development mode"
echo "========================================="
echo ""
echo "Frontend: http://192.168.0.123:7655 (with hot-reload)"
echo "Backend API: http://localhost:7656"
echo ""
echo "Just edit frontend files and see changes instantly!"
echo "Press Ctrl+C to stop"
echo "========================================="
# Kill any existing Pulse processes (but NOT ttyd/tmux which run Claude Code!)
sudo systemctl stop pulse-backend 2>/dev/null
# Use exact match to only kill the "pulse" binary, not processes running FROM /opt/pulse
pkill -x "pulse" 2>/dev/null
# Start backend on port 7656 (one port up from normal)
echo "Starting backend on port 7656..."
cd /opt/pulse
if [ ! -f pulse ] || [ pulse -ot cmd/pulse/main.go ]; then
echo "Building backend..."
go build -o pulse ./cmd/pulse
fi
PORT=7656 ./pulse &
BACKEND_PID=$!
# Wait for backend to start
sleep 2
# Create temporary vite config for development
cd /opt/pulse/frontend-modern
cat > vite.config.dev.ts << 'EOF'
import { defineConfig } from 'vite';
import solid from 'vite-plugin-solid';
import path from 'path';
export default defineConfig({
plugins: [solid()],
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
},
},
server: {
port: 7655,
host: '0.0.0.0',
proxy: {
'/api': {
target: 'http://127.0.0.1:7656',
changeOrigin: true,
},
'/ws': {
target: 'ws://127.0.0.1:7656',
ws: true,
changeOrigin: true,
},
},
},
build: {
target: 'esnext',
},
});
EOF
# Cleanup on exit
cleanup() {
echo ""
echo "Stopping services..."
kill $BACKEND_PID 2>/dev/null
rm -f vite.config.dev.ts
exit
}
trap cleanup INT TERM
# Start vite dev server with hot-reload
echo "Starting frontend with hot-reload on port 7655..."
npx vite --config vite.config.dev.ts --clearScreen false
cleanup