Hudson

From KevinWiki

Revision as of 14:41, 6 May 2009 by Kevin (Talk | contribs)
Jump to: navigation, search


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 hudson.war file as a web application to Tomcat server.

Use Subdomain to Access Hudson (with SSL)

  • Install and enable mod_jk.
  • Open the workers.properties file in the /etc/apache2 directory.
  • Add a new worker 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 JkMount 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 $CATALINA_HOME/conf/server.xml file to set up a new tomcat virtual host for the hudson.
  • Add the virtual host info inside the Engine element.
    <Engine name="Catalina" defaultHost="localhost">
      ... Default Host Info ...
 
      <Host name="hudson.yourdomain.com" appBase="webapps"
            unpackWARs="true" autoDeploy="true"
            xmlValidation="false" xmlNamespaceAware="false">
          <Context path="" docBase="hudson" debug="0" reloadable="true" />
      </Host>
    </Engine>
  • The docBase, 'hudson', must exist in the $CATALINA_HOME/webapps directory. (It should be there after normal deployment through Tomcat).
$CATALINA_HOME/webapps/application_path
  • Restart tomcat and apache.
$ /etc/init.d/tomcat stop 
$ /etc/init.d/tomcat start 
$ /etc/init.d/apache restart 


Configuration

  • To set the Tomcat to use UTF-8 to decode URLs, open $CATALINA_HOME/conf/server.xml file.
  • Add URIEncoding="UTF-8" to the following Connector element.
    <Connector port="8080" protocol="HTTP/1.1" 
               connectionTimeout="20000" 
               redirectPort="8443" />
  • So it should be like this
    <Connector port="8080" protocol="HTTP/1.1" 
               connectionTimeout="20000" 
               redirectPort="8443" 
               URIEncoding="UTF-8" />


  • If it uses mod_jk, add URIEncoding="UTF-8" to
    <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
  • So this should be
    <Connector port="8009" protocol="AJP/1.3" redirectPort="8443"
               URIEncoding="UTF-8" />
  • Restart the tomcat server.
  • JkOptions +ForwardURICompatUnparsed option needs to be added to the /etc/apache2/mods-enabled/jk.load 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.
Personal tools