Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Info
titleTable of Contents
Table of Contents
outlinetrue
iconfalse
typeflat
separatornewline

Installation

Unix and Mac Installation

Hudson needs Java J2SE 1.5 or later to run. Hudson is released as a single WAR file. The easiest way to use Hudson is to use Hudson's built in Winstone servlet container. Download Hudson, and execute Hudson by running java -jar hudson.war. This is basically the same setup as the test drive except that Hudson log messages will be sent to the console window.

Alternatively, if you have a servlet container that supports Servlet 2.4/JSP 2.0 or later, such as Glassfish, Tomcat 5, JBoss, Jetty 6, etc. Then, you can deploy Hudson's WAR file as you would any other war file. Container specific documentation is available if you choose this route.

Top of page

Windows Installation

If you're running on Windows you might want to run Hudson as a service so it starts up automatically without requiring a user to log in. The easiest way is to install Tomcat as a service, and then deploy Hudson to it. Another way is to use the Java Service Wrapper which is described in the Installing Hudson as a Windows service section.

Top of page

Case Studies

Also, see how other people are deploying Hudson to get some idea of how to make it fit your environment.

Top of page

Execution

As mentioned above, the easiest way to execute Hudson is through the built in Winstone servlet container. You can execute Hudson like this:

Code Block
Wiki Markup
{anchor:top}
{info:title=Table of Contents}
{toc:type=flat|separator=newline|outline=true|icon=false}
{info}

h1. Installation


h2. Unix and Mac Installation

Hudson needs [Java J2SE 1.5 or later|http://java.sun.com/javase/downloads/index.jsp] to run. Hudson is released as a single WAR file. The easiest way to use Hudson is to use Hudson's built in [Winstone|http://winstone.sourceforge.net/] servlet container. [Download Hudson|https://hudson.dev.java.net/servlets/ProjectDocumentList?folderID=2761&expandFolder=2761&folderID=0], and execute Hudson by running {{{*}java \-jar hudson.war{*}}}. This is basically the same setup as the test drive except that Hudson log messages will be sent to the console window.

Alternatively, if you have a servlet container that supports Servlet 2.4/JSP 2.0 or later, such as Glassfish, Tomcat 5, JBoss, Jetty 6, etc. Then, you can deploy Hudson's WAR file as you would any other war file. [Container specific|Containers] documentation is available if you choose this route.

[_Top of page_|#top]

h2. Windows Installation

If you're running on Windows you might want to run Hudson as a service so it starts up automatically without requiring a user to log in. The easiest way is to install Tomcat as a service, and then deploy Hudson to it. Another way is to use the [Java Service Wrapper|http://wrapper.tanukisoftware.org/doc/english/introduction.html] which is described in the [Installing Hudson as a Windows service] section.

[_Top of page_|#top]

h1. Case Studies

Also, see how other people are deploying Hudson to get some idea of how to make it fit your environment.
* [Case study of Sven Reimers]
* [Case study of Kohsuke Kawaguchi]
* [Case study of Rhett Sutphin]
* [Case study of Ned Collyer]
* [Case Study Of Arnaud Lacour]
* [Case Study of JBoss|http://jboss-qa.blogspot.com/2007/10/taking-continuous-integration-to.html]
* we'd love to list yours here. Please talk to us.

[_Top of page_|#top]

h1. Execution

As mentioned above, the easiest way to execute Hudson is through the built in Winstone servlet container. You can execute Hudson like this:
{code}
$ java -jar hudson.war
{code}
Of course, you probably want to send the output of Hudson to a log file, and if you're on Unix, you probably want to use {{{*}nohup

...

Code Block
{*}}}:
{code}
$ nohup java -jar hudson.war > $LOGFILE 2>&1
{code}
To see Hudson, simply bring up a web browser and go to URL {{{*}http{*}{*}_:_{*}*//*\*{color:green}{*}myServer{*}{color}:8080{\*}}} where {color:green}myServer{color} is the name of the system running Hudson.

...



[_Top of

...

Command Line Parameters

Hudson normally starts up using port 8080, however, if you have other web services starting up, you might find that this port is already taken, you can specify a different port by using the --httpPort=$HTTP_PORT where $HTTP_PORT is the port you want Hudson to run on. Other command line parameters include:

...

Command Line Parameter

...

Description

 page_|#top]

h2. Command Line Parameters

Hudson normally starts up using port 8080, however, if you have other web services starting up, you might find that this port is already taken, you can specify a different port by using the {{\--httpPort={color:green}$HTTP_PORT{color}}} where {{{color:green}$HTTP_PORT{color}}} is the port you want Hudson to run on. Other command line parameters include:
|| Command Line Parameter || Description ||
| \--javaHome=$JAVA_HOME

...

 | This tells Hudson what $JAVA_HOME to use when executing builds that require Java or Ant. This is not the Java JRE that actually executes Hudson. Default is to use the same Java JRE that was used to execute Hudson.

...

 |
| \--httpPort=$HTTP_PORT

...

 | Runs Hudson listener on port $HTTP_PORT using standard _http_ protocol. The default is port 8080. To disable (because you're using _https_), use port {{\-1

...

}}. |
| \--httpsPort=$HTTP_PORT

...

 | Uses HTTPS protocol on port $HTTP_PORT

...

 |
| \--argumentsRealm.passwd.$ADMIN_USER

...

 | Sets the password for user $ADMIN_USER. If Hudson security is turned on, you must log in as the $ADMIN_USER in order to configure Hudson or a Hudson project. NOTE: You must also specify that this user has an _admin_ role. (See next argument below).

...

 |
| \--argumentsRealm.roles.$ADMIN_USER=admin

...

 | Sets that $ADMIN_USER is an administrative user and can configure Hudson if Hudson's security is turned on. See [Securing Hudson] for more information.

...

 |
| \--webroot=~/.hudson/war

...

 | Tells Hudson where to expand the war file for the bundled servlet container to use.

...

  The default is \~/.hudson/war

...

Hudson passes all command line parameters to the Winstone servlet container, so you can get more information by looking at the Winstone Command Line Parameter Reference

Note
titleBe Careful with Command Line Parameters

Hudson ignores command line parameters it doesn't understand instead of producing an error. Be careful when using command line parameters and make sure you have the correct spelling. For example, the parameter needed for defining the Hudson administrative user is --argumentsRealm and not --argumentRealm.

...

 . \\ |
Hudson passes all command line parameters to the Winstone servlet container, so you can get more information by looking at the [Winstone Command Line Parameter Reference|http://winstone.sourceforge.net/#commandLine]
{note:title=Be Careful with Command Line Parameters}
Hudson ignores command line parameters it doesn't understand instead of producing an error. Be careful when using command line parameters and make sure you have the correct spelling. For example, the parameter needed for defining the Hudson administrative user is {{*\--argument{*}{*}{+}s{+}{*}{*}Realm{*}}} and not {{*\--argumentRealm{*}}}.
{note}

h1. A very simple init script
{code}
#!/bin/sh

DESC="Hudson CI Server"
NAME=hudson
PIDFILE=/var/run/$NAME.pid
RUN_AS=hudson
COMMAND=java -jar /home/hudson/hudson.war

d_start() {
	start-stop-daemon --start --quiet --background --make-pidfile --pidfile $PIDFILE --chuid $RUN_AS --exec $COMMAND
}

d_stop() {
	start-stop-daemon --stop --quiet --pidfile $PIDFILE
	if [ -e $PIDFILE ]
		then rm $PIDFILE
	fi
}

case $1 in
	start)
	echo -n "Starting $DESC: $NAME"
	d_start
	echo "."
	;;
	stop)
	echo -n "Stopping $DESC: $NAME"
	d_stop
	echo "."
	;;
	restart)
	echo -n "Restarting $DESC: $NAME"
	d_stop
	sleep 1
	d_start
	echo "."
	;;
	*)
	echo "usage: $NAME {start|stop|restart}"
	exit 1
	;;
esac

exit 0
{code}

[_Top of page_|#top]