Hosting Tiers Hub (8)
Zero-Downtime Blue-Green Deploys for FrankenPHP & Messenger
Warm Symfony cache and OPcache in an isolated release directory before atomically flipping symlinks and reloading FrankenPHP.
< 50ms worker reload · Zero 502s · Warmed container before switch
Why Running composer install or cache:clear Live Breaks Stores
Clearing var/cache/prod on a live Sylius directory forces dozens of concurrent PHP threads to rebuild the Symfony DI container simultaneously, locking CPU at 100% and throwing 500 errors during checkout.
Atomic Release Sequence for Sylius 2.x
Build the new release in /var/www/releases/<sha> (run composer install --no-dev, cache:warmup, and assets), execute backward-compatible Doctrine migrations, flip the current symlink atomically, issue caddy reload for FrankenPHP workers, and run messenger:stop-workers.
Measured Thresholds & Configuration
| Deploy Step | Target Directory | Memory / CPU Impact | Safety Rule |
|---|---|---|---|
| 1. Build & cache:warmup | releases/<sha> (offline) | Uses 350 MB transient CLI RAM | Never warm inside live symlink |
| 2. Doctrine Migrations | Shared DB (expand-contract) | Low (< 100 ms DDL) | Keep columns backward compatible |
| 3. Symlink + Worker Reload | current -> releases/<sha> | Zero dropped HTTP requests | Reload FrankenPHP + stop-workers |