-
Type: Task
-
Status: Resolved
-
Priority: Minor
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: 9.1
-
Component/s: nuxeoctl start/stop/admin
-
Epic Link:
-
Tags:
-
Sprint:nxcloud 9.1.4, nxcloud 9.1.5, nxcloud 9.1.6
-
Story Points:3
As it is done for repository DB, Nuxeo should check that every backing resource is ready to be used by Nuxeo before starting.
As it can't be done at runtime startup, we have to find a simple pluggable way to run check on the backing services before starting the Runtime.
The goal is to do the check in nuxeo-launcher which particularity is to have a very limited classpath.
In the verifyInstallation method of the ConfigurationGenerator we have to add a mecanism that iterate over various all activated templates to instanciate some BackingChecker to check the availability of the backing service.
public interface BackingChecker { boolean acceptConfiguration(ConfigurationGenerator cg); void check(ConfigurationGenerator cg) throws ConfigurationException; }
To do that, it's often needed to load a driver which is not present in the launcher's classloader. Therefor we introduce a mecanism to declare a classpath in the nuxeo.default file of a template. For instance, that line :
mongodb.check.classpath=lib:${nuxeo.home}/nxserver/bundles/nuxeo-core-storage-mongodb-*.jar mongodb.check.class=org.nuxeo.ecm.core.storage.mongodb.MongoDBCheck
Would specify a classpath containing all jar of the lib folder of the template dir plus the additional bundle. It also the specify the checker class to instanciate.
We now have a list of BackingChecker that we can check :
public void verifyInstallation() throws ConfigurationException { for (BackingChecker checker : getCheckers()) { if (checker.acceptConfiguration(configurationGenerator)) { checker.check(configurationGenerator); } } }
A configuration will allow to retry check in case of failure.
- is required by
-
NXP-21980 Backing services should be checked at startup
- Resolved