Unified Backups: Load Context from configuration data
Context
Current implementation hard-code the loading of Context information from making method calls into the gitlab-rails codebase.
This coupling was an intentional decision in order to be able to release the MVC.
In order to decouple the Context from the monolith codebase, we need to auto-detect which environment we are in (GDK/Source, Omnibus, later on Docker, Kubernetes) and based on those load the necessary information from the configuration source.
At this point we are targeting GDK/Source and Omnibus.
Proposal
In order to detect and integrate with Omnibus:
- Detect whether the Omnibus integration ENV variable is set, and load the
json
environment data. - Ensure the
json
data is valid (schema), and is a supported version number (right now we have only one version, but the code should ensure version is not bigger then current supported one.
When Omnibus environment is not detected, assume GDK/Source and use hard-coded default values
In order to load the Context data, we need to load the configuration data pointed over either by the default locations (GDK) or by the json environment data (Omnibus).
With the configuration data loaded, we should extract all required information and provided them in a Context object.
Each environment type should have its own Context object, and allow some introspection:
SourceContext
-
OmnibusContext
(point to the datasource locations and/or the datasource objects, data source version, etc)