Skip to content

fix: update Pulse scripts for v4 Go rewrite support #6574

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Aug 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 14 additions & 22 deletions ct/pulse.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,42 +23,34 @@ function update_script() {
header_info
check_container_storage
check_container_resources
if [[ -d /opt/pulse-monitor ]]; then
msg_error "An old installation was detected. Please recreate the LXC from scratch (https://github.com/community-scripts/ProxmoxVE/pull/4848)"
exit 1
fi
if [[ ! -d /opt/pulse ]]; then
msg_error "No ${APP} Installation Found!"
exit
fi
RELEASE=$(curl -fsSL https://api.github.com/repos/rcourtman/Pulse/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then

if [[ ! -f ~/.pulse ]]; then
msg_error "Old Installation Found! Please recreate the container due big changes in the software."
exit 1
fi

RELEASE=$(curl -fsSL https://api.github.com/repos/rcourtman/Pulse/releases/latest | jq -r '.tag_name' | sed 's/^v//')
if [[ "${RELEASE}" != "$(cat ~/.pulse 2>/dev/null)" ]] || [[ ! -f ~/.pulse ]]; then
msg_info "Stopping ${APP}"
systemctl stop pulse
msg_ok "Stopped ${APP}"

msg_info "Updating Pulse"
temp_file=$(mktemp)
mkdir -p /opt/pulse
rm -rf /opt/pulse/*
curl -fsSL "https://github.com/rcourtman/Pulse/releases/download/v${RELEASE}/pulse-v${RELEASE}.tar.gz" -o "$temp_file"
tar zxf "$temp_file" --strip-components=1 -C /opt/pulse
echo "${RELEASE}" >/opt/${APP}_version.txt
msg_ok "Updated Pulse to ${RELEASE}"

msg_info "Setting permissions for /opt/pulse..."
chown -R pulse:pulse "/opt/pulse"
find "/opt/pulse" -type d -exec chmod 755 {} \;
find "/opt/pulse" -type f -exec chmod 644 {} \;
msg_ok "Set permissions."
fetch_and_deploy_gh_release "pulse" "rcourtman/Pulse" "prebuild" "latest" "/opt/pulse" "*-linux-amd64.tar.gz"
chown -R pulse:pulse /etc/pulse /opt/pulse

msg_info "Starting ${APP}"
systemctl start pulse
msg_ok "Started ${APP}"

msg_ok "Updated Successfully"
else
msg_ok "No update required. ${APP} is already at ${RELEASE}."
msg_ok "No update required. ${APP} is already at v${RELEASE}"
fi
exit
exit
}

start
Expand Down
37 changes: 11 additions & 26 deletions install/pulse-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,50 +20,36 @@ $STD apt-get install -y \
policykit-1
msg_ok "Installed Dependencies"

msg_info "Creating dedicated user pulse..."
msg_info "Creating User"
if useradd -r -m -d /opt/pulse-home -s /bin/bash pulse; then
msg_ok "User created."
msg_ok "Created User"
else
msg_error "User creation failed."
msg_error "User creation failed"
exit 1
fi

NODE_VERSION="20" setup_nodejs

msg_info "Setup Pulse"
RELEASE=$(curl -fsSL https://api.github.com/repos/rcourtman/Pulse/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
temp_file=$(mktemp)
mkdir -p /opt/pulse
curl -fsSL "https://github.com/rcourtman/Pulse/releases/download/v${RELEASE}/pulse-v${RELEASE}.tar.gz" -o "$temp_file"
tar zxf "$temp_file" --strip-components=1 -C /opt/pulse
touch /opt/pulse/.env
chown pulse:pulse /opt/pulse/.env
echo "${RELEASE}" >/opt/${APPLICATION}_version.txt
fetch_and_deploy_gh_release "pulse" "rcourtman/Pulse" "prebuild" "latest" "/opt/pulse" "*-linux-amd64.tar.gz"
chown -R pulse:pulse /etc/pulse /opt/pulse
msg_ok "Installed Pulse"

msg_info "Setting permissions for /opt/pulse..."
chown -R pulse:pulse "/opt/pulse"
find "/opt/pulse" -type d -exec chmod 755 {} \;
find "/opt/pulse" -type f -exec chmod 644 {} \;
msg_ok "Set permissions."

msg_info "Creating Service"
cat <<EOF >/etc/systemd/system/pulse.service
[Unit]
Description=Pulse Monitoring Application
Description=Pulse Monitoring Server
After=network.target

[Service]
Type=simple
User=pulse
Group=pulse
WorkingDirectory=/opt/pulse
EnvironmentFile=/opt/pulse/.env
ExecStart=/usr/bin/npm run start
Restart=on-failure
RestartSec=5
ExecStart=/opt/pulse/pulse
Restart=always
RestartSec=3
StandardOutput=journal
StandardError=journal
Environment="PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
Environment="PULSE_DATA_DIR=/etc/pulse"

[Install]
WantedBy=multi-user.target
Expand All @@ -75,7 +61,6 @@ motd_ssh
customize

msg_info "Cleaning up"
rm -f "$temp_file"
$STD apt-get -y autoremove
$STD apt-get -y autoclean
msg_ok "Cleaned"