Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-21532

Specify the way backing services should be checked before starting Nuxeo

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 9.1

      Description

      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.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: