Hudson

From KevinWiki

(Difference between revisions)
Jump to: navigation, search
(Redirected page to Jenkins)
 
(3 intermediate revisions not shown)
Line 1: Line 1:
-
[[Category:Continuous Integration]]
+
#Redirect [[Jenkins]]
-
 
+
-
Hudson is a continuous integration tool built using Java. It can work as a standalone server since it has the Winstone Servlet Container or it can work on various Servlet Containers or JEE servers such as [[Apache Tomcat]], Glassfish, JBoss, IBM WebSphere, Jetty 6, etc. Hudson supports Apache Ant and [[Maven]] as well as SCM tools such as CSV and [[Subversion]].
+
-
 
+
-
== Installation ==
+
-
* Download the latest hudson from the hudson web site.
+
-
* Deploy <code>hudson.war</code> file as a web application to Tomcat server.
+
-
 
+
-
== Use Subdomain to Access Hudson (with SSL) ==
+
-
* Install and enable [http://lckymn.com/wiki/Apache_Tomcat#Using_mod_jk mod_jk].
+
-
* Open the <code>workers.properties</code> file in the <code>/etc/apache2</code> directory.
+
-
* Add a new <code>worker</code> for hudson.
+
-
workers.tomcat_home=/opt/tomcat
+
-
workers.java_home=/usr/lib/jvm/java-6-sun
+
-
ps=/
+
-
worker.list=worker1,'''hudson'''
+
-
worker.worker1.port=8009
+
-
worker.worker1.host=localhost
+
-
worker.worker1.type=ajp13
+
-
worker.worker1.lbfactor=1
+
-
'''worker.hudson.port=8009'''
+
-
'''worker.hudson.host=hudson.yourdomain.com'''
+
-
'''worker.hudson.type=ajp13'''
+
-
'''worker.hudson.lbfactor=1'''
+
-
 
+
-
* Set up <code>JkMount</code> in the apache virtual host configuration.
+
-
<VirtualHost *:443>
+
-
    ServerAdmin master@yourdomain.com
+
-
+
-
        SSLEngine on
+
-
+
-
        SSLOptions +StrictRequire
+
-
+
-
        SSLCertificateFile /etc/ssl/certs/server.crt
+
-
        SSLCertificateKeyFile /etc/ssl/private/server.key
+
-
+
-
    ServerName hudson.yourdomain.com
+
-
+
-
    JkMount / hudson
+
-
    JkMount /* hudson
+
-
+
-
</VirtualHost>
+
-
 
+
-
* Open the <code>$CATALINA_HOME/conf/server.xml</code> file to set up a new tomcat virtual host for the hudson.
+
-
* Add the virtual host info inside the <code>Engine</code> element.
+
-
<source lang="xml">
+
-
    <Engine name="Catalina" defaultHost="localhost">
+
-
      ... Default Host Info ...
+
-
 
+
-
      <Host name="hudson.yourdomain.com" appBase="/opt/hudson_home/webapps"
+
-
            unpackWARs="true" autoDeploy="true"
+
-
            xmlValidation="false" xmlNamespaceAware="false">
+
-
      </Host>
+
-
    </Engine>
+
-
</source>
+
-
 
+
-
* If the virtual host is for Hudson only (e.g. http://hudson.yourdomain.com),
+
-
# Remove all the files and directories in the <code>appBase</code> directory which is, in the example above, <code>/opt/hudson_home/webapps</code>.
+
-
# Copy <code>hudson.war</code> file to the <code>appBase</code> directory and change <code>hudson.war</code> to <code>ROOT.war</code>.
+
-
 
+
-
* Restart tomcat and apache.
+
-
$ /etc/init.d/tomcat stop
+
-
$ /etc/init.d/tomcat start
+
-
$ /etc/init.d/apache restart
+
-
 
+
-
* access https://hudson.yourdomain.com.
+
-
 
+
-
=== Known Problem ===
+
-
* This problem will not happen if the instructions above are used to install Hudson.
+
-
 
+
-
* If Hudson complains about two hudson instances using the same HUDSON_HOME with the following error message, stop the tomcat server and check $CATALINA_HOME/work directory and removes duplicate ones if found.
+
-
<pre>
+
-
Hudson detected that you appear to be running more than one instance of Hudson that share the same home directory
+
-
...
+
-
This greatly confuses Hudson and you will likely experience strange behaviors, so please correct the situation.
+
-
</pre>
+
-
* Check <code>server.xml</code>.
+
-
* If the virtual host is only for Hudson and <code>server.xml</code> has the virtual host setup like below with <code>hudson.war</code> placed in the <code>webapps</code> directory, Tomcat server will create two instances (<code>hudson</code> and <code>ROOT</code>) of Hudson when it starts.
+
-
<source lang="xml">
+
-
    <Engine name="Catalina" defaultHost="localhost">
+
-
      ... Default Host Info ...
+
-
 
+
-
      <Host name="hudson.yourdomain.com" appBase="/opt/hudson_home/webapps"
+
-
            unpackWARs="true" autoDeploy="true"
+
-
            xmlValidation="false" xmlNamespaceAware="false">
+
-
          <!-- WARNING: This is WRONG!!! -->
+
-
          <Context path="" docBase="hudson" debug="0" reloadable="true" />
+
-
      </Host>
+
-
    </Engine>
+
-
</source>
+
-
* To solve this problem, as mentioned already (Read the instructions to <code>Use Subdomain to Access Hudson (with SSL)</code>),
+
-
# Remove all the files and directories in the <code>appBase</code> directory which is, in the example above, <code>/opt/hudson_home/webapps</code>.
+
-
# Copy <code>hudson.war</code> file to the <code>appBase</code> directory and change <code>hudson.war</code> to <code>ROOT.war</code>.
+
-
# Remove <code>Context</code> element in the <code>server.xml</code> file.
+
-
 
+
-
 
+
-
== Configuration ==
+
-
* To set the Tomcat to use UTF-8 to decode URLs, open <code>$CATALINA_HOME/conf/server.xml</code> file.
+
-
* Add <code>URIEncoding="UTF-8"</code> to the following Connector element.
+
-
<source lang="xml">
+
-
    <Connector port="8080" protocol="HTTP/1.1"
+
-
              connectionTimeout="20000"
+
-
              redirectPort="8443" />
+
-
</source>
+
-
* So it should be like this
+
-
<source lang="xml">
+
-
    <Connector port="8080" protocol="HTTP/1.1"
+
-
              connectionTimeout="20000"
+
-
              redirectPort="8443"
+
-
              URIEncoding="UTF-8" />
+
-
</source>
+
-
 
+
-
 
+
-
* If it uses <code>mod_jk</code>, add <code>URIEncoding="UTF-8"</code> to
+
-
<source lang="xml">
+
-
    <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
+
-
</source>
+
-
* So this should be
+
-
<source lang="xml">
+
-
    <Connector port="8009" protocol="AJP/1.3" redirectPort="8443"
+
-
              URIEncoding="UTF-8" />
+
-
</source>
+
-
* Restart the tomcat server.
+
-
* <code>JkOptions +ForwardURICompatUnparsed</code> option needs to be added to the <code>/etc/apache2/mods-enabled/jk.load</code> file or in the virtual host setup.
+
-
<VirtualHost *:443>
+
-
    ServerAdmin master@yourdomain.com
+
-
+
-
        SSLEngine on
+
-
+
-
        SSLOptions +StrictRequire
+
-
+
-
        SSLCertificateFile /etc/ssl/certs/server.crt
+
-
        SSLCertificateKeyFile /etc/ssl/private/server.key
+
-
+
-
    ServerName hudson.yourdomain.com
+
-
+
-
    '''JkOptions +ForwardURICompatUnparsed'''
+
-
+
-
    JkMount / hudson
+
-
    JkMount /* hudson
+
-
+
-
</VirtualHost>
+
-
 
+
-
* Restart the apache server.
+

Latest revision as of 11:33, 10 August 2012

  1. Redirect Jenkins
Personal tools