[PR #3666] [MERGED] Add support for S3 storage for media #12609

Closed
opened 2025-12-29 22:22:37 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/3666
Author: @steffann
Created: 11/3/2019
Status: Merged
Merged: 12/11/2019
Merged by: @jeremystretch

Base: develop-2.7Head: 1814-Ability_to_use_object_store_for_images


📝 Commits (7)

  • 7306d56 Add support for S3 storage for media
  • a6f2d5b Fix code for PEP8
  • 02a009b Don't redefine exception but split the code
  • dafa251 Add support for S3 storage for media
  • 378883d Fix code for PEP8
  • f7a1595 Merge branch '1814-Ability_to_use_object_store_for_images' of github.com:steffann/netbox into 1814-Ability_to_use_object_store_for_images
  • f1e75b0 Implement storage configuration as suggested by @jeremystretch

📊 Changes

3 files changed (+40 additions, -2 deletions)

View changed files

📝 netbox/extras/models.py (+11 -2)
📝 netbox/netbox/configuration.example.py (+10 -0)
📝 netbox/netbox/settings.py (+19 -0)

📄 Description

Fixes: #1814

I implemented the following configuration structure:

MEDIA_STORAGE = {
  # Required configuration
  'BACKEND': 'S3',
  'ACCESS_KEY_ID': 'Key ID',
  'SECRET_ACCESS_KEY': 'Secret',
  'BUCKET_NAME': 'netbox',

  # Optional configuration, defaults are shown
  'REGION_NAME': '',
  'ENDPOINT_URL': None,
  'AUTO_CREATE_BUCKET': False,
  'BUCKET_ACL': 'public-read',
  'DEFAULT_ACL': 'public-read',
  'OBJECT_PARAMETERS': {
    'CacheControl': 'max-age=86400',
    'CacheControl': 'max-age=86400',
  },
  'QUERYSTRING_AUTH': True,
  'QUERYSTRING_EXPIRE': 3600,
}

Feedback appreciated.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netbox-community/netbox/pull/3666 **Author:** [@steffann](https://github.com/steffann) **Created:** 11/3/2019 **Status:** ✅ Merged **Merged:** 12/11/2019 **Merged by:** [@jeremystretch](https://github.com/jeremystretch) **Base:** `develop-2.7` ← **Head:** `1814-Ability_to_use_object_store_for_images` --- ### 📝 Commits (7) - [`7306d56`](https://github.com/netbox-community/netbox/commit/7306d56902f1db5ed82839dc2b21c0b848b5f01a) Add support for S3 storage for media - [`a6f2d5b`](https://github.com/netbox-community/netbox/commit/a6f2d5b414be5067570b77820aa712d9556b59bf) Fix code for PEP8 - [`02a009b`](https://github.com/netbox-community/netbox/commit/02a009b7a72acfffe72b0076dbce74cbcd366e34) Don't redefine exception but split the code - [`dafa251`](https://github.com/netbox-community/netbox/commit/dafa2513e3061c4c8ebb7b49d9c3fa038bf62bd7) Add support for S3 storage for media - [`378883d`](https://github.com/netbox-community/netbox/commit/378883df2be2d783ea12a63a8da65fcb1c198e50) Fix code for PEP8 - [`f7a1595`](https://github.com/netbox-community/netbox/commit/f7a1595ce5c7f67abce69ece5b981467bb6c4f12) Merge branch '1814-Ability_to_use_object_store_for_images' of github.com:steffann/netbox into 1814-Ability_to_use_object_store_for_images - [`f1e75b0`](https://github.com/netbox-community/netbox/commit/f1e75b0fbb8accdc249bfa1a40edfb3797753771) Implement storage configuration as suggested by @jeremystretch ### 📊 Changes **3 files changed** (+40 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `netbox/extras/models.py` (+11 -2) 📝 `netbox/netbox/configuration.example.py` (+10 -0) 📝 `netbox/netbox/settings.py` (+19 -0) </details> ### 📄 Description ### Fixes: #1814 I implemented the following configuration structure: ``` MEDIA_STORAGE = { # Required configuration 'BACKEND': 'S3', 'ACCESS_KEY_ID': 'Key ID', 'SECRET_ACCESS_KEY': 'Secret', 'BUCKET_NAME': 'netbox', # Optional configuration, defaults are shown 'REGION_NAME': '', 'ENDPOINT_URL': None, 'AUTO_CREATE_BUCKET': False, 'BUCKET_ACL': 'public-read', 'DEFAULT_ACL': 'public-read', 'OBJECT_PARAMETERS': { 'CacheControl': 'max-age=86400', 'CacheControl': 'max-age=86400', }, 'QUERYSTRING_AUTH': True, 'QUERYSTRING_EXPIRE': 3600, } ``` Feedback appreciated. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2025-12-29 22:22:37 +01:00
adam closed this issue 2025-12-29 22:22:37 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#12609