Skip to main content
Version: Early Access

Install a worker as a service

You can configure a Deploy worker to run as a daemon (Unix) or service (Windows) so that it can run as a background process without requiring user control or intervention.

Running a worker as a daemon or service applies only to local and external workers, and not to the default in-process worker. See High availability with master-worker setup for details on worker types.

Customizing worker and service

To customize a worker before starting please follow the steps mentioned below.

Add the following properties for a worker in the xl-worker.conf file in the conf folder.

note

Setting the values for these fields is optional, if you do not specify a value, the service will start using the default values for the properties.

  • deploy.server.hostname - the hostname on which worker will be run, the default value is localhost
  • deploy.server.port - port on which worker will start . The default port is 8180
  • deploy.server.ssl.enabled - if set to true [Artery tls-tcp] will be used, else the default value [Artery tcp] will be used in deployit.log
  • deploy.worker.name - worker name (its an optional field)

The logs for a worker running as service can be found in the wrapper.log in the log folder.

important

If you want to configure multiple workers as services, they need to be started as external workers with a separate folder for each worker.

See External worker setup for more information on setting up multiple workers as service.

For configuring multiple workers, you must also update the following attributes in the xld-wrapper-worker.conf under the conf folder with a unique worker service name.

wrapper.console.title=Deploy Worker
wrapper.ntservice.name=xl-deploy-worker
wrapper.ntservice.displayname=Deploy Worker

For example:

wrapper.console.title=Deploy Worker-2
wrapper.ntservice.name=xl-deploy-worker-2
wrapper.ntservice.displayname=Deploy Worker-2

Configure Deploy as a daemon on Unix

To install a Deploy worker to run as a daemon:

  1. Ensure that the worker is configured so that it can start without input from the user; for example, if a repository keystore password is required, then it should be provided in XL_DEPLOY_SERVER_HOME/centralConfiguration/deploy-server.yaml.
  2. Ensure that the JAVA_HOME environment variable is set correctly for the user or daemon that will be used to run the Deploy service. You can explicitly set the location of the Java executable by updating the XL_DEPLOY_WORKER_HOME/bin/.wrapper-env.sh script.
  3. As root, execute XL_DEPLOY_WORKER_HOME/bin/install-service.sh worker.
  4. You are prompted for:
    • Connection details for the Deploy master (HOST:PORT)
    • The URL for the Deploy REST API

This command will install and start the daemon.

Example: The service command below provides an example of running workers as a service with multiple master switches on Unix:

./install-service.sh worker -api http://loadbalancer:8080 -master http://master_url1:8180 -master http://master_url2:8180 -master http://master_url3:8180

See High availability with master-worker setup for understanding how -api and -master switches work.

Configure Deploy as a service on Microsoft Windows

To configure Deploy worker to run as a service:

  1. Ensure that the worker is configured so that it can start without input from the user; for example, if a repository keystore password is required, then it should be provided in XL_DEPLOY_SERVER_HOME\CentralConfiguration\deploy-server.yaml.
  2. Ensure that the JAVA_HOME environment variable is set correctly for the user or service that will be used to run the Deploy service and include the location of Java/bin in the Windows Path environment variable.

To set the location of the Java executable, run the following command:

XL_DEPLOY_WORKER_HOME/bin/.wrapper-env.cmd.

  1. As an administrator, run the following command:

XL_DEPLOY_WORKER_HOME\bin\install-service.cmd worker.

You will be prompted to enter the following details:

  • Connection details for the Deploy master (HOST:PORT)
  • The URL for the Deploy REST API

This command will install and start the service.

Example: The service command below provides an example of running workers as a service with multiple master switches on Windows:

./install-service.cmd -api http://loadbalancer:8080 -master http://master_url1:8180 -master http://master_url2:8180 -master http://master_url3:8180

See running workers with multiple masters switches for understanding how -api and -master switches work.

Uninstall the Deploy daemon or service

To remove the installed daemon or service from the system, run the appropriate command:

Operating systemCommand
Microsoft WindowsXL_DEPLOY_WORKER_HOME\bin\uninstall-service.cmd
Unix-based systemsXL_DEPLOY_WORKER_HOME/bin/uninstall-service.sh

Troubleshooting

Worker fails to connect to the Master

The Worker fails to connect to the Master when deploy.server.ssl.enabled is set to true. To resolve this issue, configure the following command line argument for a worker startup:

 -keyPassword KEY_PASSWORD                : Password for the key (default: changeme)
-keyStore KEY_STORE_PATH : Path to the key store (default: keystore)
-keyStorePassword KEY_STORE_PASSWORD : Password for the key store (default: changeme)
-trustStore TRUST_STORE_PATH : Path to a trust store (default: truststore)
-trustStorePassword TRUST_STORE_PASSWORD : Password for a trust store (default: changeme)