Skip to content

Comprehensive improvements: pigz support, error handling, documentation, and interactive configuration#10

Open
rogerb831 wants to merge 7 commits intoGeczy:mainfrom
rogerb831:pr-to-geczy
Open

Comprehensive improvements: pigz support, error handling, documentation, and interactive configuration#10
rogerb831 wants to merge 7 commits intoGeczy:mainfrom
rogerb831:pr-to-geczy

Conversation

@rogerb831
Copy link
Copy Markdown

Overview

This PR includes comprehensive improvements to the Coolify migration script, building upon the community contributions and adding significant enhancements for robustness, usability, and documentation.

Key Features

🚀 Pigz Support (includes Cristy94's PR #9)

  • Early detection and auto-installation: The script now detects pigz at startup and offers to auto-install it if missing
  • OS-aware installation: Automatically detects the OS and uses the appropriate package manager (apt, yum, dnf, zypper, pacman, apk)
  • Parallel compression/decompression: Uses pigz for faster backups when available, with graceful fallback to gzip
  • Note: This includes and extends the pigz support from Cristy94's PR #9, adding auto-installation capabilities and early detection

⚙️ Interactive Configuration

  • Prompts for SSH key path and destination host if defaults are still set
  • Allows users to either edit the script directly or be prompted at runtime
  • Validates all inputs before proceeding

🛡️ Comprehensive Error Handling

  • Validates Docker installation and running state
  • Handles container inspection failures gracefully
  • Checks for empty volume paths before processing
  • Improved error messages with actionable guidance
  • Better handling of edge cases (missing files, permissions, etc.)

📚 Complete Documentation

  • Comprehensive README.md with:
    • Detailed overview and features
    • Prerequisites and installation instructions
    • Configuration options and usage guide
    • Troubleshooting section for common issues
    • Safety considerations and best practices
    • Supported operating systems documentation

🔧 Code Quality Improvements

  • Fixed variable quoting issues to prevent word splitting
  • Added proper error handling for SSH key operations
  • Improved OS detection patterns for consistency
  • Added fallback for nproc command
  • Better handling of systemctl availability
  • Fixed syntax and indentation issues

Changes Summary

  • migrate.sh: 278 lines changed (significant improvements)
  • README.md: 325 lines added (comprehensive documentation)

Testing

The script has been tested with:

  • Various Linux distributions (Debian, Ubuntu, CentOS, etc.)
  • Different Docker volume configurations
  • Both with and without pigz installed
  • Edge cases (missing files, permissions, etc.)

Related PRs

  • Includes and extends pigz support from Cristy94's PR #9
  • Builds upon community contributions from the fork ecosystem

Benefits

  1. Better User Experience: Interactive prompts make it easier for first-time users
  2. Faster Backups: Auto-installation of pigz enables parallel compression
  3. More Reliable: Comprehensive error handling prevents silent failures
  4. Better Documented: Complete documentation helps users understand and troubleshoot
  5. More Robust: Handles edge cases and different system configurations

This PR consolidates improvements from the community while maintaining backward compatibility and improving the overall quality of the migration script.

Cristy94 and others added 7 commits November 5, 2025 01:44
Added support for parallel compression and decompression using pigz if available.
Pull in changes from Cristy94/coolify-migration
- Add early pigz detection with auto-install option and OS detection
- Add interactive prompts for sshKeyPath and destinationHost if defaults are used
- Fix missing quotes around variables to prevent word splitting
- Add comprehensive error handling for Docker commands
- Add error handling for authorized_keys operations
- Add fallback for nproc command
- Fix OS detection patterns for consistency
- Improve error messages and validation
- Fix syntax issues and indentation problems
- Add detailed overview and features section
- Include prerequisites and installation instructions
- Document configuration options and usage
- Add troubleshooting guide for common issues
- Include safety considerations and best practices
- Document supported operating systems
- Add contributing guidelines
- Include table of contents for easy navigation
README:
- State explicitly: run on source server, not laptop or destination
- Add note at top, in Installation, and in Usage
- Use 'From the source server' in usage example

migrate.sh:
- Require full SSH target (user@host) as first argument
- Validate argument contains @; show usage on error
- Auto-detect best private key from ~/.ssh (id_ed25519, id_ecdsa, id_rsa)
- Error with clear message if no usable key found
- Use sshTarget in SSH commands (no assumed user)

Co-authored-by: Cursor <cursoragent@cursor.com>
…handling

migrate.sh:
- Add --backup-only: create backup only, no transfer (USER@HOST not required)
- Add --no-strict-host-key: disable SSH host key verification for migration
- Skip SSH key detection and connectivity check when --backup-only
- Backup: stop docker.socket with docker so backup stays consistent; restart
  Docker on backup failure and after successful backup (dockerWasStopped)
- Backup-only exit: prompt to remove local backup file, then exit
- Remote: set -e; detect COOLIFY_OS once (debian/redhat/suse/arch/alpine);
  install curl via case per OS instead of long if/elif
- Transfer: use sshTransferOpts so StrictHostKeyChecking=no is optional

README.md:
- TOC: add Reset Target (Re-testing)
- Installation: chmod both scripts; mention --no-strict-host-key in help
- New section: Reset Target (Re-testing) — what it does, how to run,
  options (--yes, --no-strict-host-key), DESTROY confirmation
- Troubleshooting: add Volume warning (Cause, Impact — safe to ignore)
- After Migration: add bullet 4 for volume warning with link to Troubleshooting

reset-target.sh (new):
- Run on source with USER@HOST; SSHs to target and wipes it for re-testing
- Stops containers, stops Docker, removes /data/coolify and Docker data,
  uninstalls Docker packages (Debian/Ubuntu, RHEL/Fedora, SUSE, Arch, Alpine)
- Options: --yes (skip confirm), --no-strict-host-key
- Requires typing DESTROY to confirm unless --yes

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants