Overview
Installing Nuxeo as a Windows service is independent of Nuxeo. So, this is no longer in our development scope since Nuxeo 5.4.
Multiple solutions are available, here are some of them, given without any warranty.
| Once a batch is installed as a service, it cannot be changed: you must first uninstall it, then edit and reinstall in order to change its content. So, it's generally a good idea to write a batch file wrapping calls to nuxeoctl.bat and install that NuxeoWrapper.bat as a service, which will be responsible of starting Nuxeo with the wanted user and environment parameters. |
Prerequisites
In order to run as a service, you have to manage the directory rights for the super-user running the service. There are behavior changes depending on the Windows version.
Also, take care that network directories are usually not available when a service is executing. So, if you need to use some, you will have to mount them in the batch script before starting Nuxeo.
The database used by Nuxeo has to be installed as a service and started before the Nuxeo service.
Available solutions
Yet Another Java Service Wrapper (recommended)
YAJSW is a Java centric implementation of the Java Service Wrapper by tanuki (JSW).
It aims at being mostly configuration compliant with the original. YAJSW is LGPL licensed.
That solution seems to be the more flexible, robust and multi-OS compliant.
Install Nuxeo as a Windows service using YAJSW
- Download YAJSW and unzip the archive.
- Set the system environment variable NUXEO_CONF to the location of your nuxeo.conf file, something like %NUXEO_HOME%\bin\nuxeo.conf.
- Start Nuxeo DM from the command line:
- Once the server is started, you'll get a message like below where XXXX is the process ID of the running Nuxeo application:
- Start a Command Prompt as an Administrator.
- Go to %YAJSW_HOME%\bat folder.
- Execute the genConfig command with the process ID as parameter:
The configuration is written in the file %YAJSW_HOME%\conf\wrapper.conf.
- Stop Nuxeo DM:
- Execute your wrapped application as console application by calling this command and check your application is accessible:
- Edit the file %YAJSW_HOME%\conf\wrapper.conf and set your custom values for these parameters:
- To install the application as service call, execute:
Your service is installed and you can run Nuxeo DM from its service ("Windows Computer Management > Services" on Windows 7).
JBoss Native Windows (aka JBossSVC, JBossService and JavaService)
Deprecated Nuxeo scripts managing install as a Windows service are publicly available at https://svn.nuxeo.org/nuxeo/tools/win32Installer/trunk/.
They were based on JBoss Native Windows which is now not recommended because of a number of defects. However, it was relatively easy to use and provide a quick solution.
Here's the content of jboss-native-2.0.4/bin/service.bat:
Here is another implementation from JBoss, independent of the OS architecture (64bits or not): https://svn.nuxeo.org/nuxeo/tools/win32Installer/trunk/service/.
| Both were licensed under LGPL and so redistributable but there are not fully satisfying. |
Tomcat Service Install/Uninstall script
Using the Tomcat distribution of Nuxeo, you will find a service.bat script in the bin directory that could be adapted to install Nuxeo as a Windows service.
JavaServiceWrapper by Tanuki
Tanuki's library provides multiple methods for integrating a software as a service on various OS, the easier is to use the WrapperSimpleApp helper class to launch the application: see the example of JBoss installed as a Windows service.
It requires to unzip the downloaded wrapper file, configure a wrapper.conf file pointing to %NUXEO_HOME%\bin\nuxeoctl.bat, then write a wrapper.bat file for managing test/install/uninstall:
This solution is known to work well but is sadly not redistributable for us because of its GPL/Commercial license.
.NET InstallUtil
.NET framework provides an InstallUtil.exe tool for installing/uninstalling services.
| There are some disadvantages such as failures in case of multiple frameworks installed and frontward/backward incompatibilities. |
You may have a look at http://msdn2.microsoft.com/en-US/library/system.configuration.install.managedinstallerclass.aspx for managing that programmatically.