Skip to end of metadata
Go to start of metadata

Note that there is no requirement that the Hudson master server is running as a Windows service in order to run agents as a Windows service. For more information on how to set up just an agent go to #Hudson agent service

Hudson master server

Running Hudson master server as a windows service can be done in several ways, either through the servlet containers or using the Winstone container. This section describes how to run Hudson master server using the Winstone container.

To run the Hudson master server as a windows service using Winstone the Java Service Wrapper can be used to integrate Hudson as a Windows service. The below parts will get you up and running with Hudson as a Windows service but for more information please see the JSW site.

Installation

  1. Download the latest Hudson.war file. IE users: Make sure that the file is downloaded as a .war file.
  2. Download the Hudson Windows Service package from this page. The package uses Wrapper 3.2.3
  3. Unzip the Hudson package into an empty folder. You should now have the following layout:
    Hudson
     +- bin
     |   +- Hudson.bat
     |   +- InstallHudson.bat
     |   +- UninstallHudson.bat
     |   +- wrapper.exe
     +- conf
     |   +- wrapper.conf
     +- lib
     |   +- wrapper.jar
     |   +- wrapper.dll
    
  4. Copy the Hudson.war to the lib folder
  5. Now the file layout is setup so Hudson can be installed as a service.

Configuration

The JSW reads from the conf/wrapper.conf and is ready to be used. The default home path for Hudson is data, and if you want to change that you need to edit the configuration.

If you don't have a java.exe on your PATH, change the wrapper.java.command in conf/wrapper.conf from just "java" to e.g. wrapper.java.command=C:/jdk1.6.0_03/bin/java.

Below is a condensed version of the configuration file for the Hudson options, the conf/wrapper.conf will also contain options for the Wrapper library.

# Change below line to change the Hudson home path
wrapper.java.additional.1=-DHUDSON_HOME=../data

Service handling

  • To install the service run bin/InstallHudson.bat
  • To uninstall the service run bin/UninstallHudson.bat
  • To start the service run net start hudson
  • To stop the service run net stop hudson

Frequently asked questions

Troubleshooting / Logs

If the service doesn't start, have a look at the wrapper.log which will be created in the bin directory when the service attempts to start.

I want to run on a different port than default 8080.

Open up the conf/wrapper.conf and add the following line.

wrapper.app.parameter.2=--httpPort=8090

When I try to run the application I get wrapper | OpenSCManager failed - Access denied?

This is because you don't have the necessary permissions, please ask an administrator to install the service.

How can I run the service as a specified user?

Open up the conf/wrapper.conf and change the following properties

wrapper.ntservice.account = accountname
wrapper.ntservice.password = password

Why doesnt the Hudson server start in Windows 64bit?

Unfortunately the JSW does not support 64 bits Windows (as of now, 4th november 2007). You can install a 32bits version of Java and specify the Java in the conf/wrapper.conf.

wrapper.java.command=c:\program files(x86)\java\bin\java.exe

Hudson agent service

To install the Hudson agents as a windows service the Java Service Wrapper can be used for integrating with Windows and Netx for starting the agent using the Hudson JNLP application. It is almost as simple installing the Hudson master server, but there is one extra configuration step for each agent machine.

Installation

  1. Download the Hudson Agent package from this page. The package uses Wrapper 3.2.3, and Netx 0.5.0.
  2. Unzip the Hudson package into an empty folder. You should now have the following layout:
    Hudson
     +- bin
     |   +- HudsonAgent.bat
     |   +- InstallHudsonAgent.bat
     |   +- UninstallHudsonAgent.bat
     |   +- wrapper.exe
     +- cache (Web start cache needed by Netx)
     +- conf
     |   +- wrapper.conf
     +- lib
     |   +- wrapper.jar
     |   +- wrapper.dll
     |   +- netx-no-debug.jar
    

Configuration

The JSW reads from the conf/wrapper.conf which must be updated before service is started. When installing the above packages on each agent, you must specify the JNLP file that should be started in the service. The JNLP file is unique for each agent, and the link can be found in the agent machine page.

  1. Show the Hudson main page
  2. Click on the agent link under the build queue
  3. Copy the Web start link from the agent page
  4. Update the wrapper.app.parameter.7 with the link in the conf/wrapper.conf.

Below is a condensed version of the configuration file for the Hudson options, the conf/wrapper.conf will also contain options for the Wrapper library.

# Application parameters.  Add parameters as needed starting from 1
wrapper.app.parameter.1=netx.jnlp.runtime.Boot
wrapper.app.parameter.2=-headless
wrapper.app.parameter.3=-basedir
wrapper.app.parameter.4=../cache
wrapper.app.parameter.5=-nosecurity
wrapper.app.parameter.6=-jnlp
wrapper.app.parameter.7=http://akira:8090/computer/WS-1/slave-agent.jnlp

Service handling

  • To install the service run bin/InstallHudsonAgent.bat
  • To uninstall the service run bin/UninstallHudsonAgent.bat
  • To start the service run net start hudson-agent
  • To start the service run net stop hudson-agent

Frequently asked questions

The master server has been updated, how do I update all agents?

Stopping and starting the services will initiate a download of the new JNLP agent application.

Other Service Options

FireDaemon Lite V1.6

Summary:

Allows managing/creating/deleting all Windows services and using any application as a service, free of charge

http://www.google.com/search?hl=en&q=FireDaemon-Lite-1_6-GA.exe&btnG=Google+Search

Pros:

  • GUI
  • Optionally restarts application after crashing
  • Vast advanced options, like where to send stdout, logging, debugging of starting the service, etc.
  • Free of charge

Cons:

  • Didn't manage to set credentials for the service, used Windows services panel for that
  • Didn't see mechanism to run service shutdown program/script for graceful shutdown
  • Unsupported by vendor

ServiceAllSvc

Summary:

Installs/removes any program as a service, free of charge

http://home.arcor.de/blackwell/current.html

Pros:

  • Supports service stop script/program
  • Free of charge
  • Open source

Cons:

  • Written in Delphi (4)
  • Unsupported by vendor

 Example:

cd c:\hudson
copy c:\ServiceAllSvc\ServiceAllSvc.exe MyHudsonService.exe
MyHudsonService.exe -install "Hudson Build System" "cmd.exe /c c:\hudson\start.cmd" "cmd.exe /c c:\hudson\stop.cmd"

sc.exe (included in Windows XP)

Summary:

Installs/removes/manages services, runs any program as a service

Pros:

  • Built-in to Windows XP
  • Allows configuring various service options

Cons:

  • Perhaps not as easy to use as it could be

Example:

http://makemsi-manual.dennisbareis.com/cmdasuser_exe.htm 

  • No labels

1 Comment

  1. (copying the comment from the original page)
    For changing the service to run as a specified user, we can also change it from the Window Service -> hudson -> Properties -> Log On.  That way, you don't have to put the password in the wrapper.conf file. (wink)