fix: only chmod files owned by deploy user in shared storage - #36
Merged
Conversation
When artisan optimize runs view:cache, it skips views already compiled by PHP-FPM (www-data) and left in shared storage. The subsequent set_group_writable_tree call then fails with "Operation not permitted" because chmod cannot be run on files owned by another user. Filter both find commands with -user to target only deployer-owned entries and suppress errors with 2>/dev/null so mixed-ownership storage directories don't abort the deployment. Also removes the docs:clear artisan call and docs-output/.locks mkdir from the deploy script — the optimize:clear step already handles cache clearing and the locks directory is created on demand.
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
findinset_group_writable_treewith-userflag sochmodis only attempted on files owned by the deploy user, avoidingOperation not permittederrors fromwww-data-owned view cache files2>/dev/null || truefor robustnessartisan docs:clearand thedocs-output/.locksmkdirfrom the deploy script — cache clearing is handled byoptimize:clearand the locks directory is created on demandTest plan
dep site:deploy— deployment should complete withoutchmoderrors