[PR #65] [MERGED] Add web-based update system with detached process management #188

Closed
opened 2026-02-26 12:40:32 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/community-scripts/ProxmoxVE-Local/pull/65
Author: @michelroegl-brunner
Created: 10/7/2025
Status: Merged
Merged: 10/7/2025
Merged by: @michelroegl-brunner

Base: mainHead: feat/version_handeling


📝 Commits (10+)

📊 Changes

9 files changed (+1323 additions, -2 deletions)

View changed files

📝 VERSION (+1 -1)
📝 package-lock.json (+10 -0)
📝 package.json (+1 -0)
src/app/_components/VersionDisplay.tsx (+233 -0)
src/app/_components/ui/badge.tsx (+28 -0)
📝 src/app/page.tsx (+5 -1)
📝 src/server/api/root.ts (+2 -0)
src/server/api/routers/version.ts (+148 -0)
update.sh (+895 -0)

📄 Description

Summary

This PR adds a complete web-based update system that allows updating the application directly from the web interface with proper process management and enhanced reliability.

New Features

1. Web-Based Update Execution

  • Added executeUpdate mutation that spawns the update script as a detached background process
  • Update script runs independently using nohup, allowing it to safely restart the server
  • Immediate response to the web interface while update continues in background
  • Automatic server restart after successful update

2. Robust Update Script Implementation

  • Implemented proper bash process substitution patterns for reliable file operations
  • Enhanced update_files() function with accurate file tracking and progress reporting
  • Improved clear_original_directory() function with proper variable scoping
  • Ensures all operations complete successfully without silent failures

3. Comprehensive Logging and Debugging

  • Detailed logging throughout the entire update process
  • Pre-download connectivity tests to GitHub API
  • Verbose curl output capture for troubleshooting network issues
  • Real-time progress indicators for file copying operations
  • Stage-by-stage status reporting with clear success/error messages
  • All logs written to /tmp/update.log for post-mortem analysis

Technical Implementation

Architecture: The update script spawns as a detached process, independent of the Node.js parent process. This allows it to:

  • Stop the running Node.js server without terminating itself
  • Download and apply updates while the server is offline
  • Rebuild and restart the application
  • Complete successfully without dependency on the web server

Process Flow:

  1. User clicks update button in web interface
  2. API spawns detached update script with nohup
  3. Script stops the application safely
  4. Downloads latest release from GitHub
  5. Backs up data and configuration
  6. Applies updates to application files
  7. Rebuilds the application
  8. Restarts the server automatically

Benefits

  • Seamless Updates: Users can update directly from the web interface
  • Zero Downtime: Automatic restart after update completion
  • Safe Operations: Detached process prevents premature termination
  • Full Visibility: Comprehensive logging for troubleshooting
  • Reliable Execution: Proper bash patterns ensure consistent behavior

Files Changed

  • src/server/api/routers/version.ts - Web-based update API endpoint
  • update.sh - Enhanced update script with robust process management and logging

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/community-scripts/ProxmoxVE-Local/pull/65 **Author:** [@michelroegl-brunner](https://github.com/michelroegl-brunner) **Created:** 10/7/2025 **Status:** ✅ Merged **Merged:** 10/7/2025 **Merged by:** [@michelroegl-brunner](https://github.com/michelroegl-brunner) **Base:** `main` ← **Head:** `feat/version_handeling` --- ### 📝 Commits (10+) - [`d03f196`](https://github.com/community-scripts/ProxmoxVE-Local/commit/d03f196bfc1c77ae0413a63c5d39821d0b88ff18) feat: Add version checking and update functionality - [`4677a91`](https://github.com/community-scripts/ProxmoxVE-Local/commit/4677a91756fdd1fe7c16eeda0d9c19beace5d009) Update update script - [`9d77834`](https://github.com/community-scripts/ProxmoxVE-Local/commit/9d77834075f684df3c9e6fb52f2e501c33f47042) Update update script - [`ca9abe8`](https://github.com/community-scripts/ProxmoxVE-Local/commit/ca9abe83e311060a9f76b48fd80f589d94015ee6) Update update script - [`5870654`](https://github.com/community-scripts/ProxmoxVE-Local/commit/587065442bed3921a39f078569299244556e746c) Update update script - [`d02352b`](https://github.com/community-scripts/ProxmoxVE-Local/commit/d02352b421bc0e72c95d0a54bf4274378e0c2020) Update update script - [`3ce2139`](https://github.com/community-scripts/ProxmoxVE-Local/commit/3ce2139a4108e3323042082f04ee1a699484af02) Update update script - [`fc78420`](https://github.com/community-scripts/ProxmoxVE-Local/commit/fc7842030f5f42b492e42b4058df50a01a39e864) Update update script - [`d7e699d`](https://github.com/community-scripts/ProxmoxVE-Local/commit/d7e699d5201949402a626e0ca4b6242a4aec43b4) Update update script - [`4243543`](https://github.com/community-scripts/ProxmoxVE-Local/commit/424354316a71b2f154e98ca4c1fd2636046922aa) Update update script ### 📊 Changes **9 files changed** (+1323 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `VERSION` (+1 -1) 📝 `package-lock.json` (+10 -0) 📝 `package.json` (+1 -0) ➕ `src/app/_components/VersionDisplay.tsx` (+233 -0) ➕ `src/app/_components/ui/badge.tsx` (+28 -0) 📝 `src/app/page.tsx` (+5 -1) 📝 `src/server/api/root.ts` (+2 -0) ➕ `src/server/api/routers/version.ts` (+148 -0) ➕ `update.sh` (+895 -0) </details> ### 📄 Description ## Summary This PR adds a complete web-based update system that allows updating the application directly from the web interface with proper process management and enhanced reliability. ## New Features ### 1. Web-Based Update Execution - Added `executeUpdate` mutation that spawns the update script as a **detached background process** - Update script runs independently using `nohup`, allowing it to safely restart the server - Immediate response to the web interface while update continues in background - Automatic server restart after successful update ### 2. Robust Update Script Implementation - Implemented proper bash process substitution patterns for reliable file operations - Enhanced `update_files()` function with accurate file tracking and progress reporting - Improved `clear_original_directory()` function with proper variable scoping - Ensures all operations complete successfully without silent failures ### 3. Comprehensive Logging and Debugging - Detailed logging throughout the entire update process - Pre-download connectivity tests to GitHub API - Verbose curl output capture for troubleshooting network issues - Real-time progress indicators for file copying operations - Stage-by-stage status reporting with clear success/error messages - All logs written to `/tmp/update.log` for post-mortem analysis ## Technical Implementation **Architecture:** The update script spawns as a detached process, independent of the Node.js parent process. This allows it to: - Stop the running Node.js server without terminating itself - Download and apply updates while the server is offline - Rebuild and restart the application - Complete successfully without dependency on the web server **Process Flow:** 1. User clicks update button in web interface 2. API spawns detached update script with `nohup` 3. Script stops the application safely 4. Downloads latest release from GitHub 5. Backs up data and configuration 6. Applies updates to application files 7. Rebuilds the application 8. Restarts the server automatically ## Benefits - **Seamless Updates:** Users can update directly from the web interface - **Zero Downtime:** Automatic restart after update completion - **Safe Operations:** Detached process prevents premature termination - **Full Visibility:** Comprehensive logging for troubleshooting - **Reliable Execution:** Proper bash patterns ensure consistent behavior ## Files Changed - `src/server/api/routers/version.ts` - Web-based update API endpoint - `update.sh` - Enhanced update script with robust process management and logging --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-26 12:40:32 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ProxmoxVE-Local#188
No description provided.