Problem
The entrypoint script (docker/server/rails-entrypoint.sh) sets chmod 777 on parent directories (/mnt/openstudio/server/analyses, etc.) and sets umask 0000. However, there are concerns:
- No explicit ownership is set anywhere — ownership is entirely determined by the process UID at runtime
- Individual analysis subdirectories created at runtime by
FileUtils.mkdir_p in run_simulate_data_point.rb:35-38 inherit permissions from umask, but are never explicitly chmod'd
- Known CI issue: The specs document that when running as root in Docker CI, root-owned
assets/analyses directories break later uploads by the unprivileged app user (analysis_init_spec.rb lines 22-27)
- No chown calls exist anywhere in the codebase
Current Behavior
- Entrypoint creates parent dirs with
chmod 777 + umask 0000
- Runtime dirs rely solely on umask inheritance
- No verification that the running user can actually read/write the created directories
Proposed Fix
- In
rails-entrypoint.sh, ensure directories are owned by the correct user (e.g., chown -R app:app /mnt/openstudio if running as non-root)
- Consider adding an explicit
chmod after mkdir_p calls in the job runner to guarantee consistent permissions
- Add a startup check that verifies the app user can write to the analyses directory
- Document the expected UID/GID for the container
Files to Modify
docker/server/rails-entrypoint.sh
server/app/jobs/dj_jobs/run_simulate_data_point.rb
- Potentially
Dockerfile (ensure USER directive is correct)
Related
Specs documenting the known issue: server/spec/models/analysis_init_spec.rb, server/spec/models/analyses_upload_spec.rb
Problem
The entrypoint script (
docker/server/rails-entrypoint.sh) setschmod 777on parent directories (/mnt/openstudio/server/analyses, etc.) and setsumask 0000. However, there are concerns:FileUtils.mkdir_pinrun_simulate_data_point.rb:35-38inherit permissions from umask, but are never explicitly chmod'dassets/analysesdirectories break later uploads by the unprivileged app user (analysis_init_spec.rblines 22-27)Current Behavior
chmod 777+umask 0000Proposed Fix
rails-entrypoint.sh, ensure directories are owned by the correct user (e.g.,chown -R app:app /mnt/openstudioif running as non-root)chmodaftermkdir_pcalls in the job runner to guarantee consistent permissionsFiles to Modify
docker/server/rails-entrypoint.shserver/app/jobs/dj_jobs/run_simulate_data_point.rbDockerfile(ensure USER directive is correct)Related
Specs documenting the known issue:
server/spec/models/analysis_init_spec.rb,server/spec/models/analyses_upload_spec.rb