-
Notifications
You must be signed in to change notification settings - Fork 115
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
[PULP-265] Add docs about STORAGES settings #6158
Open
pedro-psb
wants to merge
1
commit into
pulp:main
Choose a base branch
from
pedro-psb:add-storage-docs
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
# Configure Storage Backend | ||
|
||
Pulp uses [django-storages](https://django-storages.readthedocs.io) to support multiple storage backends. | ||
See the reference for the [`STORAGES` settings](site:pulpcore/docs/admin/reference/settings/#storages). | ||
|
||
## Modifying the settings | ||
|
||
The settings can be updated via the `settings.py` file or through environment variables | ||
and have support to dynaconf merge features (learn more on the [Settings Introduction](site:pulpcore/docs/admin/guides/configure-pulp/introduction/)). | ||
|
||
To learn where and how to modify the files and environment variables, refer to the appropriate installation method documentation: | ||
|
||
* [Container (single-process) quickstart](site:pulp-oci-images/docs/admin/tutorials/quickstart/#single-container) | ||
* [Container (multi-process) quickstart](site:pulp-oci-images/docs/admin/tutorials/quickstart/#podman-or-docker-compose) | ||
* [Pulp Operator quickstart](site:pulp-operator/docs/admin/tutorials/quickstart-kubernetes/) | ||
|
||
## Local Filesystem (default) | ||
|
||
### Example | ||
|
||
In this example, the storage file permission and `MEDIA_ROOT` are overridden: | ||
|
||
```python | ||
STORAGES = { | ||
"default": { | ||
"BACKEND": "pulpcore.app.models.storage.FileSystem", | ||
"OPTIONS": { | ||
"file_permissions_mode": 0o600, | ||
"directory_permissions_mode": 0o600, | ||
}, | ||
}, | ||
} | ||
MEDIA_ROOT="/custom/media/root" # default: /var/lib/pulp/media | ||
``` | ||
|
||
Notes: | ||
|
||
* The [`MEDIA_ROOT`](site:pulpcore/docs/admin/reference/settings/#media_root) setting specifies where Pulp | ||
will save the files. | ||
* Pulp customizes Django's default class, `django.core.files.storage.FileSystemStorage`. The original can't be used. | ||
* There are some other related global definitions provided by django: | ||
* `MEDIA_URL` | ||
* `FILE_UPLOAD_PERMISSIONS` | ||
* `FILE_UPLOAD_DIRECTORY_PERMISSIONS` | ||
|
||
Comprehensive options for Local Filesystem can be found in | ||
[Django docs](https://docs.djangoproject.com/en/4.2/ref/files/storage/#django.core.files.storage.FileSystemStorage). | ||
|
||
## Amazon S3 | ||
|
||
### Setup | ||
|
||
Before you can configure Amazon S3 storage to use with Pulp, ensure that you complete the following steps | ||
(consult the official Amazon S3 docs for precise steps). | ||
|
||
1. Set up an AWS account. | ||
2. Create an S3 bucket for Pulp to use. | ||
3. In AWS Identity and Access Management (IAM), create a user that Pulp can use to access your S3 bucket. | ||
4. Save the access key id and secret access key. | ||
|
||
### Example | ||
|
||
In this example, the storage uses a bucket called `pulp3` that is hosted in region `eu-central-1`: | ||
|
||
```python | ||
MEDIA_ROOT = "" | ||
STORAGES = { | ||
"default": { | ||
"BACKEND": "storages.backends.s3.S3Storage", | ||
"OPTIONS": { | ||
"access_key": 'AKIAIT2Z5TDYPX3ARJBA', | ||
"secret_key": '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', | ||
"bucket_name": 'pulp3', | ||
"signature_version": "s3v4", | ||
"addressing_style": "path", | ||
"region_name": "eu-central-1", | ||
}, | ||
}, | ||
} | ||
``` | ||
|
||
Notes: | ||
|
||
* `MEDIA_ROOT` must be set to an empty string. | ||
* You can omit `access_key` and `secret_key` if: | ||
1. The system that hosts Pulp is running on AWS | ||
2. And the [`instance_profile`](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use_switch-role-ec2_instance-profiles.html) provides access to the S3 bucket | ||
|
||
Comprehensive options for Amazon S3 can be found in | ||
[`django-storages` docs](https://django-storages.readthedocs.io/en/latest/backends/amazon-S3.html#configuration-settings). | ||
|
||
## S3 Compatible | ||
|
||
The same `storages.backends.s3.S3Storage` backend can be used for S3 Compatible API services, such as [Minio](https://min.io/), [Ceph/RADOS](https://docs.ceph.com/en/reef/man/8/rados/) and [Backblaze B2](https://www.backblaze.com/cloud-storage). | ||
|
||
The [django-storages](https://django-storages.readthedocs.io/en/latest/backends/s3_compatible/index.html) documentation | ||
provides a reference for setting up some of these services. | ||
|
||
## Azure Blob storage | ||
|
||
### Setup | ||
|
||
Before you can configure Azure Blob storage to use with Pulp, ensure that you complete the following steps | ||
(consult the official Azure documentation for precise steps). | ||
|
||
1. Set up an Azure account and create a storage account. | ||
2. In your storage account, create a container under `Blob` service. | ||
3. Obtain the access credentials so that you can later configure Pulp to access your Azure Blob storage. You can find the access credentials | ||
at the storage account level, at Access keys (these are automatically generated). | ||
|
||
### Example | ||
|
||
In this example, the storage uses a container called `pulp3` with the `pulp-account` username. | ||
|
||
```python | ||
MEDIA_ROOT = "" | ||
STORAGES = { | ||
"default": { | ||
"BACKEND": "storages.backends.azure_storage.AzureStorage", | ||
"OPTIONS": { | ||
"account_name": 'pulp-account', | ||
"azure_container": 'pulp3', | ||
"account_key": 'Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==', | ||
"expiration_secs": 60, | ||
"overwrite_files": 'True', | ||
"location": 'pulp3' | ||
}, | ||
}, | ||
} | ||
``` | ||
|
||
Notes: | ||
|
||
* `MEDIA_ROOT` must be set to an empty string. | ||
|
||
Comprehensive options for Azure Blob can be found in | ||
[`django-storages` docs](https://django-storages.readthedocs.io/en/latest/backends/azure.html#configuration-settings). |
2 changes: 1 addition & 1 deletion
2
docs/admin/guides/configure-pulp.md → docs/admin/guides/configure-pulp/index.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm missing a note that other storage technologies that provide an S3 api will work too.
I'm thinking of Ceph/RADOS and minio here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's useful, will mention that.