Make carrierwave uploaders tmp dir configurable
Right now we always place cache_dir
and work_dir
for carriewave uploaders under the general storage directory :
def cache_dir
File.join(root, base_dir, 'tmp/cache')
end
def work_dir
File.join(root, base_dir, 'tmp/work')
end
It makes sense for most cases:
- it's easier to understand which files belong to which model
- if files are stored on the NFS, then moving files from cache to storage is lightweight
But during the removal of pages NFS we realized that we still use NFS on sidekiq workers for temporary files.
We can introduce separate configuration option for tmp_dir
. Current logic will stay the same by default, but admins will be able to override it:
pages:
path: "/var/opt/gitlab/gitlab-rails/shared/pages/"
tmp_dir: "/tmp/gitlab-pages"
And we'll use paths like /tmp/gitlab-pages/work-dir
/tmp/gitlab-pages/cache-dir
.
Note: there is an alternative idea to use $TMPDIR
Edited by Vladimir Shushlin