Running XP as a service in windows

Enonic version: 6.5
OS: Windows

How can you set XP to run as a service in windows?


1 Like

Is there a special reason for this? :slight_smile:

In any case Windows has the Task Scheduler (Start menu, then type Schedule task) which might do what you request.
Also I have not tried it, but seems to be recommended.

And at last is the Docker-way by downloading the docker-compose setup from Enonic-cloud repo. This setup will restart the containers as long as the docker daemon is running. But then docker is the “service”, on the upside the installation can be ported to any host that runs docker.

To change XP-version edit the Dockerfile in the exp folder.
PSA: The Docker beta for Windows and Mac is the recommended way to install docker on Windows.

1 Like

I have successfully tested kohsuke’s wrapper executable WinSw to set up a windows service with logrotate and service user. It includes a windows-service.exe file and windows-service.xml file that can be used to run windows-service [install | uninstall]

Here is an example configuration:

  <name>Enonic XP Service</name>
  <description>This service runs Enonic XP serving the Intranet.</description>
  <env name="JAVA_HOME" value="C:\software\jdk\1.8.0_101"/>
  <env name="XP_INSTALL" value="C:\server\enonic-xp-intranet"/>
  <env name="XP_HOME" value="%XP_INSTALL%-home"/>
  <env name="DEFAULT_JAVA_OPTS" value="-agentpath:C:\software\yourkit-win64\yjpagent.dll -server -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -Xms6g -Xmx6g"/>
  <arguments>%DEFAULT_JAVA_OPTS% -Dxp.install=%XP_INSTALL% -Dfile.encoding=UTF8 -classpath "%XP_INSTALL%\lib\*" com.enonic.xp.launcher.LauncherMain</arguments>
  <log mode="roll-by-size">
  <onfailure action="restart"/>

Here is a brand new guide for running XP 7 as a windows service :slight_smile: