Story #3943
closedIssue #3981: Switch Pulp3 settings to Dynaconf
As a user, I can configure Pulp using environment variables
100%
Description
Problem Statement¶
While trying to get Pulp3 running on Openshift I ran into an issue where I needed to set a setting in the settings.yaml file from an environment variable. For example the IP of the postgresql instance is only known to openshift and available via an enviornment variable.
This is a blocker on deploying Pulp3 into Openshift.
Solution¶
Make our settings file a python module instead with the config available at as a module attribute named 'PULP_CONFIG', e.g.
$ cat settings.py
# get lots of data from ENVIRONMENT variables
PULP_SETTINGS = {} # This would be the toplevel dictionary that would overwrite _DEFAULT_PULP_SETTINGS
# _DEFAULT_PULP_SETTINGS is here: https://github.com/pulp/pulp/blob/master/pulpcore/pulpcore/app/settings.py#L163
How will the conf file be imported?¶
Same way as today, first an environment variable is checked which contains a full path to the python module. If that environment variable isn't set it defaults to look to /etc/pulp/settings.py
The only change is /etc/pulp/server.yaml to /etc/pulp/settings.py as the default location accessed.
Problem: Pulp can't be configured using environment variables
Solution: use dynaconf to manage all of Pulp configuration settings
This patch also adds pulpcore.rqconfig module that is dynamically generated from the Django settings generated by dynaconf. The rq workers use this module for their configuration.
The default location of the config file is now at
/etc/pulp/settings.py
. Pulp can operate without by relying on environment variables.closes: #3981 https://pulp.plan.io/issues/3981
closes: #3879 https://pulp.plan.io/issues/3879
closes: #3980 https://pulp.plan.io/issues/3980
closes #3618 https://pulp.plan.io/issues/3618
closes: #3943 https://pulp.plan.io/issues/3943