FSR
From AlfrescoWiki
File System Receiver
One of the "deployment servers" for Alfresco. The FSR is a stand alone server that receives updates from Alfresco repository running Web Content Management and publishes them to a flat file system. Typically a web server such as Apache or other application server.
Contents |
[edit] Installation
To install the FSR either build it from the source code with the alfresco ant build system or install the alfresco deployment project downloaded from either source forge or the enterprise release website.
[edit] Building the FSR
First obtain the source code from Alfresco SVN.
The ant build system assembles the FSR in the 'deployment/build' folder. The target to use is 'build-deployment'
Deployment of the FSR will simply consist of copying the files to the target location. (for example c:/Alfresco/Deployment or /opt/alfresco/deployment)
[edit] Downloading the FSR
Simply unizip the contents of the alfresco deployment package into the target location.
Or use the 'deployment' installer for Windows and Linux which will install the FSR and guide you through the configuration.
[edit] Configuration
Configuration of the FSR is via a 'deployment.properties' file and the 'application-context.xml' file which are located in the installation directory. deployment.properties
dep.datadir : where the FSR should store its temporary data dep.logdir : where the FSR should store its log data dep.metadatadir : where the FSR should save metadata dep.rmi.port : default 44100. The port number of the rmi registry dep.rmi.service.port : default 44101. The port number for the deployment service
application-context.xml
Here is the sample application-context.xml file.
<bean id="configuration" class="org.alfresco.deployment.config.Configuration"
init-method="init">
<property name="dataDirectory">
<value>${dep.datadir}</value>
</property>
<property name="logDirectory">
<value>${dep.logdir}</value>
</property>
<property name="metaDataDirectory">
<value>${dep.metadatadir}</value>
</property>
<property name="targetData">
<map>
<entry key="default">
<map>
<entry key="root"><value>target</value></entry>
<entry key="user"><value>admin</value></entry>
<entry key="password"><value>admin</value></entry>
</map>
</entry>
</map>
</property>
</bean>
- root
- where the FSR should place the deployed files, in this case './target'
- user
- used to restrict access to the FSR, in this case 'admin'
- password
- used to restrict access to the FSR, in this case 'admin'
[edit] Starting / Stopping the FSR
The FSR is implemented as a set of java libraries and is inherently multi-platform. To simplify the command line, Bourne shell scripts are provided for UNIX and Windows batch files are provided for Windows.
Please note that the deploy_stop script will be released in forthcoming service packs of Alfresco, it is not part of 2.2.0.
run the deloy_start script to start the file system receiver.
Use <Ctrl>C to terminate the file system receiver.
[edit] On Windows
If you have used the deployment installer to install the FSR then there will be Start Menu actions available to start or stop the FSR from the Start Menu. These are simply calling the deploy_start.bat and deploy_stop.bat scripts.
You can also call the deploy_start and deploy_stop scripts from a command prompt.
It is also possible to install the FSR as a Windows service which can automatically start when Windows starts.
[edit] Extending the FSR
[edit] postCommit
This feature is available in 2.2.0
There is a postCommit callback available which is called after each successful deployment. For example some users of alfresco use ftp to transfer files or send emails when deployment is complete. There is a sample adapter that will call an operating system command, such as a batch script, or the callback can call a custom java class.
The callback(s) are configured in the 'target' properties of the deployment configuration. They are called in sequence.
Diagram to show the FSDeploymentRunnable class
Users need to implement the 'FSDeploymentRunnable' interface.
Two implementations are provided.
- SampleRunnable
- an example which shows you how to use this feature
- ProgramRunnable
- execute a program after deployment
[edit] payload transformation
- Work is currently in progress here and this information is likely to change or not be accurate
This is a new feature being considered for development. To support use/cases such as
- file compression for slow networks
- encryption for sensitive data.
[edit] Running the FSR over protocols other than RMI
- Work currently in progress here.
RMI is a simple to use Java network protocol however there are one or two potential problems which is why some users are interested in using other network protocols.
- interoperability issues
- although rare there can be problems communicating between different implementations of Java.
- encryption
- the RMI protocol is not encrypted so sensitive data can be read by the devious.
- corporate standards
- organisations may have standards for which communication protocols are allowed or they may have infrastructure that requires messages of a certain type, for example a http load balancer.
[edit] Tunnelling RMI over HTTP and HTTPS
One of the features of the Sun implementation of RMI is that if the RMI ports are blocked by a firewall then the transport automatically attempts to connect via HTTP on port 80. And a Java web server can then process this HTTP traffic and forward it to the RMI server.
Before using tunnelling please consider the security implications. For an externally facing web site you will probably want to install another web server and block access to it from the outside with a firewall.
[edit] Replacing RMI
Showstopper, at the moment (Alfresco 2.2.1) the name of the rmi protocol is hard coded into the client side of deployment so this won't work without hacking the alfresco source code.
Spring provides a number of "adapters" for different protocols. Alfresco uses Spring and the FSR is coded such that the protocol can be switched by simple configuration changes.
Spring remoting reference document
[edit] HTTP
HTTP is a well known protocol.
[edit] HTTPS
[edit] Hessian
Hessian is another alternative serialization mechanism for transport over HTTP.
[edit] Implementing your own protocol
Showstopper, at the moment Alfresco 2.2.1 hard codes the rmi protocol in the client side. So it will require changes to the source code to use your new protocol.
It's possible to build your own protocol.
[edit] Debugging the FSR
The FSR can be successfully run in a the Eclipse debugger or can be debugged as a remote process.
[edit] Debug as a Java application within Eclipse
Here are the settings to create a "debug option" Type: Java Application
Main Tab:
- Project
- Deployment
- Main class
- org.alfresco.deployment.Main
Arguments Tab:
- Program Arguments
- application-context.xml
Classpath Tab:
- Classpath
- add the deployment project.
Source Tab:
- Source
- add the deployment project.
[edit] Debugging the FSR as a remote process
To debug as a remote process debugging needs to be enabled in the command line which starts the FSR. Then a Java debugger can connect to this remote JVM.
The following Java command line arguments open a debug port 4001 for debugging.
set DEBUG=-Xdebug -Xrunjdwp:transport=dt_socket,address=4001,server=y,suspend=n set JAVA_OPTS=%DEBUG%
Then in Eclipse, set up a debugging project to debug this remote JVM.


