Created standalone test launcher to verify multi-platform support before modifying production launcher.sh. Features: - Platform-specific domain discovery (cPanel, Plesk, standalone) - Uses panel-agnostic functions from domain-discovery.sh - Compares results with production database - Safe to run without affecting launcher.sh Test Results on cPanel: - ✅ Successfully detects platform (cpanel) - ✅ Finds users (1 user) - ✅ Finds domains (1 main domain) - ✅ Finds databases (1 database) - ✅ Extracts docroot, logs, PHP version correctly Next: Test on Plesk server to verify Plesk detection works Documentation: - FINAL_AUDIT_VERIFIED.md - Complete audit after quad-checking - CORRECTED_AUDIT_SUMMARY.md - Summary of corrections - CROSS_PLATFORM_PLAN.md - Implementation roadmap Usage: bash test-launcher.sh Output: Creates .sysref-test file for inspection Compares with production .sysref if exists Shows platform detection and sample domain data Status: ✅ Ready for Plesk testing 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
10 KiB
Cross-Platform Launcher Implementation Plan
Executive Summary
Transform the launcher from cPanel-only to fully cross-platform supporting:
- Control Panels: cPanel, Plesk, InterWorx
- Standalone Systems: Debian, Ubuntu, AlmaLinux, Rocky Linux, RHEL, CentOS
Current State Analysis
What Works ✅
- lib/system-detect.sh - Already detects all platforms correctly
- lib/domain-discovery.sh - Has unified functions for cPanel/Plesk/InterWorx
- lib/plesk-helpers.sh - 31 Plesk-specific helper functions ready
- lib/user-manager.sh - Already has Plesk/InterWorx support for user/database queries
- lib/common-functions.sh - Platform-agnostic utility functions
What's Broken ❌
- lib/reference-db.sh - Hardcoded cPanel dependencies in 4 locations:
- Line 255, 265: Uses
/var/cpanel/userdatafor domain configs - Line 370, 390: Uses
/etc/trueuserdomainsfor domain ownership
- Line 255, 265: Uses
- build_domains_section() - 100% cPanel-specific (parses cPanel userdata files)
- build_wordpress_section() - Assumes
/home/username/directory structure
Platform-Specific Characteristics
Control Panel Systems
cPanel
- Users:
/var/cpanel/users/ - Domains:
/etc/userdomains,/etc/trueuserdomains - Config:
/var/cpanel/userdata/{user}/{domain} - Home:
/home/{user}/ - Logs:
/var/log/apache2/domlogs/ - Detection:
/usr/local/cpanel/version
Plesk
- Users: MySQL query to
psa.sys_users - Domains:
plesk bin site --listor MySQLpsa.domains - Config:
/var/www/vhosts/{domain}/conf/ - Home:
/var/www/vhosts/{domain}/ - Logs:
/var/www/vhosts/system/{domain}/logs/ - Detection:
/usr/local/psa/version
InterWorx
- Users:
/home/interworx/var/ - Domains:
~iworx/bin/listaccounts.pex - Config:
/home/{user}/var/{domain}/ - Home:
/chroot/home/{user}/ - Logs:
/home/{user}/var/{domain}/logs/ - Detection:
/usr/local/interworx/bin/status.pex
Standalone Systems (No Control Panel)
Common Characteristics
- Users: Standard
/etc/passwd(UID >= 1000) - Domains: Detect from:
- Apache/Nginx vhosts:
/etc/apache2/sites-enabled/,/etc/nginx/sites-enabled/ /etc/hostsentries- DNS records (if available)
- Apache/Nginx vhosts:
- Home:
/home/{user}/or/var/www/ - Logs:
/var/log/apache2/,/var/log/nginx/ - Web roots:
/var/www/html/,/var/www/{domain}/,/usr/share/nginx/html/
Debian/Ubuntu Specific
- Apache config:
/etc/apache2/sites-available/ - Nginx config:
/etc/nginx/sites-available/ - Default web root:
/var/www/html/ - Package manager:
apt
RHEL/AlmaLinux/Rocky/CentOS Specific
- Apache config:
/etc/httpd/conf.d/ - Nginx config:
/etc/nginx/conf.d/ - Default web root:
/var/www/html/or/usr/share/nginx/html/ - Package manager:
dnforyum
Implementation Strategy
Phase 1: Refactor build_domains_section() 🎯 PRIORITY
Current Issue: Entirely cPanel-specific, parses userdata files
Solution: Create platform-specific domain discovery logic
build_domains_section() {
echo "[DOMAINS]" >> "$SYSREF_DB"
case "$SYS_CONTROL_PANEL" in
cpanel)
build_domains_cpanel
;;
plesk)
build_domains_plesk
;;
interworx)
build_domains_interworx
;;
*)
build_domains_standalone
;;
esac
finish_progress
echo "" >> "$SYSREF_DB"
}
Sub-functions to create:
build_domains_cpanel()- Keep existing logicbuild_domains_plesk()- Use plesk_list_domains + plesk_get_* functionsbuild_domains_interworx()- Use InterWorx CLI toolsbuild_domains_standalone()- Parse Apache/Nginx vhosts
Phase 2: Refactor build_wordpress_section()
Current Issue: Assumes /home/username/ paths, uses cPanel-specific logic
Solution: Use $SYS_USER_HOME_BASE and panel-agnostic path parsing
build_wordpress_section() {
echo "[WORDPRESS]" >> "$SYSREF_DB"
# Use panel-agnostic search paths
case "$SYS_CONTROL_PANEL" in
cpanel)
search_paths="/home/*/public_html"
;;
plesk)
search_paths="/var/www/vhosts/*/httpdocs /var/www/vhosts/*/httpsdocs"
;;
interworx)
search_paths="/chroot/home/*/var/*/html"
;;
*)
search_paths="/var/www/*/public_html /var/www/html /home/*/public_html"
;;
esac
# Find wp-config.php in all search paths
# Extract domain/owner using get_domain_owner() and path analysis
}
Phase 3: Add Standalone Web Server Detection
New functions needed in system-detect.sh:
detect_vhosts_standalone() {
# Scan Apache sites-enabled
if [ -d /etc/apache2/sites-enabled ]; then
# Parse ServerName/ServerAlias from .conf files
fi
# Scan Nginx sites-enabled
if [ -d /etc/nginx/sites-enabled ]; then
# Parse server_name from .conf files
fi
# Parse /etc/httpd/conf.d/ for RHEL-based
}
Phase 4: Enhance Domain Discovery for Standalone
New helper library: lib/standalone-helpers.sh
Functions needed:
standalone_list_domains()- Parse vhost configsstandalone_get_docroot()- Extract DocumentRoot/root directivestandalone_get_logdir()- Extract log paths from vhost configsstandalone_get_owner()- Usestat -c "%U"on document rootstandalone_list_users()- Filter /etc/passwd for UID >= 1000
Phase 5: Universal WordPress Detection
Current limitations: Only searches /home/ paths
Enhanced approach:
# Multi-path WordPress scanner
find_wordpress_installations() {
local search_paths=""
case "$SYS_CONTROL_PANEL" in
cpanel) search_paths="/home" ;;
plesk) search_paths="/var/www/vhosts" ;;
interworx) search_paths="/chroot/home" ;;
*)
# Standalone: check common webroot locations
search_paths="/var/www /home /usr/share/nginx"
;;
esac
# Find all wp-config.php files
find $search_paths -name wp-config.php -type f 2>/dev/null
}
Implementation Phases with Testing
Phase 1: Reference Database Refactor (Week 1)
- Create
build_domains_cpanel()(extract existing code) - Create
build_domains_plesk()(use plesk-helpers) - Create
build_domains_interworx()(use interworx-helpers if exists) - Create
build_domains_standalone()(new vhost parser) - Test on cPanel server (verify no regression)
- Test on Plesk server (verify domain discovery)
Phase 2: WordPress Detection (Week 1)
- Refactor
build_wordpress_section()with multi-path search - Add panel-specific path extraction logic
- Test on cPanel (verify existing WordPress detected)
- Test on Plesk (verify WordPress detected)
- Test on standalone Ubuntu (verify WordPress detected)
Phase 3: Standalone Helpers (Week 2)
- Create
lib/standalone-helpers.sh - Implement vhost parsing (Apache)
- Implement vhost parsing (Nginx)
- Implement user discovery (UID filtering)
- Add exports to domain-discovery.sh
- Test on Debian/Ubuntu with Apache
- Test on AlmaLinux with Nginx
Phase 4: Integration Testing (Week 2)
- Test full launcher on cPanel server
- Test full launcher on Plesk server
- Test full launcher on InterWorx server (if available)
- Test full launcher on Ubuntu standalone
- Test full launcher on AlmaLinux standalone
- Test full launcher on Debian standalone
Phase 5: Documentation (Week 3)
- Update README with platform support matrix
- Document standalone system requirements
- Create troubleshooting guide for each platform
- Add platform-specific installation notes
Database Format Compatibility
The current .sysref format is already platform-agnostic:
DOMAIN|domain|owner|docroot|logdir|access_log|php_version|is_primary|type|aliases|http|https|status
All fields map universally:
domain- Same on all platformsowner- Username from any systemdocroot- Absolute path (any location)logdir- Absolute path (any location)access_log- Absolute path (any location)php_version- Detected version stringis_primary- yes/no (determined by logic)type- primary/addon/alias/subdomain (universal concepts)aliases- Space-separated listhttp/https/status- HTTP status codes (universal)
No format changes needed - only the methods to populate these fields change per platform.
Risk Mitigation
Backward Compatibility
- ✅ Keep all existing cPanel code paths functional
- ✅ Use case statements for platform-specific logic
- ✅ Default to cPanel behavior if platform unknown
- ✅ Existing cPanel installations continue working without changes
Testing Strategy
- ✅ Test on live cPanel server FIRST (prevent regressions)
- ✅ Test on Plesk server SECOND (validate new platform)
- ✅ Test on standalone systems THIRD (validate fallback logic)
- ✅ Keep old commits in git history for easy revert
Fallback Mechanisms
- ✅ If vhost parsing fails → scan /var/www for directories
- ✅ If user detection fails → show "unknown" owner
- ✅ If WordPress detection fails → skip silently (don't crash)
- ✅ If domain discovery returns empty → try manual directory scan
Success Criteria
Minimum Viable Product (MVP)
- cPanel: 100% functional (already working)
- Plesk: Domain/user/database discovery working
- Standalone: Basic domain/WordPress detection working
Full Feature Parity
- All platforms detect domains correctly
- All platforms detect WordPress installations
- All platforms show correct ownership
- All platforms display accurate statistics
- All modules work on all platforms (or gracefully skip)
Next Immediate Steps
- Create standalone-helpers.sh - New helper library for non-panel systems
- Refactor build_domains_section() - Split into platform-specific functions
- Test on cPanel - Ensure no regressions
- Test on Plesk - Validate Plesk domain discovery
- Document platform support - Update README with compatibility matrix
Estimated Timeline: 2-3 weeks for full cross-platform support Priority: High - Blocking Plesk deployment Risk: Medium - Potential for breaking cPanel if not careful Complexity: Medium-High - Requires understanding 4+ different platforms