Version 51.1 by Ramsey Gurley on 2011/04/24 16:34

Hide last authors
Ramsey Gurley 50.1 1 [[Hudson>>http://hudson-ci.org/]] is an "extensible continuous integration server". It monitors repeated executions of jobs, such as building software projects, and can be used to build WebObjects applications and frameworks. Hudson is an open source project, and can be used at no cost. An introductory presentation on building WebObjects projects with Hudson was given by Mike Schrag at WOWODC-West in 2009, and the video can be [[purchased from wocommunity.org>>http://www.wocommunity.org/apps/WebObjects/WOCommunity.woa/wa/recordings]].
Pascal Robert 37.1 2
Ramsey Gurley 50.1 3 == Setting up Hudson ==
Pascal Robert 37.1 4
Ramsey Gurley 50.1 5 There are a couple different ways to run Hudson. The easiest is to run it as a standalone application.
Pascal Robert 37.1 6
Ramsey Gurley 50.1 7 === Standalone Installation ===
Pascal Robert 37.1 8
Ramsey Gurley 50.1 9 {{info}}
10 These instructions are based on David Avendasora's setup. You may have different preferences as to where to install Hudson at or where to set its home directory to.
11 {{/info}}
Pascal Robert 37.1 12
Ramsey Gurley 50.1 13 1. Create a ##/Developer/Hudson/Home## directory.
14 1. [[Download Hudson>>http://hudson-ci.org/latest/hudson.war]], saving ##hudson.war## file to ##/Developer/Hudson##.
15 1. Launch Hudson with the following command in Terminal.app:
Pascal Robert 37.1 16
Ramsey Gurley 50.1 17 {{code}}
Pascal Robert 37.1 18
Ramsey Gurley 50.1 19 java -DHUDSON_HOME=/Developer/Hudson/Home -jar /Developer/Hudson/hudson.war
Pascal Robert 37.1 20
Ramsey Gurley 50.1 21 {{/code}}
Pascal Robert 46.1 22
Ramsey Gurley 50.1 23 {{info}}
Pascal Robert 46.1 24
Ramsey Gurley 50.1 25 Hudson uses a built-in servlet container in stand-alone mode. If you have Tomcat running on the computer already, you should use the {{\-}}{{{}{-}httpPort{-}}} and {{\-ajp13Port}} options to change which ports Hudson uses.
26 {code}
27 java -DHUDSON_HOME=/Developer/Hudson/Home -jar /Developer/Hudson/hudson.war -httpPort=9080 --ajp13Port=9009
28 {code}
Pascal Robert 49.1 29
Ramsey Gurley 50.1 30 {{/info}}
Pascal Robert 49.1 31
Ramsey Gurley 50.1 32 1. Point your browser to: [[http://localhost:8080/]] 
33 1. Start setting up jobs
Pascal Robert 37.1 34
Ramsey Gurley 50.1 35 === Standalone Jenkins w/SSL ===
Pascal Robert 37.1 36
Ramsey Gurley 50.1 37 Setting up SSL for Jenkins is surprisingly easy. I found basic instructions here at [[SSL Setup Options>>http://jenkins.361315.n4.nabble.com/SSL-Setup-Options-td954261.html]]. I'll repeat them here for posterity.
38
Pascal Robert 37.1 39 1. Create a selfsigned test SSL certificate. 
40 keytool genkey keyalg RSA alias selfsigned keystore keystore.jks -storepass ToPSecRet321 dname "cn=localhost"
Ramsey Gurley 50.1 41 1. Launch Hudson. 
Pascal Robert 37.1 42
43 {{noformat}}
Ramsey Gurley 50.1 44 java -jar hudson.war --httpPort=-1 --httpsPort=8080 --httpsKeyStore=keystore.jks --httpsKeyStorePassword=ToPSecRet321
Pascal Robert 37.1 45 {{/noformat}}
46
47 1. Launch browser 
48 Open "https:~/~/localhost:8080" in browser. You might get a browser warning, because the certificate is not signed by a known certificate authority. Communication is SSL-encrypted nevertheless.
49
Ramsey Gurley 50.1 50 Those with sharp eyes will notice the port has changed from the original instructions. That was required on Mac OS X because of permissions. Also, it's worth noting that the keytool asks for a second password for the private key of the ssl certificate. I used the same password as the keystore password and everything works. I'm not sure if that makes a difference.
Pascal Robert 37.1 51
Ramsey Gurley 50.1 52 === Standalone Jenkins and launchd on Mac OS X ===
53
54 In my case I created the jenkins user and JENKINS//HOME using dscl. ([[Using dscl to Create New Users and Groups>>http://mblog.lib.umich.edu/sites/archives/2008/04/using_dscl_to_c.html]]) To make jenkins launch when the machine boots up and relaunch if it dies, I created a launch daemon. Doing that requires a plist in the correct folder. Then either reboot, or launch the daemon with launchctl on the command line.//
55
56 Make sure your permissions and user:group are set correctly on the plist {{noformat}}-rw---r--r root:wheel{{/noformat}} In /Library/LaunchDaemons/org.jenkins-ci.jenkins.plist I placed:
57
58 {{code value="xml"}}
59
60 <?xml version="1.0" encoding="UTF-8"?>
61 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
62 <plist version="1.0">
63 <dict>
64 <key>UserName</key>
65 <string>jenkins</string>
66 <key>Label</key>
67 <string>org.jenkins-ci.jenkins</string>
68 <key>EnvironmentVariables</key>
69 <dict>
70 <key>JENKINS_HOME</key>
71 <string>/usr/local/jenkins/.jenkins</string>
72 </dict>
73 <key>ProgramArguments</key>
74 <array>
75 <string>/usr/bin/java</string>
76 <string>-jar</string>
77 <string>/usr/local/jenkins/jenkins.war</string>
78 <string>--httpPort=-1</string>
79 <string>--httpsPort=8080</string>
80 <string>--httpsKeyStore=/usr/local/jenkins/keystore.jks</string>
81 <string>--httpsKeyStorePassword=Jenkins123</string>
82 </array>
83 <key>StandardOutPath</key>
84 <string>/usr/local/jenkins/.jenkins/log/out.txt</string>
85 <key>StandardErrorPath</key>
86 <string>/usr/local/jenkins/.jenkins/log/err.txt</string>
87 <key>Disabled</key>
88 <false/>
89 <key>KeepAlive</key>
90 <true/>
91 <key>RunAtLoad</key>
92 <true/>
93 </dict>
94 </plist>
95
96 {{/code}}
97
Pascal Robert 37.1 98 === Servlet Container Installation on Mac OS X (10.5, 10.6) ===
99
100 1. Install Tomcat from [[http://www.macports.org]] with the command
101
102 {{noformat}}
103
104 sudo /opt/local/bin/port install tomcat6
105
106 {{/noformat}}
107
108 1. Create an administrative user in ##/opt/local/share/java/tomcat6/conf/tomcat-users.xml##.
109
110 {{code value="xml"}}
111
112 <?xml version='1.0' encoding='utf-8'?>
113 <tomcat-users>
114 <role rolename="manager"/>
115 <role rolename="admin"/>
116 <user username="tomcat" password="tomcat" roles="admin,manager"/>
117 </tomcat-users>
118
119 {{/code}}
120
121 {{panel bgColor="#F7D6C1"}}
122
123 Don't forget to change the username and password after you have finished checking out the build server and start using it in production.
124
125 {{/panel}}
126
127 1. Start Tomcat.
128
129 {{noformat}}
130
131 sudo launchctl load -w /Library/LaunchDaemons/org.macports.tomcat6.plist
132
133 {{/noformat}}
134
Ramsey Gurley 50.1 135 1. [[Download Hudson>>http://hudson-ci.org/latest/hudson.war]], saving ##hudson.war## somewhere for later.
136 1. Create a folder for Hudson to work in: ##/opt/local/var/db/hudson##
137 1. Change ownership of that folder: ##chown www:_www /opt/local/var/db/hudson##
Pascal Robert 37.1 138 1. Add the following to ##/opt/local/share/java/tomcat6/conf/setenv.local##:
139
140 {{noformat}}
141
Ramsey Gurley 50.1 142 export HUDSON_HOME=/opt/local/var/db/hudson
Pascal Robert 37.1 143 export JAVA_OPTS=-Djava.awt.headless=true
144
145 {{/noformat}}
146
Ramsey Gurley 50.1 147 1. Install Hudson in Tomcat: go to [[http://localhost:8080]], login with the user and password that you have created in ##tomcat-users.xml##, and upload ##hudson.war## to the Tomcat server.
148 1. Goto [[http://localhost:8080/hudson]] and you can start configuring your Hudson build server.
Pascal Robert 37.1 149
150 === {{color value="#000000"}}{*}Servlet Container Installation on Mac OS X Server (10.6)*{{/color}} ===
151
152 1. Tomcat is by default installed on Mac OS X Server.
153 1. Create an administrative user in&nbsp;##/Library/Tomcat/conf/tomcat-users.xml##.
154
155 {{code value="xml"}}
156
157 <?xml version='1.0' encoding='utf-8'?>
158 <tomcat-users>
159 <role rolename="manager"/>
160 <role rolename="admin"/>
161 <user username="tomcat" password="tomcat" roles="admin,manager"/>
162 </tomcat-users> 
163
164 {{/code}}
165
166 {{panel bgColor="#F7D6C1"}}
167
168 {color:#000000}Don't forget to change the username and password after you have finished checking out the build server and start using it in production.&nbsp;{color}
169
170 {{/panel}}
171
172 1. The way to start it depends on the version. The current way is to go to the Web Settings in Server Admin, Settings, General, check the Tomcat checkbox. Restart the WebServer.&nbsp;
Ramsey Gurley 50.1 173 1. {{color value="#003366"}}[{{/color}}{{color value="#003366"}}Download Hudson{{/color}}http:~/~/hudson-ci.org/latest/hudson.war, saving&nbsp;##hudson.war##&nbsp;somewhere for later.
174 1. Create a folder for Hudson to work in:&nbsp;##/Library/hudson##
175 1. Change ownership of that folder:&nbsp;##chown appserver:sys /Library/Hudson##
176 1. Add the following to&nbsp;##/Library/Tomcat/bin/setenv.sh##:
Pascal Robert 37.1 177
Ramsey Gurley 50.1 178 {{noformat}}
Pascal Robert 37.1 179
Ramsey Gurley 50.1 180 export HUDSON_HOME=/Library/Hudson
Pascal Robert 37.1 181 export JAVA_OPTS=-Djava.awt.headless=true
182
Ramsey Gurley 50.1 183 {{/noformat}}
Pascal Robert 37.1 184
Ramsey Gurley 50.1 185 1. Make sure that you are using UTF8 in the Connector, by adding
Pascal Robert 37.1 186
Ramsey Gurley 50.1 187 {{noformat}}
Pascal Robert 37.1 188
Ramsey Gurley 50.1 189 URIEncoding="UTF-8"
Pascal Robert 37.1 190
Ramsey Gurley 50.1 191 {{/noformat}}
Pascal Robert 37.1 192
Ramsey Gurley 50.1 193 to the Connector in /Library/tomcat/conf/server.xml in such a way:
Pascal Robert 37.1 194
Ramsey Gurley 50.1 195 {{noformat}}
Pascal Robert 37.1 196
Ramsey Gurley 50.1 197 <Connector port="8080" protocol="HTTP/1.1"
198 connectionTimeout="20000"
199 redirectPort="8443" URIEncoding="UTF-8"/>
Pascal Robert 49.1 200
Ramsey Gurley 50.1 201 {{/noformat}}
Pascal Robert 49.1 202
Ramsey Gurley 50.1 203 1. Install Hudson in Tomcat: go to [[http://localhost:8080]], login with the user and password that you have created in tomcat-users.xml, and upload hudson.war to the Tomcat server.
Pascal Robert 49.1 204
Ramsey Gurley 50.1 205 1. Goto [[http://localhost:8080/hudson]]&nbsp;and you can start configuring your Hudson build server.
Pascal Robert 49.1 206
Ramsey Gurley 50.1 207 == Building WO Apps ==
208
209 * Check out [[^setupWorkspace.sh]]