[PR #238] [MERGED] feat: Add comprehensive auto-sync functionality #284

Closed
opened 2025-11-20 04:13:54 -05:00 by saavagebueno · 0 comments
Owner

📋 Pull Request Information

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

Base: mainHead: feat/auto_sync_lxc


📝 Commits (8)

  • e0bea6c feat: Add comprehensive auto-sync functionality
  • 4d12a51 fix: Auto-sync now only downloads truly new scripts
  • bf5b602 fix: Custom cron input and auto-sync rescheduling
  • a6a02a1 fix: Auto-sync file detection and script downloader initialization
  • bb4eb29 fix: Remove CommonJS require() calls in ES module context
  • 82b2012 fix: Import Buffer explicitly for ES module compatibility
  • 7817ce3 feat: Add script categorization to auto-sync notifications
  • cd2b00b fix: Resolve linter errors in autoSyncService.js

📊 Changes

14 files changed (+2792 additions, -21 deletions)

View changed files

📝 package-lock.json (+156 -18)
📝 package.json (+5 -0)
📝 server.js (+11 -0)
📝 src/app/_components/GeneralSettingsModal.tsx (+427 -1)
📝 src/app/_components/HelpModal.tsx (+98 -2)
src/app/api/settings/auto-sync/route.ts (+379 -0)
📝 src/server/api/routers/scripts.ts (+102 -0)
src/server/lib/autoSyncInit.js (+65 -0)
src/server/lib/autoSyncInit.ts (+65 -0)
src/server/services/appriseService.js (+123 -0)
src/server/services/autoSyncService.js (+542 -0)
src/server/services/githubJsonService.js (+276 -0)
src/server/services/scriptDownloader.js (+346 -0)
📝 src/server/services/scriptDownloader.ts (+197 -0)

📄 Description

🚀 Auto-Sync Feature Implementation

This PR introduces a comprehensive auto-sync system that automatically keeps the PVE Scripts Local repository synchronized with the latest scripts from GitHub.

Key Features

🔄 Automatic Synchronization

  • Configurable sync intervals: 15min, 30min, 1hour, 6hours, 12hours, 24hours, or custom cron expressions
  • Automatic JSON file synchronization from GitHub repositories
  • Smart change detection to only process modified files

📥 Script Management

  • Auto-download new scripts when JSON files are updated
  • Batch processing with configurable concurrency limits
  • Comprehensive error handling and retry logic

🔔 Notification System

  • Integration with Apprise for multi-channel notifications
  • Detailed sync status reports with success/failure counts
  • Error notifications with detailed troubleshooting information

⚙️ Configuration & Control

  • RESTful API endpoints for all auto-sync settings
  • Environment-based configuration with .env file persistence
  • Real-time status monitoring and control
  • UI integration in the settings modal

🏗️ Technical Architecture

New Services:

  • AutoSyncService: Core scheduling and execution logic
  • GitHubJsonService: Handles JSON file synchronization from GitHub
  • AppriseService: Manages multi-channel notifications
  • ScriptDownloaderService: Handles automatic script downloads and updates

API Endpoints:

  • GET/POST /api/settings/auto-sync: Auto-sync configuration management
  • Integrated with existing settings infrastructure

Configuration Options:

  • Enable/disable auto-sync functionality
  • Flexible scheduling (predefined intervals or custom cron)
  • Selective script processing (new downloads, updates, or both)
  • Notification settings with multiple Apprise URL support

🎯 Benefits

  • Reduced Maintenance: Automatically keeps scripts up-to-date without manual intervention
  • Real-time Updates: Get notified immediately when new scripts are available
  • Flexible Configuration: Adapt to different deployment needs and schedules
  • Error Resilience: Comprehensive error handling with detailed logging
  • Multi-channel Notifications: Choose your preferred notification method

🔧 Configuration Example

AUTO_SYNC_ENABLED=true
SYNC_INTERVAL_TYPE=predefined
SYNC_INTERVAL_PREDEFINED=1hour
AUTO_DOWNLOAD_NEW=true
AUTO_UPDATE_EXISTING=true
NOTIFICATION_ENABLED=true
APPRISE_URLS=["discord://webhook/your-webhook-url", "tgram://bot-token/chat-id"]

This feature significantly enhances the automation capabilities of PVE Scripts Local, making it a truly hands-off solution for script management while providing full visibility into the sync process through comprehensive notifications.


🔄 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/238 **Author:** [@michelroegl-brunner](https://github.com/michelroegl-brunner) **Created:** 10/24/2025 **Status:** ✅ Merged **Merged:** 10/24/2025 **Merged by:** [@michelroegl-brunner](https://github.com/michelroegl-brunner) **Base:** `main` ← **Head:** `feat/auto_sync_lxc` --- ### 📝 Commits (8) - [`e0bea6c`](https://github.com/community-scripts/ProxmoxVE-Local/commit/e0bea6c6e055aceecc3b29f3f5e4e5a2c273166b) feat: Add comprehensive auto-sync functionality - [`4d12a51`](https://github.com/community-scripts/ProxmoxVE-Local/commit/4d12a51b05e9eb0e814c2b9cf16acb7c9d2b6e30) fix: Auto-sync now only downloads truly new scripts - [`bf5b602`](https://github.com/community-scripts/ProxmoxVE-Local/commit/bf5b602fd1310ca6864f1365ecf1db7a91363570) fix: Custom cron input and auto-sync rescheduling - [`a6a02a1`](https://github.com/community-scripts/ProxmoxVE-Local/commit/a6a02a15feb5440a2a99f7eeb9c2c9101e4ceeda) fix: Auto-sync file detection and script downloader initialization - [`bb4eb29`](https://github.com/community-scripts/ProxmoxVE-Local/commit/bb4eb2964ba934b1f021cdc9e984c8708f8d515d) fix: Remove CommonJS require() calls in ES module context - [`82b2012`](https://github.com/community-scripts/ProxmoxVE-Local/commit/82b2012f50676eb9ea9a42234f6507027b33a43e) fix: Import Buffer explicitly for ES module compatibility - [`7817ce3`](https://github.com/community-scripts/ProxmoxVE-Local/commit/7817ce3d8e12dcc1baa5f3533d2c64870f56a63b) feat: Add script categorization to auto-sync notifications - [`cd2b00b`](https://github.com/community-scripts/ProxmoxVE-Local/commit/cd2b00b7046d3dbe628bd04de7f8e1e83bd9f35e) fix: Resolve linter errors in autoSyncService.js ### 📊 Changes **14 files changed** (+2792 additions, -21 deletions) <details> <summary>View changed files</summary> 📝 `package-lock.json` (+156 -18) 📝 `package.json` (+5 -0) 📝 `server.js` (+11 -0) 📝 `src/app/_components/GeneralSettingsModal.tsx` (+427 -1) 📝 `src/app/_components/HelpModal.tsx` (+98 -2) ➕ `src/app/api/settings/auto-sync/route.ts` (+379 -0) 📝 `src/server/api/routers/scripts.ts` (+102 -0) ➕ `src/server/lib/autoSyncInit.js` (+65 -0) ➕ `src/server/lib/autoSyncInit.ts` (+65 -0) ➕ `src/server/services/appriseService.js` (+123 -0) ➕ `src/server/services/autoSyncService.js` (+542 -0) ➕ `src/server/services/githubJsonService.js` (+276 -0) ➕ `src/server/services/scriptDownloader.js` (+346 -0) 📝 `src/server/services/scriptDownloader.ts` (+197 -0) </details> ### 📄 Description ## 🚀 Auto-Sync Feature Implementation This PR introduces a comprehensive auto-sync system that automatically keeps the PVE Scripts Local repository synchronized with the latest scripts from GitHub. ### ✨ Key Features **🔄 Automatic Synchronization** - Configurable sync intervals: 15min, 30min, 1hour, 6hours, 12hours, 24hours, or custom cron expressions - Automatic JSON file synchronization from GitHub repositories - Smart change detection to only process modified files **📥 Script Management** - Auto-download new scripts when JSON files are updated - Batch processing with configurable concurrency limits - Comprehensive error handling and retry logic **🔔 Notification System** - Integration with Apprise for multi-channel notifications - Detailed sync status reports with success/failure counts - Error notifications with detailed troubleshooting information **⚙️ Configuration & Control** - RESTful API endpoints for all auto-sync settings - Environment-based configuration with .env file persistence - Real-time status monitoring and control - UI integration in the settings modal ### 🏗️ Technical Architecture **New Services:** - `AutoSyncService`: Core scheduling and execution logic - `GitHubJsonService`: Handles JSON file synchronization from GitHub - `AppriseService`: Manages multi-channel notifications - `ScriptDownloaderService`: Handles automatic script downloads and updates **API Endpoints:** - `GET/POST /api/settings/auto-sync`: Auto-sync configuration management - Integrated with existing settings infrastructure **Configuration Options:** - Enable/disable auto-sync functionality - Flexible scheduling (predefined intervals or custom cron) - Selective script processing (new downloads, updates, or both) - Notification settings with multiple Apprise URL support ### 🎯 Benefits - **Reduced Maintenance**: Automatically keeps scripts up-to-date without manual intervention - **Real-time Updates**: Get notified immediately when new scripts are available - **Flexible Configuration**: Adapt to different deployment needs and schedules - **Error Resilience**: Comprehensive error handling with detailed logging - **Multi-channel Notifications**: Choose your preferred notification method ### 🔧 Configuration Example ```env AUTO_SYNC_ENABLED=true SYNC_INTERVAL_TYPE=predefined SYNC_INTERVAL_PREDEFINED=1hour AUTO_DOWNLOAD_NEW=true AUTO_UPDATE_EXISTING=true NOTIFICATION_ENABLED=true APPRISE_URLS=["discord://webhook/your-webhook-url", "tgram://bot-token/chat-id"] ``` This feature significantly enhances the automation capabilities of PVE Scripts Local, making it a truly hands-off solution for script management while providing full visibility into the sync process through comprehensive notifications. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
saavagebueno added the pull-request label 2025-11-20 04:13:54 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: SVI/ProxmoxVE-Local#284