Open edX as 12-Factor app?

Hello. I am trying to find out if OpenEdx is a 12-Factor-app . If yes how do people manage configuration changes export and push to production? . I am trying to avoid settings/configuration changes on production systems. I would ideally like to do everything on local development and then export the changes to files and track them in git. then push the changes to staging for tests before deploying them to production. That would help avoid download production databases for any development work and also help track all application changes in git. Any help with information or resources related to this would be greatly helpful. Thanks !!

I don’t believe it is a 12 Factor App, although it has been a long time since I’ve looked through that site. It certainly follows a number of the principles, as much of 12FA is actually pretty standard these days, even though they were less common at the time of that writing. But off the top of my head I know that the services are not configured via environment variables – instead, they’re configured via YAML or JSON files that get installed into the application server. Those would conventionally be versioned in a separate, private git repository and applied as part of the deployment process.

Those would constitute environment variables determining the state of the host and things related to that. What I meant by configuration/settings in this content is the actual in-application settings that admin does in order to add functionality or setup the application in a certain way. Usually those are stored in the database, but that would mean I would always need a production database to test anything new I want to do.

If those database configurations are exported to files then they can be tracked in git and the application can be replicated in different environment without actually uploading databases. One could also have different configurations for different environment for instance if a feature should only be pushed to staging server for long term testing etc and later ultimately to production systems. This also helps in rollbacks.

Drupal has something like this . Its a very popular CMS framework based on Symfony(PHP). drupal-configuration-management

Hmm… there’s actually a mix, come to think of it.

  • Most of the configuration settings are, like I said, stored in JSON or YAML files, amenable to source control. (These are loaded as Django settings.) You’d have different config files for each of development, stage, and production; you “promote” a config change by copying it from the development config file to stage and later to production.
  • There are also some database-stored settings, in the form of Waffle flags or config models. These are not tracked in source control, and are managed through the Django admin site. We do try to limit the number of these, but there are compelling reasons to have them in some cases.

There shouldn’t be any need to copy production databases for development work, and I think the community would generally regard it as a bad thing if we needed to do that.

The way we actually do development is with, which has a provisioning script that creates a few users and a course in the local database. The development configs are built into the source repos, unlike the stage and prod configs which have to be managed separately.

1 Like

Thanks for clarification

So as I understand it there is no need for downloading production databases for local development. So Open Edx being a Django app has features for replicating the exact state of the entire production system ?
This would not include the content which users enter on the production site, but would include all the configuration that sets up an application.
In a Drupal development cycle configuration always starts in local and then goes to production. And since everything is tracked in git the repo can be used to spin up an exact clone of the application.Production system is locked for any configuration changes and only accepts content.
I am trying to check if OpenEdx can support this kind of devleopment.

Moodle has something like this called admin-presets but it does not really cover everything. Moodle is over 20 years old, so maybe its good enough for them :).

@neecoe Correct, there is no need to download a production database for Open edX development.

Tutor, which is a sort of configuration manager & runner for Open edX, lets you specify your entire configuration in config.yml and in Python-based plugins, both of which can be version controlled. Running tutor config save generates an execution environment basd on your configuration/plugins, and running tutor local do init applies any database configuration that’s necessary based on your configuration/plugins. Your configuration and plugins can be shared between a development and a production environment, with completely separate databases.

1 Like

Thats great. Thanks all for the help :slight_smile:

1 Like

As there was a related conversation in Slack, it’s worth closing the loop on that here too. I completely agree with what @Tim_McCormack and @kmccormick say.

A couple key things to remember are:

  1. Some config is in the database, so you need a mechanism for managing that across environments.
  2. Tutor has a mechanism for doing that – but you don’t mention if you are using Tutor.

I am totally new to OpenEdx. Frankly new to Django in general. I have limited time to launch this learning portal. So taking my time to learn the codebase and Django along with it :slight_smile: . I have heard good things about both Django ad OpenEdx. Right now I am trying to figure out the hosting bits and setting up a development workflow which I can trust. The priority right now is to get the portal running. I think the project has all the features I need for now so custom development can wait.

Hope I don’t shoot myself in the foot :smile: . I trust well established ci/cd dev workflows to help me with this. Thanks yall for the help.

Perhaps I am too much spoilt by Drupal development. Every changes in local development is tracked b exportable config files by git. I have never done anything in any other way frankly. Its a system I trust and saves me a lot of time and headache.

OpenEdx seems like does not have any system like it. But maybe there is some method to the madness ? I hope to explore while I learn the codebase, and of course will greatly appreciate all the help I can get here in the community.

@neecoe Are you using Tutor? You can version control your entire Tutor project root (except the data/ directory, which you should git-ignore).

1 Like

I am curious if its possible we have some kind of documentation around this workflow? I agree most folks don’t do this yet, but its a great feature to have and a very much recommended practice in dev ops. Makes lives so much easier when it comes to setup up and develop the app. Thanks