Multiple Filesystem Deployment Target Configuration

Document created by resplin Employee on Jun 6, 2015
Version 1Show Document
  • View in full screen mode

Obsolete Pages{{Obsolete}}

The official documentation is at: http://docs.alfresco.com



{{AVMWarning}}


Objective


This is an example of how to configure more than one File System Deployment Target in the same Deployment Receiver Engine, regardless of whether that deployment receiver is running in stand alone mode or within Alfresco. This example also omits any mention of the transport protocol (Java RMI or HTTP), as this is configured externally. Please note that this is not a complete, end-to-end example of how to configure the stand-alone deployment receiver. This example also completely ignores any configuration which takes place on the authoring server. We consider only the common configuration required of any deployment receiver.

This example focuses on configuration which achieves the following objectives:


  1. A single root directory contains all configured deployment targets.
  2. This single root directory should be specifiable from a properties file.
  3. Each deployment target consists of a single directory containing a 'metadata' and a 'data' directory.
  4. The autoFix parameter of all deployment targets is identical, and configurable from a properties file.
  5. Directories for logfiles and temporary files are contained by the root directory.
  6. The same authenticator is used for all deployment targets.
  7. Individual deployment targets are configured in separate files.

The resultant directory structure, assuming deployment targets named web1, web2 ... webN, is:


  • BaseDirectory
    • logs
    • temp
    • web1
      • metadata
      • data
    • web2
      • metadata
      • data
    • ...
    • webN
      • metadata
      • data

Prerequisites


  • The Deployment Receiver Engine has been configured with a bean id of 'deploymentReceiverEngine'.
  • The enclosing system is properly configured to load the relevant property files.
  • A Deployment Receiver Authenticator appropriate to the runtime environment has been configured with a bean id of 'targetAuthenticator'.
  • A command queue has been configured with a bean id of 'deploymentReceiverCommandQueue'.

Required properties


This configuration example requires that the following properties be set correctly:










Property
Sets Property
On Component
Description
deployment.filesystem.errorOnOverwrite errorOnOverwrite File System Receiver Service Flag indicating whether overwriting files unrelated to the deployment is an error condition.
deployment.filesystem.baseDir base of all paths File System Receiver Service, File System Deployment Target Path to base of the directory structure
deployment.filesystem.autofix autoFix File System Deployment Target Flag to control the automatic repair of metadata.




Approach


A rough outline of the approach is as follows:


  1. Write the configuration common to all the directories, save to deployment-fsr-target.xml
  2. Make a template which can be used for all the targets (directory-template.xml).
  3. Customize the template for each target (web1-fsr.xml, web2-fsr.xml...)
  4. Install the configuration files in the appropriate place.

Common configuration


Two beans are common to all targets: the File System Receiver Service and its housekeeper. In deployment-receiver-context.xml, which I am using as a starting point for this example, the housekeeper does not appear to be used. Therefore it will also appear to not be used in the following configuration file.

Conceptual details of the configuration follow:


fileSystemReceiverService


Class : org.alfresco.deployment.impl.fsr.FileSystemReceiverServiceImpl
Id : fileSystemReceiverService











Property
Value
errorOnOverwrite ${deployment.filesystem.errorOnOverwrite}
dataDirectory ${deployment.filesystem.baseDir}/temp
logDirectory ${deployment.filesystem.baseDir}/logs
commandQueue bean ref: deploymentReceiverCommandQueue

fileSystemReceiverHousekeeper


Class : org.alfresco.deployment.impl.fsr.FileSystemReceiverHousekeeper
Id : fileSystemReceiverHousekeeper





Property
Value
fileSystemReceiverService bean ref: fileSystemReceiverService

deployment-fsr-target.xml



<beans>       
    <bean id='fileSystemReceiverService' class='org.alfresco.deployment.impl.fsr.FileSystemReceiverServiceImpl'
          init-method='init'>
         
        <property name='errorOnOverwrite'><value>${deployment.filesystem.errorOnOverwrite}</value></property>
       
        <property name='dataDirectory'>
            <value>${deployment.filesystem.baseDir}/temp</value>
        </property>
       
        <property name='logDirectory'>
            <value>${deployment.filesystem.baseDir}/logs</value>
        </property>
       
        <property name='commandQueue'><ref bean='deploymentReceiverCommandQueue' /></property>
       
    </bean>
   
    <bean id='fileSystemReceiverHousekeeper' class='org.alfresco.deployment.impl.fsr.FileSystemReceiverHousekeeper'
     init-method='init'>
     <property name='fileSystemReceiverService'><ref bean='fileSystemReceiverService'/></property>
    </bean>

    <import resource='classpath*:alfresco/deployment/*-fsr.xml' />
    <import resource='classpath*:alfresco/extension/deployment/*-fsr.xml' />
</beans>

Directory template


The objective of making a template is so that targets can be quickly declared with minimal editing. In this case, the only parameter required to fill in the template is the target name. Any text editor (or sed for that matter) should be capable of instantiating this template quickly.

The template creates only two beans, and one is a utility which is used to register the target with the deployment engine. Both beans are anonymous (i.e., they have no id property.) Conceptual details follow:


anonymous registration bean


Class : org.alfresco.deployment.impl.server.DeploymentTargetRegistrationBean
Id : anonymous
init-method : register









Property
Value
name TARGET
registry bean ref: deploymentReceiverEngine
target bean definition (see below)

anonymous target bean


Class : org.alfresco.deployment.impl.fsr.FileSystemDeploymentTarget
Id : anonymous















Property
Value
name TARGET
rootDirectory ${deployment.filesystem.baseDir}/TARGET/data
metaDataDirectory ${deployment.filesystem.baseDir}/TARGET/metadata
autoFix ${deployment.filesystem.autofix}
authenticator bean ref: targetAuthenticator
fileSystemReceiverService bean ref: fileSystemReceiverService

directory-template.xml



<beans>

    <bean class='org.alfresco.deployment.impl.server.DeploymentTargetRegistrationBean'
        init-method='register'>

        <property name='name'>
            <value>TARGET</value>
        </property>

        <property name='registry'>
            <ref bean='deploymentReceiverEngine'/>
        </property>

        <property name='target'>
            <bean class='org.alfresco.deployment.impl.fsr.FileSystemDeploymentTarget'
                init-method='init'>

                <property name='rootDirectory'>
                    <value>${deployment.filesystem.baseDir}/TARGET/data</value>
                </property>

                <property name='metaDataDirectory'>
                    <value>${deployment.filesystem.baseDir}/TARGET/metadata</value>
                </property>

                <property name='autoFix'>
                    <value>${deployment.filesystem.autofix}</value>
                </property>

                <property name='fileSystemReceiverService'>
                    <ref bean='fileSystemReceiverService'/>
                </property>

                <property name='name'>
                    <value>TARGET</value>
                </property>

                <property name='authenticator'>
                    <ref bean='targetAuthenticator'/>
                </property>
            </bean>
        </property>
    </bean>
</beans>

Template customization


To customize the above template, simply do a case-sensitive global search and replace. Replace the string TARGET with the name you have chosen for your target. Because this name will appear in the path, it should be a legal directory name on whatever system you plan on running your filesystem deployment receiver. Wise users will avoid spaces and special characters.

After the substitution is done, save the file as {your directory name here}-fsr.xml.


Configuration file installation


The proper location to install the files depends on whether you are running the stand alone deployment receiver or your receiver is running within Alfresco itself.


Stand alone receiver : deployment/*
Alfresco : extension/deployment/*

Multiple Collections of Directories


The pattern in this file may be used to support more than one 'series' of deployment targets. Take, for instance, the situation where one base directory contains all web projects to be served by Apache httpd, and another base directory contains all web projects to be served by Apache Tomcat. Instead of performing the configuration on this page once, resulting in a single deployment-fsr-target.xml and the associated directory files {directory}-fsr.xml, it would be necessary to perform the configuration once for each collection of directories. If the two series were 'httpd' and 'tomcat':


  1. there would be two targets: deployment-httpd-target.xml and deployment-tomcat-target.xml
    1. each target should use a different property in place of deployment.filesystem.baseDir
    2. each target should use a different filename pattern to include directories
  2. two directory templates would have to be made, one for each series
    1. each directory template should use the same replacement property for deployment.filesystem.baseDir as its corresponding target file
    2. customizations of each template should be named appropriately (directory-httpd.xml or directory-tomcat.xml)

Application Note for users of Alfresco Community 3.2r2


Any target configured as a 'Test' server will likely fail. Before trying to debug your target configuration too much, just configure it as a 'Live' server and see if the error persists. See ALF-1527. It looks like this is fixed on head right now and will be fixed in the Community 3.3 release.


References


Community Edition
3.2
3.2r2
AVM

Attachments

    Outcomes