-
Notifications
You must be signed in to change notification settings - Fork 110
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change the default deployment layout
This changes the default deployment layout. The main change is that MEDIA_ROOT gets its own directory. This allows limiting the file permissions in a shared Pulp 2 + Pulp 3 deployment and the SELinux file contexts. Another benefit is compatibility with django_extensions' unreferenced_files command which lists all files in MEDIA_ROOT that are not in the database. Other paths are kept on the same absolute paths, but the diff looks bigger because they used derive from MEDIA_ROOT. The documentation is updated to show the latest best practices. fixes #7178
- Loading branch information
Showing
10 changed files
with
86 additions
and
25 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Change the default deployment layout | ||
|
||
This changes the default deployment layout. The main change is that MEDIA_ROOT gets its own | ||
directory. This allows limiting the file permissions in a shared Pulp 2 + Pulp 3 deployment and the | ||
SELinux file contexts. Another benefit is compatibility with django_extensions' unreferenced_files | ||
command which lists all files in MEDIA_ROOT that are not in the database. | ||
|
||
Other paths are kept on the same absolute paths. The documentation is updated to show the latest | ||
best practices. |
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
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,43 @@ | ||
from pathlib import Path | ||
|
||
from django.conf import settings | ||
from django.core.checks import Warning as CheckWarning, register | ||
|
||
|
||
@register(deploy=True) | ||
def storage_paths(app_configs, **kwargs): | ||
warnings = [] | ||
|
||
if settings.DEFAULT_FILE_STORAGE == "pulpcore.app.models.storage.FileSystem": | ||
try: | ||
media_root_dev = Path(settings.MEDIA_ROOT).stat().st_dev | ||
except OSError: | ||
media_root_dev = None | ||
warnings.append( | ||
CheckWarning( | ||
"Your MEDIA_ROOT setting points to a path that does not exist.", | ||
id="pulpcore.W001", | ||
) | ||
) | ||
|
||
try: | ||
upload_temp_dir_dev = Path(settings.FILE_UPLOAD_TEMP_DIR).stat().st_dev | ||
except OSError: | ||
upload_temp_dir_dev = None | ||
warnings.append( | ||
CheckWarning( | ||
"Your FILE_UPLOAD_TEMP_DIR setting points to a path that does not exist.", | ||
id="pulpcore.W002", | ||
) | ||
) | ||
|
||
if media_root_dev and media_root_dev != upload_temp_dir_dev: | ||
warnings.append( | ||
CheckWarning( | ||
"MEDIA_ROOT and FILE_UPLOAD_TEMP_DIR are on different filesystems. " | ||
"It is highly recommended that these live on the same filesystem", | ||
id="pulpcore.W003", | ||
) | ||
) | ||
|
||
return warnings |
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
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
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