Nicolas Raoul
Nicolas Raoul

Reputation: 60203

Import another property file from alfresco-global.properties?

Alfresco's properties can be set in alfresco-global.properties.

I have a cluster with 5 nodes, and whenever I have to change a setting (=several times per day), I need to go modify on each of the 5 nodes.

I would like to only modify a single file, on a shared NFS drive. I have thought of making alfresco-global.properties a symlink to /nfs/nico/alfresco-global.properties but unfortunately each node has a different alfresco.jgroups.bind_address.

I would like to split the configuration in two files: a CONF1 file specific to each cluster node, and a common CONF2 file, shared over NFS.

QUESTION: how can I "import" CONF2 from CONF1?

Upvotes: 0

Views: 1569

Answers (1)

skuro
skuro

Reputation: 13514

There's no "import" mechanism in properties files. To solve your problem you really need to externalize the node specific properties from the cluster wide ones. The strategy you envisioned of accessing the same file from all app servers through a network attached FS is the easiest solution. If you look at core-services-context.xml you'll find the following:

<!-- Global properties used in property expansion throughout the container, overridable via JNDI or System properties -->
<bean id="global-properties" class="org.alfresco.config.JndiPropertiesFactoryBean">
    <property name="locations">
        <list>
            <value>classpath:alfresco/repository.properties</value>
            <value>classpath:alfresco/domain/transaction.properties</value>
            <!-- <value>classpath:alfresco/jndi.properties</value> -->
            <!--  Overrides supplied by modules -->
            <value>classpath*:alfresco/module/*/alfresco-global.properties</value>
            <!--  Installer or user-provided defaults -->
            <value>classpath*:alfresco-global.properties</value>
        </list>
    </property>
    <property name="systemPropertiesModeName">
        <value>SYSTEM_PROPERTIES_MODE_OVERRIDE</value>
    </property>
    [...]
</bean>

You can either declare a new JndiPropertiesFactoryBean in a custom Spring context which loads a properties file from a convenient, shared location, or you can exploit the modules properties loading mechanism and make sure you have alfresco/module/cluster-defaults/alfresco-global.properties in your classpath pointing to such a shared location.

Upvotes: 2

Related Questions