-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Reconcile Tutor and OEP-45 #34446
Comments
I think that OEP-45 makes sense for the most part, but I disagree with some of it. More specifically, defining settings in YAML files: I'm just not sure what we gain by moving values from *.py modules to *.yaml files. What we lose is the ability to inherit/import values from one base configuration to another. This makes it more difficult for applications to override existing behaviour. At the end of the day, we will always need python modules to override complex settings, such as I would love to have better build and management scripts in the upstream repositories. For instance, I tried multiple times to get rid of the custom openedx-assets script. But sometimes the lack of convenient management scripts in the upstream repos makes it difficult to do thinks in a user-friendly way. It would be worth it to make Tutor comply more with OEP-45, but to achieve that we will also have to make quite a few changes in the upstream repositories. Here is what the process would look like:
OEP-45 is based on good common sense. By making Tutor comply more with common sense, we will get closer to reconciliation with OEP-45. |
We discussed OEP-45 again in Arch Hour this morning, as we're considering having Arbi-BOM dive into implementation soon if we still agree it's a good path forward. The topic of YAML vs. Python files came up, the stated advantages of YAML were:
That said, we also said that we should consider Python files instead if we find other reasons that make them work better in practice (which is entirely possible given that it's the Django standard). I will say that in your example of complex settings, edX/2U explicitly moved away from layered Python overrides to YAML files with some duplication because even 1-2 layers of overrides rapidly overwhelmed the ability of even senior developers to reason about how the layering worked and which settings were actually in effect. And regarding changes in the upstream repositories...I think we're ready to start doing that now. If there are specific changes that would help simplify things immediately, feel free to suggest them for tackling early in the process. |
I always say that there are only two things that are difficult about Open edX: one is static assets, and the other is settings. While I think it's great that 2U is thinking about improving the design of LMS/CMS settings, the choice of YAML for storing settings should be just an implementation detail that is specific to 2U. If people want to store settings in YAML, JSON, TOML, environment variables, Ansible Vault or Consul, then that's great; it's not my concern, and it shouldn't be 2U's either. The current implementation of the production.py settings forces Tutor to make use of lms.yml/cms.yml files. The alternative would be to bypass the default production setting files and to re-write production.py settings from scratch -- but that seemed too difficult to me when I started work on Tutor. So we went with minimal lms/cms.yml files. What we should be focusing on is to provide better default settings, both in development and production. Better defaults would make everyone's lives much easier, both at 2U and outside. To understand the difficulties we have with settings, you just need to look at the implementation of the Tutor settings and wonder: why do we have to override so many values? Let's have a look at a few examples:
In some of these examples (though not all) the common thread is that we need to load "base/required" settings and use them to infer other values. You want to load these base settings from YAML, and I'm fine with that -- but don't force this choice on everyone. Instead, provide a generic mechanism to allow anyone to load settings from whichever source they like. Here's what an actual implementation would look like in lms/common.py:
|
How about we just modify the OEP to accept more formats for the config file? It would still be specified by an Most of the examples you gave feel like demonstrations of "we aren't handling derived settings well". There's https://github.com/openedx/edx-platform/blob/master/openedx/core/lib/derived.py , but not many people know about it and the resulting settings declarations look a little odd. I think the approach of loading the custom settings file twice (that I mentioned in my last comment) would probably work better. The file would only need to be parsed once, but the parsed values would be used to set/override settings both near the beginning of the core settings file (to specify any required settings like host and I'm not sure how you'd handle mutation of complex settings like |
My suggestion is that OEP-45 should completely ignore the format of the config file. Django is great for loading settings coming from different sources (proof being that a tool like dynaconf exists) and Open edX should not even try to improve on that.
To require the use of a single config file is an opinionated choice that is not just unnecessary: it's also extra work for people who want to do things differently.
Dynaconf should not be a mandatory tool to run any Open edX IDA. In many cases it would be overkill.
It's not so much that we don't handle derived settings well, but more that we are not providing good defaults. We should really be focusing on better defaults. All the rest is implementation-specific. |
Context
OEP-45 makes declarations about how Open edX services should be structured & packaged as to simplify configuration and deployment. Tutor is aligned with some of these guidelines, such as:
but is at odds with others, such as:
As the official deployment strategy and soon-to-be official developer stack, Tutor ought to be a faithful implementation of any framework that the Open edX community sets around configuration and deployment.
Acceptance
Either:
The text was updated successfully, but these errors were encountered: