From bd9ebcada75f8ebc2f22a740a02df61a5dc23514 Mon Sep 17 00:00:00 2001 From: Pulse Monitor Date: Thu, 21 Aug 2025 22:06:18 +0000 Subject: [PATCH] feat: add port configuration prompt to installer - Install script now prompts for custom port (default: 7655) - Can skip prompt with FRONTEND_PORT environment variable - Fixed incorrect port configuration instructions in UI - Updated documentation to reflect new installation options - Fixed FAQ.md references to pulse-backend (should be pulse) addresses #110 --- docs/FAQ.md | 7 +-- docs/INSTALL.md | 12 ++++- docs/PORT_CONFIGURATION.md | 16 ++++--- .../src/components/Settings/Settings.tsx | 7 +-- install.sh | 44 +++++++++++++++++-- 5 files changed, 69 insertions(+), 17 deletions(-) diff --git a/docs/FAQ.md b/docs/FAQ.md index 6f6c941c1..dfc5c608e 100644 --- a/docs/FAQ.md +++ b/docs/FAQ.md @@ -22,12 +22,13 @@ Settings → System → Network Settings → Toggle "Enable Discovery" off → S Or set environment variable `DISCOVERY_ENABLED=false` ### How do I change the port? -Systemd: `sudo systemctl edit pulse-backend`, add `Environment="FRONTEND_PORT=8080"`, restart -Docker: Use `-e FRONTEND_PORT=8080` in your run command +Systemd: `sudo systemctl edit pulse`, add `Environment="FRONTEND_PORT=8080"`, restart +Docker: Use `-e FRONTEND_PORT=8080 -p 8080:8080` in your run command +See [Port Configuration Guide](PORT_CONFIGURATION.md) for details ### Why can't I change settings in the UI? If a setting is disabled with an amber warning, it's being overridden by an environment variable. -Remove the env var (check `sudo systemctl show pulse-backend | grep Environment`) and restart to enable UI configuration. +Remove the env var (check `sudo systemctl show pulse | grep Environment`) and restart to enable UI configuration. ### What permissions needed? - PVE: `PVEAuditor` minimum diff --git a/docs/INSTALL.md b/docs/INSTALL.md index 8ea97c08c..96b9777cb 100644 --- a/docs/INSTALL.md +++ b/docs/INSTALL.md @@ -8,6 +8,11 @@ The official installer automatically detects your environment and chooses the be curl -fsSL https://raw.githubusercontent.com/rcourtman/Pulse/main/install.sh | sudo bash ``` +The installer will prompt you for the port (default: 7655). To skip the prompt, set the environment variable: +```bash +FRONTEND_PORT=8080 curl -fsSL https://raw.githubusercontent.com/rcourtman/Pulse/main/install.sh | sudo bash +``` + ## Installation Methods ### Proxmox VE Hosts @@ -27,6 +32,7 @@ When run on a Proxmox VE host, the installer automatically: - Customize all container settings - Choose specific network bridges and storage - Configure static IP if needed +- Set custom port (default: 7655) ### Standard Linux Systems @@ -90,10 +96,14 @@ Ensure you have: - Network bridge configured ### Port Already in Use -Pulse uses port 7655 by default. Check with: +Pulse uses port 7655 by default. You can change it during installation or check current usage with: ```bash sudo netstat -tlnp | grep 7655 ``` +To use a different port during installation: +```bash +FRONTEND_PORT=8080 curl -fsSL https://raw.githubusercontent.com/rcourtman/Pulse/main/install.sh | sudo bash +``` ## Uninstalling diff --git a/docs/PORT_CONFIGURATION.md b/docs/PORT_CONFIGURATION.md index 608cc3a1a..a9d562724 100644 --- a/docs/PORT_CONFIGURATION.md +++ b/docs/PORT_CONFIGURATION.md @@ -4,7 +4,13 @@ Pulse supports multiple ways to configure the frontend port (default: 7655). ## Recommended Methods -### 1. Using systemd override (Recommended for systemd installations) +### 1. During Installation (Easiest) +The installer prompts for the port. To skip the prompt, use: +```bash +FRONTEND_PORT=8080 curl -fsSL https://raw.githubusercontent.com/rcourtman/Pulse/main/install.sh | sudo bash +``` + +### 2. Using systemd override (For existing installations) ```bash sudo systemctl edit pulse ``` @@ -15,7 +21,7 @@ Environment="FRONTEND_PORT=8080" ``` Then restart: `sudo systemctl restart pulse` -### 2. Using system.json (For persistent configuration) +### 3. Using system.json (Alternative method) Edit `/etc/pulse/system.json`: ```json { @@ -24,12 +30,10 @@ Edit `/etc/pulse/system.json`: ``` Then restart: `sudo systemctl restart pulse` -Note: This can also be configured via the Web UI settings. - -### 3. Using environment variables (Docker) +### 4. Using environment variables (Docker) For Docker deployments: ```bash -docker run -e FRONTEND_PORT=8080 -p 8080:8080 rcourtman/pulse +docker run -e FRONTEND_PORT=8080 -p 8080:8080 rcourtman/pulse:latest ``` ## Priority Order diff --git a/frontend-modern/src/components/Settings/Settings.tsx b/frontend-modern/src/components/Settings/Settings.tsx index 52efb7685..87941ad70 100644 --- a/frontend-modern/src/components/Settings/Settings.tsx +++ b/frontend-modern/src/components/Settings/Settings.tsx @@ -1283,11 +1283,12 @@ const Settings: Component = () => {

- Port Configuration: Edit /etc/pulse/.env + Port Configuration: Use systemctl edit pulse

- FRONTEND_PORT=8080
- Then restart: sudo systemctl restart pulse-backend + [Service]
+ Environment="FRONTEND_PORT=8080"
+ Then restart: sudo systemctl restart pulse

diff --git a/install.sh b/install.sh index 93e1f3e8c..d47ce3998 100755 --- a/install.sh +++ b/install.sh @@ -160,6 +160,15 @@ create_lxc_container() { fi if [[ "$ADVANCED_MODE" == "true" ]]; then + echo + # Ask for port configuration + read -p "Frontend port [7655]: " frontend_port < /dev/tty + frontend_port=${frontend_port:-7655} + if [[ ! "$frontend_port" =~ ^[0-9]+$ ]] || [[ "$frontend_port" -lt 1 ]] || [[ "$frontend_port" -gt 65535 ]]; then + print_error "Invalid port number. Using default port 7655." + frontend_port=7655 + fi + echo # Try to get cluster-wide IDs, fall back to local local USED_IDS="" @@ -261,6 +270,7 @@ create_lxc_container() { onboot=1 firewall=1 unprivileged=1 + frontend_port=7655 fi # Get available network bridges @@ -481,8 +491,12 @@ EOF cleanup_on_error fi - # Run installation quietly (suppress verbose output) - local install_output=$(pct exec $CTID -- bash /tmp/install.sh --in-container 2>&1) + # Run installation quietly (suppress verbose output) with port configuration + local install_cmd="bash /tmp/install.sh --in-container" + if [[ "$frontend_port" != "7655" ]]; then + install_cmd="FRONTEND_PORT=$frontend_port $install_cmd" + fi + local install_output=$(pct exec $CTID -- bash -c "$install_cmd" 2>&1) local install_status=$? if [[ $install_status -ne 0 ]]; then @@ -497,7 +511,7 @@ EOF echo print_success "Pulse installation complete!" echo - echo " Web UI: http://${IP}:7655" + echo " Web UI: http://${IP}:${frontend_port}" echo " Container: $CTID" echo echo " Commands:" @@ -725,6 +739,16 @@ StandardOutput=journal StandardError=journal Environment="PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" Environment="PULSE_DATA_DIR=$CONFIG_DIR" +EOF + + # Add port configuration if not default + if [[ "$FRONTEND_PORT" != "7655" ]]; then + cat >> /etc/systemd/system/$SERVICE_NAME.service << EOF +Environment="FRONTEND_PORT=$FRONTEND_PORT" +EOF + fi + + cat >> /etc/systemd/system/$SERVICE_NAME.service << EOF # Security hardening NoNewPrivileges=true @@ -764,7 +788,7 @@ print_completion() { print_header print_success "Pulse installation completed!" echo - echo -e "${GREEN}Access Pulse at:${NC} http://${IP}:7655" + echo -e "${GREEN}Access Pulse at:${NC} http://${IP}:${FRONTEND_PORT}" echo echo -e "${YELLOW}Useful commands:${NC}" echo " systemctl status $SERVICE_NAME - Check service status" @@ -792,6 +816,18 @@ main() { check_docker_environment check_pre_v4_installation + # Ask for port configuration (non-container installs) + local FRONTEND_PORT=${FRONTEND_PORT:-} + if [[ -z "$FRONTEND_PORT" ]]; then + echo + read -p "Frontend port [7655]: " FRONTEND_PORT < /dev/tty + FRONTEND_PORT=${FRONTEND_PORT:-7655} + if [[ ! "$FRONTEND_PORT" =~ ^[0-9]+$ ]] || [[ "$FRONTEND_PORT" -lt 1 ]] || [[ "$FRONTEND_PORT" -gt 65535 ]]; then + print_error "Invalid port number. Using default port 7655." + FRONTEND_PORT=7655 + fi + fi + if check_existing_installation; then # Get the latest available version for comparison local AVAILABLE_VERSION=""