- Grouper configuration in the database migrate to on demo server
- Grouper configuration in UI read-mode
- Grouper configuration in UI readwrite mode
In a patch to Grouper 2.4, Grouper will allow configuration which is normally in config files to be stored in the database. Configuration in the database will make the configuration consistent in an environment, otherwise the config files need to be kept in sync for the UI servers, WS servers, daemons, and GSH. Also, editing the configuration in the UI will prevent configuration problems and help users to configure Grouper easier and more reliably.
How it works
In the hierarchy section of the config file will be an option to use the database
e.g. in grouper.base.properties
This "database:grouper" will check the grouper database table: grouper_config for overlays. This should be last so that when you edit something in the UI, it will take effect.
|CONFIG_FILE_NAME||Config file name without the "base", e.g. grouper.properties or grouper-loader.properties|
|CONFIG_KEY||key of the config, e.g. grouper.env.name|
value of the config, on the right of the equals sign in the properties file. Note, currently there is a 4k limit to size of value
|Note: there are more columns in this table which are currently unused|
Note: if you have configs you want to differ in different components (e.g. ws/ui/daemon), you need to set those in the config files, and not in the database, which will span all components (e.g. UI/WS/Daemon) that use that database
- grouper.client.properties (if there is a grouper.hibernate.properties in the classpath)
- grouper.hibernate.properties (note, the database connection information needs to be in the config file of course, since that database holds the configuration and it needs to be able to connect)
Edit the configuration in the UI
There will be an editor in the UI
- Grouper admins will be able to view/edit the UI
The source IP address will need to configured or disabled in grouper-ui.properties
- The UI will show where the config comes from in the hierarchy of config (e.g. could be base, override, database, etc)
We will use this facility to create wizards for various things like source config, pspng config, etc.
The UI will use comments in the config file to describe the configuration, and will also use configuration metadata (described below)
Import/export the config
You can import/export the configuration in the database. You cannot import a "base" config file.
You can import from a config file. This will only be a config file in the classpath or on the filesystem. This is how to get started with this feature. Note, you will need to remove the config from other config files as well, e.g. web service configs.
If we need to be able to export a properties file we can do that too.
You can export a consolidated XML file which has all config from the database. This will export on the file system and will not be downloadable from the UI
You can import from a consolidated export from the filesystem.
There can be JSON configuration metadata in the config files to help the UI correctly display and validate the configs. These metadata are in the "base" config files only. This is an example:
Note: just because there is validation doesnt mean a script cant be used.... e.g.
|Metadata name||JSON type||Default||Example value||Description|
|multiple||boolean||false||true/false||if comma separated values|
|mustExtendClass||String||a.b.c.SomeClass||If the value is a class and must extend another class|
|mustImplementInterface||String||a.b.c.SomeInterface||If the value is a class and must extend an interface|
|String||^configuration.autocreate.group.description.[0-9]+$||If the key must match a certain regex|
|required||boolean||false||true/false||If a value must be provided|
|requiresRestart||boolean||false||true/false||If the JVM needs to be restarted when changing value|
|sampleValue||String||Something||An example value that shows the user how to configure|
|sensitive||boolean||false||true/false||If the value can be a password or something sensitive|
attributeDef, attributeDefName, boolean, class, floating, group, integer, password, stem, string, subject
|From enum ConfigItemMetadataType, the type of the value|
Configuration file layout
Config file starts with license, which has comments, none of which start with 10 hashes
Section header starts with a comment with at least 10 hashes, has documentation that starts with two hashes, and ends with a line with at least 10 hashes. Note the first line is the header in the config UI, and the next lines are the description (more info).
- Blank line separates items and sections
Config file comment and item has documentation. Comments start with a single hash. Comments can contain json metadata. Metadata can span several comment lines. Item keys and values are separated by an equals and optional whitespace. Metadata must follow comments, not the other way around. After the comment or metadata is the property or whitespace
grouper.properties config for DB config (across all configs)
You could comment out one sample value after the metadata which will be used an a sample value. A sample value shows up on the screen but has no value
Technical design of retrieving the configuration from the database
Log with this in log4j.properties
In the grouper client (since that is where the hierarchical config code is), have the logic to retrieve the configuration from the database.
It should use pooling so that it is efficient.
If should NOT use anything from the grouper API or anything that uses grouper client config (basically dont use anything except maybe Morph encryption in the grouperClient, and external libraries e.g. c3p0 pooling). This is because the database framework in the API uses configuration. So the configuration cannot use the API or there is a circular logic problem in looping and bootstrapping.
There are some configs for this, but these are set after the first grouper.properties is retrieved. These are not in the grouper-hibernate.properties so they can be edited at runtime (grouper-hibernate.properties is not stored in the database of course).
A configuration is retrieved from the API (from any of the config files)
- If it has not been longer than the *.config.secondsBetweenUpdateChecks for that config (e.g. grouper.config.secondsBetweenUpdateChecks), then just return the cached (in memory) config
- If it has been longer, then see if the last full refresh has been longer than grouper.config.secondsBetweenFullRefresh. If so, then do a full refresh of all configs in DB
- If it has been longer, then see if has not been longer than grouper.config.secondsBetweenUpdateChecksToDb. If it has not, then get the DB config for that config file from memory cache
- If it has been longer, then query the millis since last refresh (from config table, get this value): grouper.config.millisSinceLastDbConfigChanged If the last refresh is before that value, then do a full refresh
- Note, Grouper can clear the cache when any property (besides grouper.config.millisSinceLastDbConfigChanged) is changed
- Note: grouper.config.millisSinceLastDbConfigChanged is updated by grouper (and not audited), when there is any insert/update/delete to config