Restore OSGi configurations from database
How can I restore OSGi configurations stored in JCR ?
The behaviour and method to restore configuration depend on each configuration type, which identifies where the configuration is coming from. Configuration type is one :
- System : Configuration is provided with default Jahia install. It is listed in org.jahia.bundles.config.cfg as a system config. It should never be modified by the user
- User : Configuration manually created by the user
- Module : Configuration is coming with a module and is deployed when the module is installed. These files are identified with the header :
# Do not edit - Configuration file provided by module, any change will be lost
- Module default : Default configuration coming with a module, can be modified by the user. These files are identified with the header :
# Default configuration
To restore OSGi configuration :
- At runtime : you can use the karaf command
config:restoreto restore configurations stored in the
/module-management/configsnode. This command optionnaly takes the types of configurations to restore - by default only user and modules default configuration are restored, but the command also allow you to restore system or module configurations as they are stored in the JCR.
- When Jahia is stopped : In the digital-factory-data folder, create a marker file named
[persisted-configurations].dorestore([persisted-configurations] is not a placeholder, it is the actual name to use for the marker file). Configurations will be restored at startup. Only user and modules default configuration are restored
The processing node will automatically store configurations when a change is detected. This can also be manually triggered on any node by calling
config:store command. This can be useful if for any reason the configurations are not correctly synchronized between the nodes.