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
- Download the latest Hudson.war file. IE users: Make sure that the file is downloaded as a .war file.
- Download the Hudson Windows Service package from this page. The package uses Wrapper 3.2.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
- Copy the
Hudson.war
to thelib
folder - 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
- Download the Hudson Agent package from this page. The package uses Wrapper 3.2.3, and Netx 0.5.0.
- 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.
- Show the Hudson main page
- Click on the agent link under the build queue
- Copy the Web start link from the agent page
- Update the
wrapper.app.parameter.7
with the link in theconf/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: