Skip to content

Conversation

@kdmccormick
Copy link
Member

@kdmccormick kdmccormick commented Feb 26, 2025

Description

What it says on the tin. See individual commits for more details

Supporting Information

Part of:

This is essentially the CMS version of:

Testing instructions

With an up-to-date version of both master and this PR's branch, run ./diff_settings.sh master kdmccormick/settings-cms-envs-production, where diff_settings.sh is:

#!/usr/bin/env bash
# Usage: ./diff_settings.sh GIT_REF_A GIT_REF_B
# Example: ./diff_settings.sh upstream/master myusername/myrefactorbranch
# Will fail if git state is not clean.

set -xeuo pipefail  # Be verbose and strict

REF_A=$1
REF_B=$2
DIR_A=dump_settings_a
DIR_B=dump_settings_b

SETTINGS_AND_CFG=( \
"envs.production,lms/envs/minimal.yml," \
"envs.production,lms/envs/mock.yml,cms/envs/mock.yml" \
"envs.tutor.production,$LMS_CFG,$CMS_CFG" \
"envs.tutor.development,$LMS_CFG,$CMS_CFG" \
)

rm -rf "$DIR_A" "$DIR_B"
mkdir "$DIR_A" "$DIR_B"

for settings_and_cfg in "${SETTINGS_AND_CFG[@]}" ; do
    settings="${settings_and_cfg%%,*}"
    cfg="${settings_and_cfg#*,}"

    lms_cfg="${cfg%%,*}"
    lms_module="lms.${settings}"
    lms_outfile="${lms_module}__${lms_cfg//\//_}.json"
    git checkout "$REF_A"
    DJANGO_SETTINGS_MODULE="$lms_module" LMS_CFG="$lms_cfg" ./manage.py lms dump_settings > "$DIR_A/$lms_outfile"
    git checkout "$REF_B"
    DJANGO_SETTINGS_MODULE="$lms_module" LMS_CFG="$lms_cfg" ./manage.py lms dump_settings > "$DIR_B/$lms_outfile"

    cms_cfg="${cfg#*,}"
    if [[ -n "$cms_cfg" ]]; then
        cms_module="cms.${settings}"
        cms_outfile="${cms_module}__${cms_cfg//\//_}.json"
        git checkout "$REF_A"
        DJANGO_SETTINGS_MODULE="$cms_module" CMS_CFG="$cms_cfg" ./manage.py lms dump_settings > "$DIR_A/$cms_outfile"
        git checkout "$REF_B"
        DJANGO_SETTINGS_MODULE="$cms_module" CMS_CFG="$cms_cfg" ./manage.py lms dump_settings > "$DIR_B/$cms_outfile"
    fi
done

diff "$DIR_A" "$DIR_B" && echo "No difference!"

Should yield:

...
+ diff dump_settings_a dump_settings_b
diff dump_settings_a/cms.envs.production__cms_envs_mock.yml.json dump_settings_b/cms.envs.production__cms_envs_mock.yml.json
4405,4415d4404
<     "KEYS_WITH_MERGED_VALUES": [
<         "FEATURES",
<         "TRACKING_BACKENDS",
<         "EVENT_TRACKING_BACKENDS",
<         "JWT_AUTH",
<         "CELERY_QUEUES",
<         "MKTG_URL_LINK_MAP",
<         "MKTG_URL_OVERRIDES",
<         "REST_FRAMEWORK",
<         "EVENT_BUS_PRODUCER_CONFIG"
<     ],
diff dump_settings_a/cms.envs.tutor.development___openedx_config_cms.env.yml.json dump_settings_b/cms.envs.tutor.development___openedx_config_cms.env.yml.json
2115,2125d2114
<     "KEYS_WITH_MERGED_VALUES": [
<         "FEATURES",
<         "TRACKING_BACKENDS",
<         "EVENT_TRACKING_BACKENDS",
<         "JWT_AUTH",
<         "CELERY_QUEUES",
<         "MKTG_URL_LINK_MAP",
<         "MKTG_URL_OVERRIDES",
<         "REST_FRAMEWORK",
<         "EVENT_BUS_PRODUCER_CONFIG"
<     ],
diff dump_settings_a/cms.envs.tutor.production___openedx_config_cms.env.yml.json dump_settings_b/cms.envs.tutor.production___openedx_config_cms.env.yml.json
2079,2089d2078
<     "KEYS_WITH_MERGED_VALUES": [
<         "FEATURES",
<         "TRACKING_BACKENDS",
<         "EVENT_TRACKING_BACKENDS",
<         "JWT_AUTH",
<         "CELERY_QUEUES",
<         "MKTG_URL_LINK_MAP",
<         "MKTG_URL_OVERRIDES",
<         "REST_FRAMEWORK",
<         "EVENT_BUS_PRODUCER_CONFIG"
<     ],

@kdmccormick kdmccormick force-pushed the kdmccormick/settings-cms-envs-production branch 3 times, most recently from e0e2246 to accbbec Compare February 28, 2025 22:42
@kdmccormick kdmccormick added the create-sandbox open-craft-grove should create a sandbox environment from this PR label Feb 28, 2025
@kdmccormick kdmccormick marked this pull request as ready for review February 28, 2025 23:00
@kdmccormick kdmccormick requested a review from feanil as a code owner February 28, 2025 23:00
@kdmccormick
Copy link
Member Author

@feanil This is ready for review.

I've tested using dump_settings, and I'll smoke test with the PR sandbox on Monday.

@open-craft-grove
Copy link

Sandbox deployment successful 🚀
🎓 LMS
📝 Studio
ℹ️ Grove Config, Tutor Config, Tutor Requirements

We separate out the handful of settings which have useful comments.
The rest of the settings' comments were not helpful--they were either
just stating the obvious, or they were duplicative of what's documented
in common.py.
@kdmccormick kdmccormick force-pushed the kdmccormick/settings-cms-envs-production branch from 699251b to 16d4177 Compare March 4, 2025 19:05
@open-craft-grove
Copy link

Sandbox deployment successful 🚀
🎓 LMS
📝 Studio
ℹ️ Grove Config, Tutor Config, Tutor Requirements

@kdmccormick
Copy link
Member Author

Smoke test looks good. @feanil ready for review

Copy link
Contributor

@feanil feanil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR looks good, checked for typos and logical errors and didn't spot anything new.

@kdmccormick kdmccormick merged commit 774b7e9 into openedx:master Mar 5, 2025
49 checks passed
@kdmccormick kdmccormick deleted the kdmccormick/settings-cms-envs-production branch March 5, 2025 13:25
@edx-pipeline-bot
Copy link
Contributor

2U Release Notice: This PR has been deployed to the edX staging environment in preparation for a release to production.

@edx-pipeline-bot
Copy link
Contributor

2U Release Notice: This PR has been deployed to the edX production environment.

tonybusa pushed a commit to tonybusa/edx-platform that referenced this pull request Apr 23, 2025
This is a pure refactoring of cms/envs/production.py, removing several
redundant statements that have accrued over the years as the platform moved
from python-only, to python+json, to python+json+yaml, to today's python+yaml
setup.

This is the CMS version of:
* a81493c
* (originally 1593923)

Also included:

* Add some more explicit structure to the both LMS's and CMS's
  production.py using big comments.

* In both LMS and CMS settings, alphabetize the production overrides,
  and remove the extraneous comments. Separate out the handful of settings
  which have useful comments. The rest of the settings' comments were not
  helpful--they were either just stating the obvious, or they were duplicative
  of what's documented in common.py.

Co-Authored-By: Feanil Patel <feanil@axim.org>

Part of: openedx#36215
UsamaSadiq pushed a commit that referenced this pull request May 14, 2025
This is a pure refactoring of cms/envs/production.py, removing several
redundant statements that have accrued over the years as the platform moved
from python-only, to python+json, to python+json+yaml, to today's python+yaml
setup.

This is the CMS version of:
* a81493c
* (originally 1593923)

Also included:

* Add some more explicit structure to the both LMS's and CMS's
  production.py using big comments.

* In both LMS and CMS settings, alphabetize the production overrides,
  and remove the extraneous comments. Separate out the handful of settings
  which have useful comments. The rest of the settings' comments were not
  helpful--they were either just stating the obvious, or they were duplicative
  of what's documented in common.py.

Co-Authored-By: Feanil Patel <feanil@axim.org>

Part of: #36215
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

create-sandbox open-craft-grove should create a sandbox environment from this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants