The configuration of CIS servers

To avoid getting a bloated cereconf, the configuration variables that is only related to CIS services are put in their own configuration regime. Note that settings that are not specific to the CIS services, but are also used by other parts of Cerebrum should stay in cereconf.py.

Summary

In short, you have the files, in the order of inheritance:

  • Cerebrum/modules/cis/default_config.py - the default settings for all servers in all instances.
  • cerebrum_sites/etc/*/cisconf/base.py - the default settings for all servers at a specific instance.
  • cerebrum_sites/etc/*/cisconf/*.py - the settings for a given CIS server at a specific instance.

In addition, you have:

  • cereconf.py - for settings that are not specific to CIS.

Default config

We have a default config file, like for cereconf's Cerebrum/default_config.py. This is put in:

Cerebrum/modules/cis/default_config.py

This should contain the default settings for all CIS variables together with explanations for the variables. Note that since the different services have different needs and thus make use of different configuration variables, we should not put every variable in here, only those that are used by different CIS services.

Instance's config

Each instance must have their own configuration files that is put in a subdirectory *cisconf/* where *cereconf.py* is placed. We place such config files in:

cerebrum_sites/etc/$INSTANCE/cisconf/

Note that the directory has to have an (empty) file named __init__.py for python to be able to import the config files. If you get the error

ImportError: No module named cisconf

this could mean that either the cisconf directory is missing, or the __init__.py file is missing.

The files:

  • base.py contains settings that are used by every CIS service. This file must import the default settings:
from Cerebrum.modules.cis.default_config import *
  • service-specific settings are put in their own files, e.g. individuation_config.py, postmaster_config.py, group_config.py. Such files must import the base file:
from cisconf.base import *

The different CIS servers must then import their own config. Examples:

import cereconf
from cisconf import indivconf
from cisconf import cis_group_conf
from cisconf import cis_postmaster_conf

Name standard

The files beneath cerebrum_sites/etc//cisconf/* could be named whatever is logical for the service, but it should be distinguishable from other config files.

The code that imports such settings is recommended to rename the config to cisconf. Example:

from cisconf import postmaster_config as cisconf
# ...
print cisconf.PORT

This means that all CIS servers should only use cisconf for getting CIS config.

Author: jokim

Publisert 25. juli 2013 14:48