Service wrapper

Introduction

In order to easily start and stop Kauri on deployment systems (often as part of the server boot process), Kauri includes the Tanuki Java Service Wrapper. This provides solutions for both Unix and Windows.

The service wrapper configuration we provide is intended for use with binary Kauri distributions and packaged Kauri applications.

Usage

Package your application

Packaging your application is described in detail here. In summary, assuming the kauri-package-plugin is configured in your pom.xml, it is a matter of executing:

mvn kauripackage:package

This will create the packaged application in the directory target/kauri-package.

The packaged application contains configuration files and scripts for the service wrapper. The actual wrapper binaries are part of the binary Kauri release.

Modify service-wrapper.conf

In the service directory of the packaged application, you will find a service-wrapper.conf file. Edit this file and adjust the two variables shown below:

# Environment variables
set.default.KAURI_HOME=/home/me/kauri/
set.default.KAURI_APPLICATION_HOME=/home/me/my-packaged-kauri-application

On Windows, use forward slashes in the paths, for example c:/kauri

Use absolute paths in both cases.

The KAURI_HOME variable should point to your binary Kauri installation, for example c:/kauri-{version}

The KAURI_APPLICATION_HOME variable should point to your packaged application, thus the parent directory of the service directory.

Try it

First set the KAURI_HOME environment variable:

Linux
export KAURI_HOME=/home/me/kauri

Windows
set KAURI_HOME=c:\kauri

Then launch kauri using:

Linux
kauri-service console

Windows
kauri-service

The console argument for Linux will cause the wrapper to run in the current shell, displaying any output on your shell. This is convenient in case there would be start up problems. On Windows, it is automatically in console mode.

Troubleshooting

When the wrapper is not run in console mode, you can find its output in the file:

{packaged application directory}/logs/kauri-wrapper.log

Installing the service on Windows

On Windows, you can install and uninstall Kauri as a service using the scripts install-kauri-service and uninstall-kauri-service, which you also find in the service directory.

Customizing the wrapper configuration

You can modify the wrapper configuration through the service-wrapper.conf file. This can be useful to change things like memory settings.

Most of the config is imported from a common configuration file that is part of the binary Kauri distribution. It is strongly recommended not to modify that common file, but instead make changes in the service-wrapper.conf file.

Comments (0)