Update umask before launching foundry if CONTAINER_UMASK is set #1325
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.
🗣 Description
This change introduces an environment variable,
${CONTAINER_UMASK}, to control the umask of thenodeprocess. If this variable is set,launcher.shpasses it to theumaskcommand before launchingnode.💭 Motivation and context
This change makes it easier to manage shared assets between containers without needing them all run as the same user. Setting
CONTAINER_UMASKcontrols what permissions are used for new (e.g. uploaded) files, allowing them to e.g be group or world writable.🧪 Testing
To check if umask is set:
docker compose exec foundry find -L /proc -maxdepth 2 -name exe -samefile /usr/local/bin/node -print -execdir grep Umask status \;to check the umask of the foundry process - there should only be one match.To check the umask is applied correctly:
ls -laRepeat the checks for at least these situations:
CONTAINER_UMASKunset => no log, umask is 0022CONTAINER_UMASK=0002=> info message printed, umask is 0002CONTAINER_UMASK="u=rwx,g=rwx,o=rx"=> info message printed, umask matches (will need to check how to quote it properly for compose.yml)CONTAINER_UMASK=oops=> info message, warning message, umask is 0022. Container starts as normal.✅ Pre-approval checklist
to reflect the changes in this PR.
✅ Pre-merge checklist
✅ Post-merge checklist