Skip to content

Replace STORAGE_BACKEND and STORAGE_CONFIG configuration parameters with Django's STORAGES #18423

New issue

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

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

Already on GitHub? Sign in to your account

Closed
jeremystretch opened this issue Jan 17, 2025 · 2 comments
Assignees
Labels
complexity: low Requires minimal effort to implement status: accepted This issue has been accepted for implementation type: feature Introduction of new functionality to the application

Comments

@jeremystretch
Copy link
Member

jeremystretch commented Jan 17, 2025

NetBox version

v4.2.1

Feature type

Change to existing functionality

Triage priority

N/A

Proposed functionality

NetBox currently exposes two configuration parameters for configuring file storage:

  • STORAGE_BACKEND - Sets the storage backend (e.g. django-storages)
  • STORAGE_CONFIG - A dictionary of backend-specific configuration parameters

We can replace these by instead exposing Django's STORAGES setting directly.

Use case

Django's native STORAGE_BACKEND setting was removed in v5.1 and superseded by STORAGES. There is no longer a need to handle the backend selection and configuration via separate configuration parameters.

Database changes

N/A

External dependencies

None

@jeremystretch jeremystretch added status: needs triage This issue is awaiting triage by a maintainer type: feature Introduction of new functionality to the application status: under review Further discussion is needed to determine this issue's scope and/or implementation needs milestone Awaiting prioritization for inclusion with a future NetBox release and removed status: needs triage This issue is awaiting triage by a maintainer labels Jan 17, 2025
@arthanson arthanson self-assigned this Feb 4, 2025
@jeremystretch jeremystretch added status: accepted This issue has been accepted for implementation complexity: low Requires minimal effort to implement and removed status: under review Further discussion is needed to determine this issue's scope and/or implementation needs milestone Awaiting prioritization for inclusion with a future NetBox release labels Feb 11, 2025
@jeremystretch jeremystretch added this to the v4.3 milestone Feb 11, 2025
@RangerRick
Copy link

I've got the NBE build set up such that I can now test this on our end, and as I worked to reenable S3 storage on my side, I remembered that one of the blockers last time around was the behavior of the storages and what gets persisted to the database.

The short version is: the entire S3 URL is stored to the database, which when inside a cluster is not reachable from the outside. Setting AWS_S3_CUSTOM_DOMAIN is not always feasible, because it would require introspection of the ingress to know what the external hostname is, and doing that reliably is problematic.

In my previous S3 PoC, I wrote a façade storage driver that stored everything relative, but then realized I didn't have enough control over how the image URLs are used elsewhere in the system so they would still not render right if, say, you have NetBox behind a proxy using a prefix, so I was still forced to hardcode the ingress hostname to make it all work.

It feels like handling this well is more complicated than just dealing with prefixes; the current S3 storage behavior assumes your S3 host never changes.

@arthanson arthanson changed the title Replace STORAGE_BACKEND and STORAGE_CONFIG configuration parameters with Django's STORAGES Use Django-storages for scripts and Replace STORAGE_BACKEND and STORAGE_CONFIG configuration parameters with Django's STORAGES Mar 5, 2025
@arthanson arthanson changed the title Use Django-storages for scripts and Replace STORAGE_BACKEND and STORAGE_CONFIG configuration parameters with Django's STORAGES Replace STORAGE_BACKEND and STORAGE_CONFIG configuration parameters with Django's STORAGES Mar 13, 2025
@jeremystretch
Copy link
Member Author

Superseded by #18896

@jeremystretch jeremystretch closed this as not planned Won't fix, can't repro, duplicate, stale Mar 13, 2025
@jeremystretch jeremystretch removed this from the v4.3 milestone Apr 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
complexity: low Requires minimal effort to implement status: accepted This issue has been accepted for implementation type: feature Introduction of new functionality to the application
Projects
None yet
Development

No branches or pull requests

3 participants