Add zero-downtime deployment support with symlinks#1111
Draft
JoshSalway wants to merge 3 commits intolaravel:2.xfrom
Draft
Add zero-downtime deployment support with symlinks#1111JoshSalway wants to merge 3 commits intolaravel:2.xfrom
JoshSalway wants to merge 3 commits intolaravel:2.xfrom
Conversation
|
Thanks for submitting a PR! Note that draft PRs are not reviewed. If you would like a review, please mark your pull request as ready for review in the GitHub user interface. Pull requests that are abandoned in draft may be closed due to inactivity. |
When deploying with symlink-based strategies (Deployer, Envoyer), Octane workers resolve the real path and continue loading files from the old release after the symlink is switched. Add a ResolvesSymlinks trait that detects symlinked working directories and passes the logical path to server processes. Clear stat cache on reload so symlinks are re-resolved. Update Swoole bin scripts to use configurable bin directory. Fixes laravel#1004 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Remove superfluous @return phpdoc tag (type hint is sufficient) - Remove extra blank line in StartRoadRunnerCommand - Fix anonymous class brace position in test - Use $basePath instead of base_path() for RoadRunner server.command path Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The PR description claimed FrankenPHP support but StartFrankenPhpCommand was not using the ResolvesSymlinks trait. This adds the trait and replaces base_path() with ->resolveBasePath() for the process working directory, APP_BASE_PATH, APP_PUBLIC_PATH, and watch paths. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
Summary
When deploying with symlink-based strategies (Deployer, Envoyer), Octane workers resolve the real path at startup and continue loading files from the old release directory after the symlink is switched. This means code changes are never picked up, even after
octane:reload.Fixes #1004
Problem
Octane workers call
realpath()on the working directory at boot time. In symlink deployments,current->releases/v1resolves to/var/www/releases/v1. After deploying v2 and switchingcurrent->releases/v2,octane:reloadstill resolves the cached real path, so workers continue serving v1 code.Solution
ResolvesSymlinkstrait that detects symlinked working directories and passes the logical path (not the resolved real path) to Swoole, RoadRunner, and FrankenPHP server processesoctane:reloadand SwoolebeforeReloadso symlinks are re-resolvedAPP_RELEASE_BIN_DIRenv varTest Plan
ResolvesSymlinksTestincluded covering symlink detection and path resolutioncurrentdirectory, runoctane:reload, verify new release code is loaded