Split server manager vendors into separate files#4
Draft
marceldarvas wants to merge 5 commits intogridpane:masterfrom
Draft
Split server manager vendors into separate files#4marceldarvas wants to merge 5 commits intogridpane:masterfrom
marceldarvas wants to merge 5 commits intogridpane:masterfrom
Conversation
This change splits vendor-specific functions into separate modular files to improve maintainability and prevent script failures. Each vendor now has its own file in the vendors/ directory: - vendors/serverpilot.sh - ServerPilot-specific functions - vendors/runcloud.sh - RunCloud-specific functions - vendors/gridpane.sh - GridPane-specific functions - vendors/cpanel.sh - CPanel-specific functions Benefits: - Isolates vendor-specific code to prevent one vendor's issues from affecting others - Makes the codebase more maintainable and easier to debug - Reduces the size of the main primemover.sh file from 2064 to 1051 lines - Allows for easier addition of new vendor support in the future The main primemover.sh file now sources these vendor files dynamically at runtime, preserving all existing functionality while improving code organization.
Major improvements to ensure smooth ServerPilot → GridPane migrations: **Critical Fixes:** - Add GridPane API token validation with pre-flight testing - Implement disk space verification before packaging (prevents disk full errors) - Fix bash_profile sourcing to prevent startup errors - Add comprehensive timestamped logging to /var/tmp/primemover/ **Error Handling:** - Implement HandleError() function with detailed error reporting - Add exit code checking for all critical operations - Validate database exports are not empty - Verify tar.gz archives are created successfully - Check SCP and restoration status codes **Improved Reliability:** - Replace fixed sleep delays with intelligent polling (WaitForRemoteSite) - Add configurable timeouts with progress indicators - Verify GridPane API responses for errors - Add post-migration verification (VerifySiteMigration) - Confirms WordPress is installed - Validates database connectivity - Verifies site URL **Better User Experience:** - Add progress reporting throughout migration - Display file sizes during transfers - Show clear success/failure messages - Provide detailed log file references - Add pre-flight checks before batch migrations **Enhanced Functions:** - DBExport: Better error handling, validates credentials and export - PackageSite: Disk space check, validates archive creation - MakeSiteonRemote: API error checking, polling instead of fixed sleep - DoMigrate: Full verification of transfer and restoration - SPtoGP/RCtoGP: Complete pre-flight validation **Documentation:** - Add comprehensive IMPROVEMENTS.md detailing all changes - Update README.md with improvement highlights - Include testing recommendations and troubleshooting guide These improvements transform ServerPilot → GridPane migrations from alpha quality to production-ready with proper validation, error handling, and verification at every step.
…ion-011CV6FKzHSrRoyBxaye1fuN Enhance ServerPilot to GridPane migration reliability and robustness
Merged reliability and robustness enhancements from PR #2 into the new modular vendor structure. This combines the best of both approaches: vendor separation for maintainability + comprehensive error handling and validation for production readiness. **Core Improvements Added:** - Timestamped logging system (LOGFILE) with LogMessage() function - Comprehensive error handling with HandleError() function - Disk space validation before packaging with CheckDiskSpace() - GridPane API token validation with ValidateGridPaneToken() - Intelligent polling with WaitForRemoteSite() instead of fixed sleeps - Post-migration verification with VerifySiteMigration() **Enhanced Functions:** - DBExport: Added error checking, validation, and logging - Checks exit codes from wp-cli and mysqldump - Validates database credentials before mysqldump - Verifies exported file exists and is not empty - Reports database file size - MakeSiteonRemote (GridPane): Improved reliability - Added logging for all operations - Validates API responses for errors - Uses polling instead of fixed sleep delays - Better error handling throughout **Benefits:** - Production-ready error handling on top of modular structure - Detailed logs for troubleshooting migration issues - Prevents common failures (disk space, empty exports) - Validates operations succeed before proceeding - Clear success/failure reporting to users This establishes a solid foundation for applying additional vendor-specific improvements in subsequent commits.
Resolved merge conflicts by properly integrating improvements from master into the vendor-separated structure. **Conflict Resolution:** - primemover.sh: Kept functions removed (moved to vendor files) - Moved improved SPtoGP to vendors/serverpilot.sh - Moved improved RCtoGP to vendors/runcloud.sh **Improvements Applied to Vendor Functions:** SPtoGP (ServerPilot → GridPane): - Added logging for migration start - GridPane API token validation - Disk space check (15GB on /srv/users) - Remote IP prompting with validation - SSH connection setup - Migration summary with log file reference RCtoGP (RunCloud → GridPane): - Added logging for migration start - GridPane API token validation - Disk space check (15GB on /home) - Remote IP prompting with validation - SSH connection setup - Migration summary with log file reference **Files Added from Master:** - IMPROVEMENTS.md: Detailed documentation of PR #2 improvements - README.md: Updated with improvement highlights This merge successfully combines: ✓ Modular vendor structure for maintainability ✓ Production-ready error handling and logging ✓ Pre-flight validation (API tokens, disk space) ✓ Comprehensive user feedback and summaries All syntax validated. Ready for testing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This change splits vendor-specific functions into separate modular files to improve maintainability and prevent script failures. Each vendor now has its own file in the vendors/ directory:
Benefits:
The main primemover.sh file now sources these vendor files dynamically at runtime, preserving all existing functionality while improving code organization.