Repository navigation
Conversation
The task deleted shared/app/etc/env.php before moving env_tmp.php into
place. With the documented hook order the task runs before deploy:symlink,
so the previous release is still being served and its env.php symlink
dangles for the duration of two SSH round trips.
A single mv -f is an atomic rename. The rm of the release symlink is
dropped as well, because {{bin/symlink}} is ln -nfs and already replaces
an existing link.
This branch has not been deployed
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.
Problem
magento:cleanup_cache_prefixdeletes the sharedenv.phpand only afterwards movesenv_tmp.phpinto its place:Between the first
rmand themvthere is a window in whichshared/app/etc/env.phpdoes not exist. That window matters, because the documented hook order for this feature isdeploy:magentofinishes beforedeploy:symlink, so when the task runs, the previous release is still the one serving traffic, and itsapp/etc/env.phpsymlink points at the shared file that was just deleted. Every request served in that window cannot read the configuration. The window spans tworun()calls, i.e. two SSH round trips — roughly 1.4 s on our deployments, which is plenty to hit on a busy shop.The
rmof the release's own symlink has the same effect, and it is redundant regardless:{{bin/symlink}}isln -nfs, which already replaces an existing link.Fix
Collapse the two
rms and themvinto a singlemv -f.rename(2)is atomic, so a reader sees either the oldenv.phpor the new one, never a missing file.Notes
shared/app/etc/env.phpholds whatenv_tmp.phpheld, and the release symlink points at it.env_tmp.phpis absent,mvfails andenv.phpis left intact, where previously it would have been deleted with nothing to replace it.docs/recipe/magento2.mdwas regenerated withbin/docgen; the diff there is line-number references only.