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.

chore: Mac-compatible dev scripts

rcourtman222c88f33c2a
diff --git a/internal/api/DO_NOT_EDIT_FRONTEND_HERE.md b/internal/api/DO_NOT_EDIT_FRONTEND_HERE.md
index 25b1bfa293..9083a15c44 100644
--- a/internal/api/DO_NOT_EDIT_FRONTEND_HERE.md
+++ b/internal/api/DO_NOT_EDIT_FRONTEND_HERE.md
@@ -3,7 +3,7 @@
This `frontend-modern` directory is **AUTO-GENERATED** during builds.
## The REAL frontend location is
-### `/opt/pulse/frontend-modern`
+### `${PULSE_REPOS_DIR}/pulse/frontend-modern`
## Why does this exist?
- Go's `embed` directive cannot access files outside the module
@@ -15,7 +15,7 @@ This `frontend-modern` directory is **AUTO-GENERATED** during builds.
- The Makefile deletes and recreates this directory
## How to edit frontend code
-1. Edit files in `/opt/pulse/frontend-modern/src/`
+1. Edit files in `${PULSE_REPOS_DIR}/pulse/frontend-modern/src/`
2. The dev server (port 7655) will hot-reload
3. When building for production, the Makefile copies it here
diff --git a/internal/api/README.md b/internal/api/README.md
index 596ec3c109..5bc34b656f 100644
--- a/internal/api/README.md
+++ b/internal/api/README.md
@@ -11,7 +11,7 @@ The `frontend-modern/` subdirectory that appears here is:
- **REQUIRED BY GO** - The embed directive needs it here
### Frontend Development Location
-πŸ‘‰ **Edit frontend files at: `/opt/pulse/frontend-modern/src/`**
+πŸ‘‰ **Edit frontend files at: `${PULSE_REPOS_DIR}/pulse/frontend-modern/src/`**
### Why This Structure?
Go's `//go:embed` directive has limitations:
diff --git a/scripts/dev-check.sh b/scripts/dev-check.sh
index f1d15f0780..13fb3de0de 100755
--- a/scripts/dev-check.sh
+++ b/scripts/dev-check.sh
@@ -27,9 +27,9 @@ echo ""
# Check for duplicate Pulse processes (CRITICAL!)
# Count both installed binary and dev binary patterns
-# Use tr to strip newlines for robustness
-PULSE_COUNT_BIN=$(pgrep -c -f "bin/pulse$" 2>/dev/null | tr -d '\n' || echo 0)
-PULSE_COUNT_DEV=$(pgrep -c -f "^\./pulse$" 2>/dev/null | tr -d '\n' || echo 0)
+# Note: macOS pgrep doesn't support -c, so we use wc -l
+PULSE_COUNT_BIN=$(pgrep -f "bin/pulse$" 2>/dev/null | wc -l | tr -d ' ')
+PULSE_COUNT_DEV=$(pgrep -f "^\./pulse$" 2>/dev/null | wc -l | tr -d ' ')
PULSE_COUNT=$(( ${PULSE_COUNT_BIN:-0} + ${PULSE_COUNT_DEV:-0} ))
echo -n "Pulse processes: "
if [[ $PULSE_COUNT -eq 0 ]]; then
@@ -47,7 +47,7 @@ fi
echo -n "Pulse backend (port 7655): "
if curl -s -o /dev/null -w "%{http_code}" http://127.0.0.1:7655/api/health 2>/dev/null | grep -q "200\|401\|403"; then
echo -e "${GREEN}βœ“ Responding${NC}"
-elif systemctl is-active --quiet pulse 2>/dev/null; then
+elif [[ "$(uname -s)" == "Linux" ]] && systemctl is-active --quiet pulse 2>/dev/null; then
echo -e "${YELLOW}⚠ Service running but not responding${NC}"
else
echo -e "${RED}βœ— NOT RESPONDING${NC}"
@@ -59,7 +59,7 @@ if curl -s -o /dev/null http://127.0.0.1:5173/ 2>/dev/null; then
echo -e "${GREEN}βœ“ Running${NC}"
else
echo -e "${RED}βœ— NOT RUNNING${NC}"
- echo " Fix: cd /opt/pulse/frontend-modern && npm run dev"
+ echo " Fix: cd \${PULSE_REPOS_DIR:-~/Development/pulse/repos}/pulse/frontend-modern && npm run dev"
fi
# Check AI status
@@ -74,7 +74,13 @@ fi
# Show recent errors
echo ""
echo "=== Recent Pulse Errors (last 5) ==="
-journalctl -u pulse-dev --no-pager -n 20 2>/dev/null | grep -i "error\|fatal\|panic" | tail -5 || echo "None found"
+if [[ "$(uname -s)" == "Darwin" ]]; then
+ # macOS: check the debug log
+ grep -i "error\|fatal\|panic" /tmp/pulse-debug.log 2>/dev/null | tail -5 || echo "None found"
+else
+ # Linux: use journalctl
+ journalctl -u pulse-dev --no-pager -n 20 2>/dev/null | grep -i "error\|fatal\|panic" | tail -5 || echo "None found"
+fi
echo ""
echo "Done."
diff --git a/scripts/hot-dev.sh b/scripts/hot-dev.sh
index aeec676097..a9513396a2 100755
--- a/scripts/hot-dev.sh
+++ b/scripts/hot-dev.sh
@@ -15,7 +15,7 @@
# FRONTEND_DEV_PORT=5173 Frontend dev server port (default: 5173)
#
# Pro Features Mode:
-# When /opt/pulse-enterprise exists and HOT_DEV_USE_PRO is not "false",
+# When pulse-enterprise repo exists and HOT_DEV_USE_PRO is not "false",
# the script builds the Pro binary which includes:
# - SQLite-based persistent audit logging
# - RBAC (Role-Based Access Control)
@@ -130,7 +130,14 @@ ALLOWED_ORIGINS="${ALLOWED_ORIGINS},http://localhost:${FRONTEND_DEV_PORT:-7655},
ALLOWED_ORIGINS="${ALLOWED_ORIGINS},http://localhost:5173,http://127.0.0.1:5173"
# Detect and add all system IPs (V4)
-for ip in $(hostname -I); do
+if [[ "$(uname -s)" == "Darwin" ]]; then
+ # macOS: get IPs from ifconfig
+ ALL_IPS=$(ifconfig 2>/dev/null | grep "inet " | awk '{print $2}' | grep -v "^127\.")
+else
+ # Linux: use hostname -I
+ ALL_IPS=$(hostname -I 2>/dev/null || echo "")
+fi
+for ip in $ALL_IPS; do
if [[ "${ip}" =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
if [[ "${ip}" != "127.0.0.1" ]]; then
ALLOWED_ORIGINS="${ALLOWED_ORIGINS},http://${ip}:${FRONTEND_DEV_PORT:-7655}"
@@ -261,7 +268,9 @@ mkdir -p internal/api/frontend-modern/dist
touch internal/api/frontend-modern/dist/index.html
# Check if Pro module is available and use it for full audit logging support
-PRO_MODULE_DIR="/opt/pulse-enterprise"
+# Use PULSE_REPOS_DIR env var or default to ~/Development/pulse/repos
+PULSE_REPOS_DIR="${PULSE_REPOS_DIR:-$HOME/Development/pulse/repos}"
+PRO_MODULE_DIR="${PULSE_REPOS_DIR}/pulse-enterprise"
if [[ -d "${PRO_MODULE_DIR}" ]] && [[ ${HOT_DEV_USE_PRO:-true} == "true" ]]; then
log_info "Building Pro binary (includes persistent audit logging)..."
cd "${PRO_MODULE_DIR}"
@@ -271,10 +280,10 @@ if [[ -d "${PRO_MODULE_DIR}" ]] && [[ ${HOT_DEV_USE_PRO:-true} == "true" ]]; the
go build -o pulse ./cmd/pulse
}
cd "${ROOT_DIR}"
- # Set up audit directory for Pro features
- export PULSE_AUDIT_DIR="${PULSE_DATA_DIR:-/etc/pulse}"
- log_info "Pro audit logging enabled (SQLite storage in ${PULSE_AUDIT_DIR})"
+ # Note: PULSE_AUDIT_DIR is set after PULSE_DATA_DIR is determined below
+ PRO_BUILD_SUCCESS=true
else
+ PRO_BUILD_SUCCESS=false
go build -o pulse ./cmd/pulse
fi
@@ -293,6 +302,11 @@ if [[ ${PULSE_MOCK_MODE:-false} == "true" ]]; then
export PULSE_DATA_DIR="${ROOT_DIR}/tmp/mock-data"
mkdir -p "$PULSE_DATA_DIR"
log_info "Mock mode: Using isolated data directory: ${PULSE_DATA_DIR}"
+ # Set audit dir for Pro features (must be after PULSE_DATA_DIR is set)
+ if [[ ${PRO_BUILD_SUCCESS:-false} == "true" ]]; then
+ export PULSE_AUDIT_DIR="${PULSE_DATA_DIR}"
+ log_info "Pro audit logging enabled (SQLite storage in ${PULSE_AUDIT_DIR})"
+ fi
else
if [[ -n ${PULSE_DATA_DIR:-} ]]; then
log_info "Using preconfigured data directory: ${PULSE_DATA_DIR}"
@@ -316,8 +330,9 @@ else
log_error "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
log_error "!! Backup used: ${BACKUP_KEY}"
log_error "!! "
- log_error "!! To find out what deleted the key, run:"
- log_error "!! sudo journalctl -u encryption-key-watcher -n 100"
+ log_error "!! To find out what deleted the key:"
+ log_error "!! Linux: sudo journalctl -u encryption-key-watcher -n 100"
+ log_error "!! macOS: check /tmp/pulse-debug.log"
log_error "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
echo ""
cp -f "${BACKUP_KEY}" "${PULSE_DATA_DIR}/.encryption.key"
@@ -363,6 +378,12 @@ else
log_warn "No encryption key found for ${PULSE_DATA_DIR}. Encrypted config may fail to load."
fi
fi
+
+ # Set audit dir for Pro features (must be after PULSE_DATA_DIR is set)
+ if [[ ${PRO_BUILD_SUCCESS:-false} == "true" ]]; then
+ export PULSE_AUDIT_DIR="${PULSE_DATA_DIR}"
+ log_info "Pro audit logging enabled (SQLite storage in ${PULSE_AUDIT_DIR})"
+ fi
fi
LOG_LEVEL=debug \
@@ -451,7 +472,7 @@ log_info "Starting backend file watcher..."
if kill -0 "$NEW_PID" 2>/dev/null; then
log_info "βœ“ Backend restarted (PID: $NEW_PID)"
else
- log_error "βœ— Backend failed to start! Check /opt/pulse/hotdev.log"
+ log_error "βœ— Backend failed to start! Check /tmp/pulse-debug.log"
fi
}
@@ -463,7 +484,8 @@ log_info "Starting backend file watcher..."
# Use the same build logic as the initial build
local build_success=0
- PRO_MODULE_DIR="/opt/pulse-enterprise"
+ PULSE_REPOS_DIR="${PULSE_REPOS_DIR:-$HOME/Development/pulse/repos}"
+ PRO_MODULE_DIR="${PULSE_REPOS_DIR}/pulse-enterprise"
if [[ -d "${PRO_MODULE_DIR}" ]] && [[ ${HOT_DEV_USE_PRO:-true} == "true" ]]; then
log_info "Building Pro binary..."
if (cd "${PRO_MODULE_DIR}" && go build -buildvcs=false -o "${ROOT_DIR}/pulse" ./cmd/pulse-enterprise 2>&1 | grep -v "^#"); then