Monday, December 17, 2007

Install Alfresco Deployment Module as a Windows Service

Having to deal with Windows, I naturally wanted to install the Alfresco Community Deployment Module as a windows service in the server hosting the standalone production HTTP server.

First thing first. Download the module from Alfresco Community Network go to Download Web Content Management extension and get the alfresco-community-deployment-2.1.0.zip file. Extract its contents to C:\ or whatever (This will be the ALF_DEPLOYMENT_HOME).

Now the Windows Service thing.

I came across a very useful library, which among many other things, runs Java applications as Windows Services or Unix Daemons. The library is Java Service Wrapper. Get the binary distribution an extract it to your preferred destination (WRAPPER_HOME).

I extracted, and in some cases renamed, the following files to the specified folder:

WRAPPER_HOME\bin\wrapper.exe -> ALF_DEPLOYMENT_HOME
WRAPPER_HOME\lib\wrapper.dll -> ALF_DEPLOYMENT_HOME\wrapper_lib
WRAPPER_HOME\lib\wrapper.jar -> ALF_DEPLOYMENT_HOME\wrapper\lib
WRAPPER_HOME\src\conf\wrapper.conf.ini -> ALF_DEPLOYMENT_HOME\conf\wrapper.conf
WRAPPER_HOME\srr\bin\InstallApp-NT.bat.in -> ALF_DEPLOYMENT_HOME\InstallAlfrescoDeployment-NT.bat
WRAPPER_HOME\src\bin\UninstallApp-NT.bat.in -> ALF_DEPLOYMENT_HOME\UninstallApp-NT.bat

Now configure ALF_DEPLOYMENT_HOME\conf\wrapper.conf to reflect the following values:

# Java Application
wrapper.java.command=C:\Program Files\Java\jdk1.6.0\bin\java

# Java Main class.
wrapper.java.mainclass=org.tanukisoftware.wrapper.WrapperSimpleApp

# Java Classpath (include wrapper.jar) Add class path elements as
# needed starting from 1
wrapper.java.classpath.1=alfresco-deployment.jar
wrapper.java.classpath.2=spring-2.0.2.jar
wrapper.java.classpath.3commons-logging-1.0.4.jar
wrapper.java.classpath.4=alfresco-core.jar;jug.jar
wrapper.java.classpath.5=./wrapper_lib/wrapper.jar
wrapper.java.classpath.6=.

# Java Library Path (location of Wrapper.DLL or libwrapper.so)
wrapper.java.library.path.1=./wrapper_lib

# Java Additional Parameters
wrapper.java.additional.1=-server

# Application parameters. Add parameters as needed starting from 1
wrapper.app.parameter.1=org.alfresco.deployment.Main
wrapper.app.parameter.2=application-context.xml

# Name of the service
wrapper.ntservice.name=Alfresco Deployment

# Display name of the service
wrapper.ntservice.displayname=Alfresco Deployment

# Description of the service
wrapper.ntservice.description=Alfresco community Deployment Module

* I just included the properties I MODIFIED from wrapper.conf, keep in mind there are more properties in the file.

Now just modify InstallAlfrescoDeployment-NT.bat and UninstallAlfrescoDeployment-NT.bat. Look for the following line:
set _WRAPPER_CONF="%_REALPATH%..\conf\wrapper.conf"
and change it to:
set _WRAPPER_CONF="%_REALPATH%conf\wrapper.conf"

Now run InstallAlfrescoDeployment-NT.bat as a user with admin privileges and now you should have a new service named Alfresco Deployment in the windows service console.



That it! You know have a Alfresco Deployment Module installed as a windows service. Hope this post was helpful. See you in the next post!


TIP: Please make sure the values specified in ALFRESCO_WAR/WEB-INF/classes/alfresco/web-client-config-wcm.xml are correct. Specially the ones below, have to match the ones defined for the Alfresco Community Deployment Module (in ALF_DEPLOYMENT_HOME/application-context.xml):

<!-- username to login as on the remote machine >
<remote-username>XXX</remote-username>
<!-- password to use on remote machine -->
<remote-password>XXX</remote-password>
<!-- default RMI port to connect to Alfresco server on remote machine -->
<remote-rmi-port>XXXX</remote-rmi-port>

1 comment:

Anonymous said...

Are you able to consolidate the whole project mayhem onto a pdf format and lend a copy? This will save heaps.