-
Notifications
You must be signed in to change notification settings - Fork 0
feat: add django-aqueduct typed settings for edx-platform K8s deployments #39
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
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
0feb18c
feat: add django-aqueduct typed settings for edx-platform K8s deploym…
blarghmatey 14b6bf0
fix: address PR review feedback on aqueduct settings
blarghmatey 833b60f
style: apply ruff formatting to generated model files
blarghmatey 3070a83
chore: Automatic formatting fixes
blarghmatey abfd96a
style: apply ruff formatting
blarghmatey f70b34c
refactor: rename BaseProductionSettings to ProductionSettingsMixin
blarghmatey db80c3a
version: Update uv lock
blarghmatey 1073938
style: apply ruff formatting
blarghmatey 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 hidden or 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,120 @@ | ||
| --- | ||
| # See https://pre-commit.com for more information | ||
| # See https://pre-commit.com/hooks.html for more hooks | ||
| ci: | ||
| skip: | ||
| - packer_fmt | ||
| - hadolint-docker | ||
| repos: | ||
| - repo: https://github.com/pre-commit/pre-commit-hooks | ||
| rev: v6.0.0 | ||
| hooks: | ||
| - id: trailing-whitespace | ||
| - id: end-of-file-fixer | ||
| - id: check-yaml | ||
| exclude: | | ||
| (?x)( | ||
| src/ol_infrastructure/infrastructure/aws/eks/files/| | ||
| src/ol_infrastructure/applications/edxapp/files/edxapp/.*/.*\.yaml| | ||
| charts/| | ||
| sdk/ | ||
| ) | ||
| - id: check-added-large-files | ||
| - id: check-merge-conflict | ||
| - id: check-toml | ||
| - id: debug-statements | ||
| - repo: https://github.com/jumanjihouse/pre-commit-hook-yamlfmt | ||
| rev: 0.2.3 | ||
| hooks: | ||
| - id: yamlfmt | ||
| args: | ||
| - --mapping | ||
| - '2' | ||
| - --sequence | ||
| - '2' | ||
| - --offset | ||
| - '0' | ||
| - --width | ||
| - '80' | ||
| - --preserve-quotes | ||
| exclude: | | ||
| (?x)( | ||
| src/ol_infrastructure/applications/edxapp/files/edxapp/.*/.*\.yaml| | ||
| charts/| | ||
| sdk/ | ||
| ) | ||
| - repo: https://github.com/adrienverge/yamllint.git | ||
| rev: v1.38.0 | ||
| hooks: | ||
| - id: yamllint | ||
| args: [--format, parsable, -d, relaxed] | ||
| exclude: | | ||
| (?x)( | ||
| src/ol_infrastructure/applications/edxapp/files/edxapp/.*/.*\.yaml| | ||
| charts/| | ||
| sdk/ | ||
| ) | ||
| - repo: https://github.com/Yelp/detect-secrets | ||
| rev: v1.5.0 | ||
| hooks: | ||
| - id: detect-secrets | ||
| args: | ||
| - --exclude-lines | ||
| - '(^encryptedkey:|^secure:|^secretsprovider:)' | ||
| - --exclude-files | ||
| - src/bridge/secrets/ | ||
| - --exclude-files | ||
| - poetry.lock | ||
| - --exclude-files | ||
| - src/ol_infrastructure/applications/ocw_site/redirect_dict | ||
| - --exclude-files | ||
| - charts/ | ||
| - --exclude-files | ||
| - settings/.*/models/aqueduct\.py | ||
|
blarghmatey marked this conversation as resolved.
blarghmatey marked this conversation as resolved.
|
||
| - --exclude-files | ||
| - settings/models/base\.py | ||
| - repo: https://github.com/astral-sh/ruff-pre-commit | ||
| # Ruff version. | ||
| rev: 'v0.14.14' | ||
| hooks: | ||
| - id: ruff-format | ||
| - id: ruff-check | ||
| args: [--extend-ignore=D1, --fix] | ||
|
blarghmatey marked this conversation as resolved.
blarghmatey marked this conversation as resolved.
blarghmatey marked this conversation as resolved.
|
||
| - repo: https://github.com/pre-commit/mirrors-mypy | ||
| rev: v1.19.1 | ||
| hooks: | ||
| - id: mypy | ||
| exclude: | | ||
| (?x)( | ||
| dockerfiles/| | ||
| settings/| | ||
| src/lehrer/| | ||
| sdk/ | ||
| ) | ||
| args: | ||
| - --explicit-package-bases | ||
| - --namespace-packages | ||
| - --config-file=pyproject.toml | ||
| - --warn-unused-configs | ||
| additional_dependencies: | ||
| - pydantic>2.10 | ||
| - types-PyYAML | ||
| - types-requests | ||
| - repo: https://github.com/shellcheck-py/shellcheck-py | ||
| rev: v0.11.0.1 | ||
| hooks: | ||
| - id: shellcheck | ||
| - repo: https://github.com/rhysd/actionlint | ||
| rev: v1.7.10 | ||
| hooks: | ||
| - id: actionlint | ||
| name: actionlint | ||
| description: Runs actionlint to lint GitHub Actions workflow files | ||
| - repo: https://github.com/mitodl/pre-commit-packer | ||
| rev: v0.0.3 | ||
| hooks: | ||
| - id: packer_fmt | ||
| - repo: https://github.com/hadolint/hadolint | ||
| rev: v2.14.0 | ||
| hooks: | ||
| - id: hadolint-docker | ||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,48 @@ | ||
| """CMS (Studio) production settings module — django-aqueduct entry point. | ||
|
|
||
| Injected by the lehrer Dagger build into: | ||
| /openedx/edx-platform/cms/envs/aqueduct.py | ||
|
|
||
| Usage:: | ||
|
|
||
| DJANGO_SETTINGS_MODULE=cms.envs.aqueduct | ||
|
|
||
| The typed pydantic model that backs this module lives alongside it at | ||
| ``cms.envs.models.aqueduct`` (generated from the running platform via | ||
| ``manage.py generate_aqueduct_settings``). Update that model by running | ||
| the command inside the Docker image and committing the result to lehrer:: | ||
|
|
||
| DJANGO_SETTINGS_MODULE=cms.envs.aqueduct \\ | ||
| python manage.py generate_aqueduct_settings \\ | ||
| --output cms/envs/models/aqueduct.py | ||
|
|
||
| Loading strategy (highest → lowest priority): | ||
|
|
||
| 1. Environment variables — flat scalars from K8s ``envFrom`` ConfigMaps | ||
| and Secrets. | ||
| 2. YAML files under ``OL_SETTINGS_DIR`` (sorted, deep-merged) — complex | ||
| types such as ``DATABASES``, ``CACHES``, ``JWT_AUTH``, ``FEATURES``. | ||
| 3. ``AqueductSettings`` field defaults from ``cms.envs.models.aqueduct``. | ||
| """ | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| from pydantic import model_validator | ||
|
|
||
| from django_aqueduct import configure_django_settings | ||
|
|
||
| from .models.aqueduct import AqueductSettings | ||
| from .models.base import ProductionSettingsMixin | ||
|
|
||
|
|
||
| class CMSProductionSettings(ProductionSettingsMixin, AqueductSettings): | ||
| """Typed CMS (Studio) production settings.""" | ||
|
|
||
| @model_validator(mode="after") | ||
| def _derive_urlconf(self) -> CMSProductionSettings: | ||
| if getattr(self, "ROOT_URLCONF", None) is None: | ||
| self.ROOT_URLCONF = "cms.urls" # type: ignore[attr-defined] | ||
| return self | ||
|
blarghmatey marked this conversation as resolved.
|
||
|
|
||
|
|
||
| configure_django_settings(CMSProductionSettings) | ||
This file contains hidden or 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 hidden or 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.
Uh oh!
There was an error while loading. Please reload this page.