How to achieve incremental bootstrapping?

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Active Member II

How to achieve incremental bootstrapping?

I am currently bootstraping sites and folders for my alfresco instance. There might be new sites and new folders added on an ongoing basis which will all be part of bootstrap. So my alfresco production instance should be able to handle incremental addition of sites and folders. 

To achieve this

1.Should I use ImporterModuleComponent, SpaceStoreImporter or basepath approach?

2. Would alfresco complain if I add folders, sites to the same file that I intend to bootstrap or for every incremental addition of foder/site do I need to bootstrap new files?

5 Replies
Highlighted
Master

Re: How to achieve incremental bootstrapping?

As already recommended in another thread, almost always you should use ImporterModuleComponent. Incremental bootstrapping is as simple as defining multiple instances of the module component for each increment, and either using the module versioning or explicit dependencies (declared via the Spring XML config) for ordering the bootstrap in the correct way. Since Alfresco tracks which module components have already been executed (based on their id/name), it will only execute new ones, and thus achieve the incremental nature you want...

Highlighted
Active Member II

Re: How to achieve incremental bootstrapping?

Thanks Axel Faust‌ for your response. That was very helpful.

1. I have imported a module with the below version 1.0-SNAPSHOT, now to import another incremental module I create another ImporterModuleComponent bean.

Now what should the sinceVersion and appliesFromVersion be for this bean? Lets say for the next release I increment the pom.xml to 1.1-SNAPSHOT, then would the sinceVersion and appliesFromVersion be 1.1-SNAPSHOT?

<bean id="myModule.bootstrap"
      class="org.alfresco.repo.module.ImporterModuleComponent"
      parent="module.baseComponent">

    <!-- Module Details -->
    <property name="moduleId" value="alfresco-bootstrap-platform-jar" />
    <property name="name" value="myModuleBootstrap" />
    <property name="description" value="My Modules initial data requirements" />
    <property name="sinceVersion" value="1.0-SNAPSHOT" />
    <property name="appliesFromVersion" value="1.0-SNAPSHOT" />

2. Wouldn't this become difficult to handle at some point in time when one starts adding multiple ImporterModuleComponent spring beans for every incremental change. Is there a better way to manage the bootstrap-context.xml as it will become quite huge with multiple incremental bootstrap changes.

Highlighted
Master

Re: How to achieve incremental bootstrapping?

The sinceVersion is only for documentation and not evaluated at runtime. The appliesFromVersion should be 1.1 without the SNAPSHOT (not relevant to Alfresco internally). In addition, you should have a property "dependsOn" with a list of bean references to any module component that MUST be executed before this module component. Neither appliesFromVersion nor sinceVersion are used for ordering the execution, and appliesFromVersion (like appliesToVersion) is only used for filtering which module components are allowed to be executed.

And regarding 2) Well, I don't know how many iterations you plan on having, but proper planning and development should help to keep this number from growing too much. But yes, if you are doing massive incremental changes, then of course the number will keep on growing. But you can always split it into multiple files for major iterations.

Highlighted
Active Member II

Re: How to achieve incremental bootstrapping?

Hi Axel Faust

The issue that I am facing is that I have a JAR with a module in the bootstrap-context.xml, lets say the JAR is version 1.0 and the module bean also has version 1.0 and a module id and nam. Alfresco startup picks up my module and applies the changes. 

I then have added another JAR , version 2.0, the module Id and name is different to the above. The version on the module is also 2.0 as per the jar version . 

When my alfresco instance starts up, it still seems to pick up the bootstrap-context.xml from the previous JAR (version 1.0) and not from the new JAR. It does not load the new bootstrap-context.xml on the classpath.

How can I investigate this further as to what could be the issue?

Highlighted
Master

Re: How to achieve incremental bootstrapping?

Why would you add another JAR with version 2.0 while keeping the 1.0 one? There should only be one JAR with the "effective" (aka current) version, which may include configuration / code from the old version unless it has become obsolete.

Of course you will run into trouble in that situation due to the unclean classpath state.