Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "Using Hudson/Starting and Accessing Hudson"

 
(34 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 +
{{hudson|pageTitle=Starting and Accessing Hudson}}
 +
 +
<br> <br>
 +
 +
 +
__TOC__
 +
 
== Starting Hudson  ==
 
== Starting Hudson  ==
  
The easiest way to execute Hudson is through the built in Winstone servlet container. You can execute Hudson like this:  
+
The easiest way to execute Hudson is through the built in Jetty servlet container. You can execute Hudson like this:  
 
<pre>$ java -jar hudson.war
 
<pre>$ java -jar hudson.war
 
</pre>  
 
</pre>  
 
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:  
 
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:  
 
<pre>$ nohup java -jar hudson.war &gt; $LOGFILE 2&gt;&amp;1
 
<pre>$ nohup java -jar hudson.war &gt; $LOGFILE 2&gt;&amp;1
</pre>  
+
</pre>
 +
You can also use the --logfile command line option.
 +
 
 
== Accessing Hudson  ==
 
== Accessing Hudson  ==
  
To see Hudson, simply bring up a web browser and go to URL http://myServer:8080 where myServer is the name of the system running Hudson.  
+
To see Hudson, simply bring up a web browser and go to URL http://myServer:8080 where myServer is the name of the system running Hudson.
  
Top of page
+
== Environment Variables ==
 +
 
 +
Hudson recognizes environment variables that tell where to write Hudson metadata, workspaces and builds.
 +
 
 +
{| width="800" cellspacing="1" cellpadding="1" border="1"
 +
|-
 +
| Environment Variable
 +
| Description
 +
|-
 +
| HUDSON_HOME=<i>dir<nowiki>&#x2011;</nowiki>path</i>
 +
| The root location for Hudson data.
 +
|-
 +
| HUDSON_WORKSPACES=<i>dir<nowiki>&#x2011;</nowiki>path</i>
 +
| The root location for storing individual workspaces. If not specified, the location is $HUDSON_HOME/jobs. Each job's workspace is at $HUDSON_WORKSPACES/<i>project<nowiki>&#x2011;</nowiki>name</i>/workspace.
 +
|-
 +
| HUDSON_BUILDS=<i>dir-path</i>
 +
| The root location for storing build data. If not specified, the location is $HUDSON_HOME/jobs. Each job's builds is at $HUDSON_BUILDS/<i>project<nowiki>&#x2011;</nowiki>name</i>/builds.
 +
|-
 +
| hudson.lifecycle=<i>class-name</i>
 +
| Use the fully qualified <i>class-name</i> to select a Lifecycle extension (from a plugin). Lifecycle extensions control how Hudson <code>restart</code> and <code>soft-restart</code> CLI methods work.
 +
|}
 +
<br>
  
 
== Command Line Parameters  ==
 
== 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:  
+
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=<i>port</i> where <i>port</i> is the port you want Hudson to run on. Other command line parameters include:  
  
<br>Command Line Parameter Description  
+
{| width="800" cellspacing="1" cellpadding="1" border="1"
 +
|-
 +
| Command Line Parameter  
 +
| Description
 +
|-
 +
| --version
 +
| Show Hudson version and quit
 +
|-
 +
| --httpPort=<i>port</i>
 +
| Runs Hudson listener on <i>port</i> using standard HTTP protocol. The default is port 8080. To disable (because you're using HTTPS), use port -1.
 +
|-
 +
| --httpListenAddress=<i>http-host</i>
 +
| Binds Hudson to the IP address represented by <i>http-host</i>. The default is 0.0.0.0 — i.e. listening on all available interfaces.
 +
|-
 +
| --httpsPort=<i>port</i>
 +
| Uses HTTPS protocol on <i>port</i>
 +
|-
 +
| --httpsListenAddress=<i>https-host</i>
 +
| Binds Hudson to listen for HTTPS requests on the IP address represented by <i>https-host</i>.
 +
|-
 +
| --httpsKeyStore=<i>file-path</i>
 +
| Location of the SSL KeyStore file.
 +
|-
 +
| --httpsKeyStorePassword=<i>value</i>
 +
| Password for the SSL KeyStore file.
 +
|-
 +
| --logfile=<i>file-path</i>
 +
| Send the output log to this file
 +
|-
 +
| --prefix=<i>prefix</i>
 +
| Add this <i>prefix</i> to all URLs (e.g., http://localhost:8080/<i>prefix</i>/resource)
 +
|-
 +
| --updateServer=<i>URL</i>
 +
| Specify your own update server (e.g., http://updates.mycompany.com).
 +
|-
 +
| --disableUpdateCenterSwitch
 +
| Disable the ability to specify alternate Update Center via Plugin Manager Advanced tab.
 +
|-
 +
| --skipInitSetup
 +
| Skip the initial setup screen and start Hudson directly.
 +
|-
 +
| <nowiki>&#x2011;&#x2011;</nowiki>argumentsRealm.passwd.<i>user</i>=<i>password</i>
 +
| Sets the password for <i>user</i> to <i>password</i>. 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 <i>user</i> has an admin role. (See next argument below).
 +
|-
 +
| <nowiki>&#x2011;&#x2011;</nowiki>argumentsRealm.roles.<i>user</i>=admin
 +
| Sets that <i>user</i> is an administrative user and can configure Hudson if Hudson's security is turned on. See Securing Hudson for more information.
 +
|}
  
<br>--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.<br>--httpListenAddress=$HTTP_HOST Binds Hudson to the IP address represented by $HTTP_HOST. The default is 0.0.0.0 — i.e. listening on all available interfaces.<br>--httpsPort=$HTTP_PORT Uses HTTPS protocol on port $HTTP_PORT<br>--httpsListenAddress=$HTTPS_HOST Binds Hudson to listen for HTTPS requests on the IP address represented by $HTTPS_HOST.<br>--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).<br>--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.  
+
<br> Hudson passes all command line parameters to the Jetty servlet container. You can get more information at the [http://www.eclipse.org/jetty/documentation/current/quick-start-configure.html#quickstart-config-how Jetty Quickstart Configuration page]
  
 +
{{Note|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 --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<br>{note:title=Be Careful with Command Line Parameters}
+
== A very simple init script ==
  
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.<br>{note}<br>A very simple init script<br>{info}
+
The following script is for Ubuntu based systems. For a good startup/shutdown script for Red Hat based systems, see http://www.wakaleo.com/component/content/article  
 
+
The following script is for Ubuntu based systems. For a good startup/shutdown script for Red Hat based systems, see http://www.wakaleo.com/component/content/article/206<br>{info}
+
 
<pre>#!/bin/sh
 
<pre>#!/bin/sh
 
</pre> <pre>DESC="Hudson CI Server"
 
</pre> <pre>DESC="Hudson CI Server"
 
 
NAME=hudson
 
NAME=hudson
 
PIDFILE=/var/run/$NAME.pid
 
PIDFILE=/var/run/$NAME.pid
 
RUN_AS=hudson
 
RUN_AS=hudson
 
COMMAND=java -jar /home/hudson/hudson.war
 
COMMAND=java -jar /home/hudson/hudson.war
 
 
 
</pre><pre>d_start() {
 
</pre><pre>d_start() {
 
+
start-stop-daemon --start --quiet --background --make-pidfile --pidfile $PIDFILE --chuid $RUN_AS --exec $COMMAND
start-stop-daemon --start --quiet --background --make-pidfile --pidfile $PIDFILE --chuid $RUN_AS --exec $COMMAND
+
 
+
 
+
 
}
 
}
 
 
 
</pre><pre>d_stop() {
 
</pre><pre>d_stop() {
 
+
start-stop-daemon --stop --quiet --pidfile $PIDFILE
start-stop-daemon --stop --quiet --pidfile $PIDFILE
+
if [ -e $PIDFILE ]
if [ -e $PIDFILE ]
+
then rm $PIDFILE
then rm $PIDFILE
+
fi
fi
+
 
+
 
+
 
}
 
}
 
 
 
</pre><pre>case $1 in
 
</pre><pre>case $1 in
 
+
start)
start)
+
echo -n "Starting $DESC: $NAME"
echo -n "Starting $DESC: $NAME"
+
d_start
d_start
+
echo "."
echo "."
+
;;
 
+
stop)
 
+
echo -n "Stopping $DESC: $NAME"
&nbsp;;;
+
d_stop
 
+
echo "."
 
+
;;
 
+
restart)
stop)
+
echo -n "Restarting $DESC: $NAME"
echo -n "Stopping $DESC: $NAME"
+
d_stop
d_stop
+
sleep 1
echo "."
+
d_start
 
+
echo "."
 
+
;;
&nbsp;;;
+
*)
 
+
echo "usage: $NAME {start|stop|restart}"
 
+
exit 1
 
+
;;
restart)
+
echo -n "Restarting $DESC: $NAME"
+
d_stop
+
sleep 1
+
d_start
+
echo "."
+
 
+
 
+
&nbsp;;;
+
 
+
 
+
 
+
*)
+
echo "usage: $NAME {start|stop|restart}"
+
exit 1
+
 
+
 
+
&nbsp;;;
+
 
esac
 
esac
 
 
 
</pre><pre>exit 0
 
</pre><pre>exit 0
</pre>  
+
</pre>
 
<br> In Ubuntu 9.04-Server this init-script doesn't work. You have to change the start line to  
 
<br> In Ubuntu 9.04-Server this init-script doesn't work. You have to change the start line to  
 
<pre>start-stop-daemon --start --quiet --background -m --pidfile $PIDFILE --chuid $RUN_AS --exec /usr/bin/java -- -jar /opt/hudson/hudson.war
 
<pre>start-stop-daemon --start --quiet --background -m --pidfile $PIDFILE --chuid $RUN_AS --exec /usr/bin/java -- -jar /opt/hudson/hudson.war
</pre>  
+
</pre>
 +
 
 
== Using HTTPS with an existing certificate  ==
 
== Using HTTPS with an existing certificate  ==
  
Line 114: Line 158:
 
Finally, add these parameters to your command (filling in or changing values as needed):  
 
Finally, add these parameters to your command (filling in or changing values as needed):  
 
<pre>--httpPort=-1 --httpsPort=443 --httpsKeyStore=/path/t/hudsonhome/winstone.ks --httpsKeyStorePassword=yourchosenpass
 
<pre>--httpPort=-1 --httpsPort=443 --httpsKeyStore=/path/t/hudsonhome/winstone.ks --httpsKeyStorePassword=yourchosenpass
</pre>  
+
</pre>
Top of page
+

Latest revision as of 13:34, 18 November 2013

Hudson Continuous Integration Server
Website
Download
Community
Mailing ListForumsIRCmattermost
Issues
OpenHelp WantedBug Day
Contribute
Browse Source
Hudson-bust.png Starting and Accessing Hudson














Starting Hudson

The easiest way to execute Hudson is through the built in Jetty servlet container. You can execute Hudson like this:

$ java -jar hudson.war

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:

$ nohup java -jar hudson.war > $LOGFILE 2>&1

You can also use the --logfile command line option.

Accessing Hudson

To see Hudson, simply bring up a web browser and go to URL http://myServer:8080 where myServer is the name of the system running Hudson.

Environment Variables

Hudson recognizes environment variables that tell where to write Hudson metadata, workspaces and builds.

Environment Variable Description
HUDSON_HOME=dir‑path The root location for Hudson data.
HUDSON_WORKSPACES=dir‑path The root location for storing individual workspaces. If not specified, the location is $HUDSON_HOME/jobs. Each job's workspace is at $HUDSON_WORKSPACES/project‑name/workspace.
HUDSON_BUILDS=dir-path The root location for storing build data. If not specified, the location is $HUDSON_HOME/jobs. Each job's builds is at $HUDSON_BUILDS/project‑name/builds.
hudson.lifecycle=class-name Use the fully qualified class-name to select a Lifecycle extension (from a plugin). Lifecycle extensions control how Hudson restart and soft-restart CLI methods work.


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=port where port is the port you want Hudson to run on. Other command line parameters include:

Command Line Parameter Description
--version Show Hudson version and quit
--httpPort=port Runs Hudson listener on port using standard HTTP protocol. The default is port 8080. To disable (because you're using HTTPS), use port -1.
--httpListenAddress=http-host Binds Hudson to the IP address represented by http-host. The default is 0.0.0.0 — i.e. listening on all available interfaces.
--httpsPort=port Uses HTTPS protocol on port
--httpsListenAddress=https-host Binds Hudson to listen for HTTPS requests on the IP address represented by https-host.
--httpsKeyStore=file-path Location of the SSL KeyStore file.
--httpsKeyStorePassword=value Password for the SSL KeyStore file.
--logfile=file-path Send the output log to this file
--prefix=prefix Add this prefix to all URLs (e.g., http://localhost:8080/prefix/resource)
--updateServer=URL Specify your own update server (e.g., http://updates.mycompany.com).
--disableUpdateCenterSwitch Disable the ability to specify alternate Update Center via Plugin Manager Advanced tab.
--skipInitSetup Skip the initial setup screen and start Hudson directly.
‑‑argumentsRealm.passwd.user=password Sets the password for user to password. 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.user=admin Sets that user is an administrative user and can configure Hudson if Hudson's security is turned on. See Securing Hudson for more information.


Hudson passes all command line parameters to the Jetty servlet container. You can get more information at the Jetty Quickstart Configuration page

Note.png
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 --argumentsRealm and not --argumentRealm.


A very simple init script

The following script is for Ubuntu based systems. For a good startup/shutdown script for Red Hat based systems, see http://www.wakaleo.com/component/content/article

#!/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


In Ubuntu 9.04-Server this init-script doesn't work. You have to change the start line to

start-stop-daemon --start --quiet --background -m --pidfile $PIDFILE --chuid $RUN_AS --exec /usr/bin/java -- -jar /opt/hudson/hudson.war

Using HTTPS with an existing certificate

If you're setting up Hudson using the built-in Winstone servlet and want to use an existing certificate for HTTPS you'll need to do some converting. First, convert your pem-formatted certificate and key files to a format that the Java keytool can use:

openssl pkcs12 -export -in /path/to/cert -inkey /path/to/key -name "Whatever you want" -out keystore.p12

Then use the Java keytool to create a new keystore with that file (keep track of the password you use for the store, you'll need it in the next step):

keytool -importkeystore -srckeystore keystore.p12 -srcstoretype pkcs12 -destkeystore /path/to/hudsonhome/winstone.ks -deststoretype JKS

Finally, add these parameters to your command (filling in or changing values as needed):

--httpPort=-1 --httpsPort=443 --httpsKeyStore=/path/t/hudsonhome/winstone.ks --httpsKeyStorePassword=yourchosenpass

Back to the top