Soft-fail chown during container init#36
Open
pacso wants to merge 1 commit into
Open
Conversation
setPermissions calls ChownFolderRecursive on /app and /config and log.Fatal's on any error. On filesystems where root cannot chown arbitrary files (notably NFS exports with root_squash, common on Kubernetes-backed home labs and NAS-backed clusters), this prevents the supervisor from starting even though /config is typically already writable to the application. Log a warning and continue instead. The chown is a best-effort permissions tighten-up; nginx/php-fpm only need to be able to write inside /config/data, which is satisfied by the volume's existing mode regardless of ownership.
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
The supervisor's
setPermissions()callsChownFolderRecursiveon/appand/configandlog.Fatals on any error. On filesystems where root cannot chown arbitrary files — notably NFS exports withroot_squash(common on K8s home labs and NAS-backed clusters) — this prevents the container from starting, even though/configis typically already writable.This change logs a warning and continues. The chown is a best-effort permission tighten-up; nginx/php-fpm only need write access inside
/config/data, which is satisfied by the volume's existing mode regardless of ownership.Test plan
/config/data(SQLite DB created)Happy to narrow the soft-fail to
errors.Is(err, syscall.EPERM)if you'd prefer to keeplog.Fatalfor genuine permission errors (e.g. read-only mount), or move it behind an env var. Let me know.