Other image storage mechanisms; i.e. PostgreSQL BYTEA, etc. #2470

Closed
opened 2025-12-29 18:19:08 +01:00 by adam · 2 comments
Owner

Originally created by @nward on GitHub (Mar 17, 2019).

Environment

  • Python version: 3.6
  • NetBox version: 2.5.8

Proposed Functionality

Image uploads are stored in files. This is OK for many uses, however, makes HA (particularly active/active) complicated.
A somewhat pluggable image storage system would permit options other than just files - I personally would like PostgreSQL BYTEA storage, but perhaps S3-type storage and others would useful.
Note that PostgreSQL large object storage is not suitable, as this is not supported by existing replication systems.

My intent is to submit this issue for discussion, and if accepted, I will put the work in to add this functionality and submit a PR.

Use Case

HA will be more achievable, with database or other cluster-able systems able to store images.

Database Changes

For PostgreSQL storage, either an additional BYTEA "data" column in the ImageAttachment table, or, a new "AttachmentData" table+model with a 1:1 relationship to rows in the ImageAttachment table. A second table would permit different replication, storage, etc. if required by the DBA.
I expect no database changes for other storage systems.

External Dependencies

For PostgreSQL, no.
Other storage system options, probably - but dependant on the storage system.

Originally created by @nward on GitHub (Mar 17, 2019). <!-- NOTE: This form is only for proposing specific new features or enhancements. If you have a general idea or question, please post to our mailing list instead of opening an issue: https://groups.google.com/forum/#!forum/netbox-discuss NOTE: Due to an excessive backlog of feature requests, we are not currently accepting any proposals which significantly extend NetBox's feature scope. Please describe the environment in which you are running NetBox. Be sure that you are running an unmodified instance of the latest stable release before submitting a bug report. --> ### Environment * Python version: 3.6 * NetBox version: 2.5.8 <!-- Describe in detail the new functionality you are proposing. Include any specific changes to work flows, data models, or the user interface. --> ### Proposed Functionality Image uploads are stored in files. This is OK for many uses, however, makes HA (particularly active/active) complicated. A somewhat pluggable image storage system would permit options other than just files - I personally would like PostgreSQL BYTEA storage, but perhaps S3-type storage and others would useful. Note that PostgreSQL large object storage is not suitable, as this is not supported by existing replication systems. My intent is to submit this issue for discussion, and if accepted, I will put the work in to add this functionality and submit a PR. <!-- Convey an example use case for your proposed feature. Write from the perspective of a NetBox user who would benefit from the proposed functionality and describe how. ---> ### Use Case HA will be more achievable, with database or other cluster-able systems able to store images. <!-- Note any changes to the database schema necessary to support the new feature. For example, does the proposal require adding a new model or field? (Not all new features require database changes.) ---> ### Database Changes For PostgreSQL storage, either an additional BYTEA "data" column in the ImageAttachment table, or, a new "AttachmentData" table+model with a 1:1 relationship to rows in the ImageAttachment table. A second table would permit different replication, storage, etc. if required by the DBA. I expect no database changes for other storage systems. <!-- List any new dependencies on external libraries or services that this new feature would introduce. For example, does the proposal require the installation of a new Python package? (Not all new features introduce new dependencies.) --> ### External Dependencies For PostgreSQL, no. Other storage system options, probably - but dependant on the storage system.
adam closed this issue 2025-12-29 18:19:08 +01:00
Author
Owner

@jeremystretch commented on GitHub (Mar 18, 2019):

Image uploads are stored in files. This is OK for many uses, however, makes HA (particularly active/active) complicated.

There are many solutions available for syncing files among multiple instances. Please see #152 for discussion on why we do not store files in the database.

@jeremystretch commented on GitHub (Mar 18, 2019): > Image uploads are stored in files. This is OK for many uses, however, makes HA (particularly active/active) complicated. There are many solutions available for syncing files among multiple instances. Please see #152 for discussion on why we do not store files in the database.
Author
Owner

@nward commented on GitHub (Mar 18, 2019):

Hi,

Thanks for your feedback and reference to that issue.

There is discussion in that thread about an abstraction layer. Would you mind if I submitted a PR implementing that, so we can build other storage mechanisms (like S3, Swift, etc.)?

@nward commented on GitHub (Mar 18, 2019): Hi, Thanks for your feedback and reference to that issue. There is discussion in that thread about an abstraction layer. Would you mind if I submitted a PR implementing that, so we can build other storage mechanisms (like S3, Swift, etc.)?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#2470