csabourin / spaghetti-migrator
Spaghetti Migrator - Untangles your nested subfolders and migrates assets between cloud services. A production-grade Craft CMS 4/5 plugin with checkpoint/resume, rollback capabilities, and zero-downtime support.
Installs: 74
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
Type:craft-plugin
pkg:composer/csabourin/spaghetti-migrator
Requires
- php: ^8.0 || ^8.1 || ^8.2 || ^8.3
- craftcms/cms: ^4.0 || ^5.0
Requires (Dev)
- craftcms/rector: dev-main
- phpstan/phpstan: ^1.10
- phpunit/phpunit: ^9.6
- dev-main
- v5.2.308
- v5.2.307.6
- v5.2.307.5
- v5.2.307
- v5.2.306
- v5.2.0
- v5.1.304
- v5.1.303.5
- v5.1.303
- v5.1.302
- v5.1.301
- v5.1.300
- v5.1.298
- v5.1.297
- v5.1.296
- v5.1.295
- v5.1.294
- v5.1.293.5
- v5.1.293
- v5.1.292
- v5.1.291
- v5.1.290
- v5.1.289
- v5.1.288
- v5.1.287
- v5.1.286
- v5.1.285
- v5.1.284
- v5.1.283
- v5.1.282
- v5.1.281
- v5.1.280
- v5.1.279
- v5.1.278
- v5.1.277
- v5.1.276
- v5.1.275
- v5.1.274
- v5.1.273
- v5.1.272
- v5.1.271
- v5.1.270
- v5.1.269
- v5.1.268
- v5.1.267
- v5.1.266
- v5.1.265
- v5.1.264
- v5.1.263
- v5.1.262
- v5.1.261
- v5.1.259
- v5.1.258
- v5.1.257
- v5.1.256
- v5.1.255
- v5.1.254
- v5.1.253
- v5.1.252
- v5.1.250
- v5.1.249
- v5.1.248
- v5.1.247
- v5.0.245
- v5.0.243
- v5.0.241
- v5.0.240
- v5.0.239
- v5.0.238
- v5.0.237
- v5.0.236
- v5.0.234
- v5.0.233
- v5.0.232
- v5.0.231
- v5.0.230
- v5.0.228
- v5.0.221
- v5.0.219
- v5.0.218
- v5.0.217
- v5.0.215
- v5.0.214
- v5.0.213
- v5.0.212
- v5.0.211
- v5.0.210
- v5.0.209
- v5.0.208
- v5.0.207
- v3.0.206
- v3.0.205
- v3.0.203
- v3.0.202
- v2.0.200
- v1.8.199
- v1.8.198
- v1.8.197
- v1.8.196
- v1.8.195
- v1.8.193
- v1.8.190
- v1.8.0
- v1.7.186
- v1.7.181
- v1.7.177
- v1.7.176
- v1.7.175
- v1.7.173
- v1.7.172
- v1.7.171
- v1.7.170
- v1.7.2
- v1.7.1
- v1.7.0
- v1.6.169
- v1.6.168
- v1.6.167
- v1.6.164
- v1.6.0
- v1.5.163
- v1.5.159
- v1.5.158.1
- v1.5.158
- v1.5.158a
- v1.5.157
- v1.5.156
- v1.5.155
- v1.5.154
- v1.5.22
- v1.5.21
- v1.5.20
- v1.5.19
- v1.5.18
- v1.5.17
- v1.5.16
- v1.5.15
- v1.5.14
- v1.5.13
- v1.5.12
- v1.5.11
- v1.5.10
- v1.5.9
- v1.5.8
- v1.5.7
- v1.5.6
- v1.5.5
- v1.5.4
- v1.5.3
- v1.5.2
- v1.5.1
- v1.5.0
- v1.4.21
- v1.4.20
- v1.4.19
- v1.4.18
- v1.4.17
- v1.4.16
- v1.4.15
- v1.4.14
- v1.4.13
- v1.4.12
- v1.4.11
- v1.4.10
- v1.4.9
- v1.4.8
- v1.4.7
- v1.4.6
- v1.4.5
- v1.4.4
- v1.4.3
- v1.4.2
- v1.4.1
- v1.4.0
- v1.3.11
- v1.3.10
- v1.3.9
- v1.3.8
- v1.3.7
- v1.3.6
- v1.3.5
- v1.3.4
- v1.3.3
- v1.3.2
- v1.3.1
- v1.3.0
- v1.2.29
- v1.2.28
- v1.2.27
- v1.2.26
- v1.2.25
- v1.2.24
- v1.2.23
- v1.2.22
- v1.2.21
- v1.2.20
- v1.2.19
- v1.2.18
- v1.2.17
- v1.2.16
- v1.2.15
- v1.2.14
- v1.2.13
- v1.2.12
- v1.2.11
- v1.2.10
- v1.2.9
- v1.2.8
- v1.2.7
- v1.2.6
- v1.2.5
- v1.2.4
- v1.2.3
- v1.2.2
- v1.2.1
- v1.2.0
- v1.1.12
- v1.1.11
- v1.1.10
- v1.1.9
- v1.1.8
- v1.1.7
- v1.1.6
- v1.1.5
- v1.1.4
- v1.1.3
- v1.1.2
- v1.1.1
- v1.1.0
- v1.0.17
- v1.0.16
- v1.0.15
- v1.0.14
- v1.0.13
- v1.0.12
- v1.0.11
- v1.0.10
- v1.0.9
- v1.0.8
- v1.0.7
- v1.0.6
- v1.0.5
- v1.0.4
- v1.0.3
- v1.0.2
- v1.0.1
- v1.0.0
- dev-claude/itil-cab-aws-migration-0184QBDrM9Gkw4Gs1WygPzBY
- dev-claude/fix-yes-flag-web-01DtucNjvfBD4J5z1tXhU6V2
This package is auto-updated.
Last update: 2026-01-02 13:54:36 UTC
README
Untangle your asset spaghetti like a pro chef! Now with multi-cloud support!
Spaghetti Migrator is a production-grade Craft CMS 4/5 plugin that untangles nested subfolders and migrates assets between any cloud storage providers. Whether you're dealing with a tangled mess of nested directories or moving between AWS S3, Google Cloud Storage, Azure, Backblaze B2, Wasabi, Cloudflare R2, DigitalOcean Spaces, or local filesystems, this tool helps you straighten it all out with checkpoint/resume, rollback capabilities, and zero-downtime support.
π What's New in v5.0
- π Unified Multi-Provider Engine: One workflow for AWS S3, Google Cloud Storage, Azure Blob, Backblaze B2, Wasabi, Cloudflare R2, DigitalOcean Spaces, or local filesystemsβmix and match any combination.
- π¦ 5.0 Orchestrator: Hardened
MigrationOrchestratorwith improved checkpointing, resumable phases, and clearer safety rails for Craft 4/5. - π₯οΈ Dashboard Polish: Faster Control Panel dashboard with richer status endpoints, consolidated logs, and command queue visibility.
- π Smarter URL Replacement: Regex and multi-mapping strategies tuned for cross-domain consolidations and template cleanup.
- π§° Operational Toolkit: Built-in diagnostics (
migration-check,migration-diag, transform cleanup) so no extra helper scripts are needed in the repo root.
β¨ Highlights
- Untangle the Mess: Turn your nested folder spaghetti into a well-organized plate
- Production-Ready: Battle-tested migration toolkit with enterprise-grade reliability
- Checkpoint/Resume System: Survive interruptions and resume from exactly where you left off
- Complete Rollback: Full rollback capabilities - because sometimes you need to put the spaghetti back
- Zero Dependencies: Works with just Craft CMS - no additional packages required
- Auto-Bootstrap: PSR-4 autoloaded - no manual configuration in
config/app.php - Memory Efficient: Handles 100,000+ assets with intelligent batch processing
- Comprehensive Dashboard: Web-based Control Panel for orchestration and monitoring
π― Key Features
Migration Capabilities
- 18 Specialized Controllers for different migration phases
- Batch Processing with configurable batch sizes for memory efficiency
- Dry Run Mode to test migrations without making changes
- Progress Tracking with real-time ETA and throughput metrics
- Error Recovery with automatic retry logic and health checks
- Idempotent Operations - safe to run multiple times
Control Panel Dashboard
- Web-based interface for migration orchestration
- Real-time status monitoring
- Command execution from the browser
- Checkpoint inspection tools
- Live log streaming
- Connection testing
Developer Experience
- Centralized configuration via
MigrationConfighelper - 40+ type-safe configuration methods
- Comprehensive inline documentation
- Extensive architecture documentation
- Custom Twig filters included
π Requirements
- PHP: 8.0 or higher
- Craft CMS: 4.0+ or 5.0+
- Storage Provider: At least one cloud storage account or local filesystem
- AWS S3, Google Cloud Storage, Azure Blob, Backblaze B2, Wasabi, Cloudflare R2, DigitalOcean Spaces, or Local
π Supported Storage Providers
| Provider | Type | Cost | Speed | Notes |
|---|---|---|---|---|
| AWS S3 | Cloud | $$ | Fast | Industry standard |
| Google Cloud Storage | Cloud | $$ | Fast | GCP integration |
| Azure Blob Storage | Cloud | $$ | Fast | Azure integration |
| DigitalOcean Spaces | Cloud | $ | Fast | Simple pricing |
| Backblaze B2 | Cloud | $ | Fast | 80% cheaper than S3 |
| Wasabi | Cloud | $ | Fast | No egress fees |
| Cloudflare R2 | Cloud | $ | Fast | Zero egress fees |
| Local Filesystem | Local | Free | Very Fast | Reorganization/backup |
π Installation
1. Install via Composer
composer require csabourin/spaghetti-migrator
The plugin will auto-install and automatically create config/migration-config.php if it doesn't exist.
2. Configure Environment Variables
Add these to your .env file:
# Migration Environment MIGRATION_ENV=dev # DigitalOcean Spaces Credentials DO_S3_ACCESS_KEY=your_spaces_access_key DO_S3_SECRET_KEY=your_spaces_secret_key DO_S3_BUCKET=your-bucket-name DO_S3_BASE_URL=https://your-bucket.tor1.digitaloceanspaces.com DO_S3_BASE_ENDPOINT=https://tor1.digitaloceanspaces.com
See .env.example for all available options.
3. Update Migration Config
Edit config/migration-config.php:
$awsSource = [ 'bucket' => 'your-aws-bucket', // β Update this 'region' => 'us-east-1', // β Update this ];
4. Verify Installation
./craft spaghetti-migrator/migration-check/check
π Usage
Console Commands
Pre-Flight Check
./craft spaghetti-migrator/migration-check/check
Migrate Assets (Dry Run)
./craft spaghetti-migrator/image-migration/migrate --dryRun=1
Migrate Assets (Production)
./craft spaghetti-migrator/image-migration/migrate
Replace URLs in Database
./craft spaghetti-migrator/url-replacement/replace-s3-urls
Switch Filesystems
./craft spaghetti-migrator/filesystem-switch/to-do
Post-Migration Diagnostics
./craft spaghetti-migrator/migration-diag/diagnose
Web Dashboard
Access the migration dashboard in your Control Panel:
Control Panel β Migration β Dashboard
The dashboard provides:
- Step-by-step migration guidance
- Real-time progress monitoring
- Command execution interface
- Configuration validation
- Checkpoint management
πΊοΈ Migration Workflow
The complete migration process follows these phases:
- Pre-Flight Validation - Verify configuration and connectivity
- Database URL Replacement - Update S3 URLs in content tables
- Template URL Replacement - Update hardcoded URLs in Twig templates
- File Migration - Copy physical assets from AWS to DigitalOcean
- Filesystem Switch - Switch volumes to use DigitalOcean Spaces
- Configuration Updates - Update plugin configs and field settings
- Transform Management - Discover and pre-generate image transforms
- Post-Migration Verification - Validate successful migration
Each phase is modular and can be executed independently or in sequence.
OptimisedImages transform cleanup
Before running the file migration or cleanup commands, purge stale transform files that live inside underscore-prefixed folders (for example _1200x800/hero.jpg) within the Optimised Images volume (ID 4). This prevents copying millions of auto-generated transforms to the new filesystem and keeps the migration delta small.
# Preview everything that would be removed ./craft spaghetti-migrator/transform-cleanup/clean --dryRun=1 # Execute the cleanup ./craft spaghetti-migrator/transform-cleanup/clean --dryRun=0
Each run saves a JSON report under storage/runtime/transform-cleanup/ so you can audit which files were targeted.
π Module Structure
modules/
βββ module.php # Module entry point
βββ controllers/ # Web controllers
β βββ DefaultController.php
β βββ MigrationController.php # Dashboard controller
βββ console/controllers/ # 18 console controllers
β βββ MigrationCheckController.php
β βββ ImageMigrationController.php
β βββ FilesystemSwitchController.php
β βββ ... (11 more)
βββ helpers/
β βββ MigrationConfig.php # Centralized configuration
βββ templates/spaghetti-migrator/
βββ dashboard.twig # Control Panel interface
π Documentation
v5.0 Guides
- MIGRATION_GUIDE.md - START HERE - Complete migration guide for all providers
- docs/PROVIDER_EXAMPLES.md - Configuration examples for each provider
- MULTI_PROVIDER_ARCHITECTURE.md - v5.0 multi-provider architecture and design
- config/migration-config.php - Current configuration template
Core Documentation
- OPERATIONS.md - Day-to-day usage, queue execution, consolidation, and troubleshooting
- PRODUCTION_OPERATIONS.md - Production deployment, monitoring, and troubleshooting
- ARCHITECTURE.md - System design and technical details
- CLAUDE.md - AI assistant guide with comprehensive codebase reference
- AGENTS.md - AI agent rules and constraints
- CHANGELOG.md - Version history
- CONTRIBUTING.md - Contribution guidelines
- SECURITY.md - Security policy and best practices
π§ Configuration
The module uses a centralized configuration system with three layers:
- Environment Variables (
.env) - Credentials and secrets - Configuration File (
config/migration-config.php) - Migration settings - Helper Class (
MigrationConfig) - Type-safe access to config values
Key Configuration Options
return [ 'aws' => [ 'bucket' => 'your-source-bucket', 'region' => 'us-east-1', ], 'do' => [ 'bucket' => App::env('DO_S3_BUCKET'), 'region' => 'tor1', 'accessKey' => App::env('DO_S3_ACCESS_KEY'), 'secretKey' => App::env('DO_S3_SECRET_KEY'), ], 'migration' => [ 'batchSize' => 100, 'checkpointFrequency' => 50, 'maxRetries' => 3, ], ];
π‘οΈ Safety Features
- Dry Run Mode: Test all operations before execution
- Checkpoint System: Automatic progress saving every N items
- Rollback Capability: Complete undo with change logs
- Health Checks: Continuous validation during migration
- Error Recovery: Automatic retry with exponential backoff
- Audit Logging: Comprehensive logs of all operations
π€ Contributing
Contributions are welcome! Please see CONTRIBUTING.md for details.
Development Setup
- Fork and clone the repository
- Install dependencies:
composer install - Set up a test Craft CMS installation
- Configure test AWS S3 and DigitalOcean Spaces accounts
- Run pre-flight checks:
./craft spaghetti-migrator/migration-check/check
π License
This project is licensed under the MIT License - see the LICENSE file for details.
π Acknowledgments
- Built for Craft CMS by Pixel & Tonic
- Inspired by real-world enterprise migration needs
- Tested on production sites with millions of assets
π¬ Support
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Documentation: Architecture Guide
π Links
- Repository: https://github.com/csabourin/do-migration
- Packagist: https://packagist.org/packages/csabourin/spaghetti-migrator
- Craft CMS: https://craftcms.com/
- DigitalOcean Spaces: https://www.digitalocean.com/products/spaces
Made with β€οΈ (and a touch of humor) for the Craft CMS community by the Spaghetti Migrator team