Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Switch File Upload to ActiveStorage #2702

Open
MrSerth opened this issue Dec 13, 2024 · 0 comments
Open

Switch File Upload to ActiveStorage #2702

MrSerth opened this issue Dec 13, 2024 · 0 comments
Labels
dependencies Pull requests that update a dependency file enhancement ruby Pull requests that update Ruby code

Comments

@MrSerth
Copy link
Member

MrSerth commented Dec 13, 2024

In the current context, every uploaded file is uploaded with CarrierWave, which has a few drawbacks:

  • Files are uploaded to the publics/uploads folder and thus need special handling to prevent unauthorized access.
  • Files are stored on the local file system, need a dedicated backup strategy and are currently not available in a potential high availability setting involving multiple hosts.
  • The CarrierWave integration is very manual with multiple quirks, and would deserve a refactoring.

Hence, we should replace CarrierWave with a proper ActiveStorage backend. ActiveStorage allows multiple backend (local file, S3, ...) and hence would address above issues. Further, it would allow a smooth migration in multiple steps (first switch to ActiveStorage, then change the ActiveStorage backend, ...)

When changing the upload, the following should be considered:

  • Authorization for file access
  • Embedding audio and video files (when implementing an exercise)
  • FilesController for show_protected_upload (regular download)
  • The Renderhost and access when viewing a rendered HTML / CSS exercise (FilesController#render_protected_upload)
  • nginx configuration and X-Accel-Redirect:
    config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
  • Model changes (especially CodeOcean::File) and the native_file attribute
  • Potentially, integrate the new file upload mechanism with the Markdown editor.
@MrSerth MrSerth added enhancement dependencies Pull requests that update a dependency file ruby Pull requests that update Ruby code labels Dec 13, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
dependencies Pull requests that update a dependency file enhancement ruby Pull requests that update Ruby code
Projects
None yet
Development

No branches or pull requests

1 participant