Version 71.1 by Ramsey Gurley on 2011/04/23 15:13

Hide last authors
David Avendasora 66.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
David Avendasora 66.1 3 == Setting up Hudson ==
David Avendasora 64.1 4
David Avendasora 66.1 5 There are a couple different ways to run Hudson. The easiest is to run it as a standalone application.
David Avendasora 64.1 6
David Avendasora 66.1 7 === Standalone Installation ===
David Avendasora 64.1 8
David Avendasora 66.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
David Avendasora 66.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
David Avendasora 66.1 17 {{code}}
Pascal Robert 37.1 18
David Avendasora 66.1 19 java -DHUDSON_HOME=/Developer/Hudson/Home -jar /Developer/Hudson/hudson.war
Pascal Robert 37.1 20
David Avendasora 66.1 21 {{/code}}
Pascal Robert 37.1 22
David Avendasora 66.1 23 {{info}}
Pascal Robert 37.1 24
David Avendasora 66.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 37.1 29
David Avendasora 66.1 30 {{/info}}
Pascal Robert 37.1 31
David Avendasora 66.1 32 1. Point your browser to: [[http://localhost:8080/]] 
33 1. Start setting up jobs
34
Ramsey Gurley 68.1 35 === Standalone Jenkins w/SSL ===
36
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
39 1. Create a selfsigned test SSL certificate. 
40 keytool genkey keyalg RSA alias selfsigned keystore keystore.jks -storepass ToPSecRet321 dname "cn=localhost"
41 1. Launch Hudson. 
Ramsey Gurley 70.1 42 java jar hudson.war httpPort=-1 httpsPort=8080 httpsKeyStore=keystore.jks httpsKeyStorePassword=ToPSecRet321
Ramsey Gurley 68.1 43 1. Launch browser 
44 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.
45
46 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.
47
48 === Standalone Jenkins and launchd on Mac OS X ===
49
50 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 launchd on the command line.//
51
Ramsey Gurley 70.1 52 Make sure your permissions and user:group are set correctly on the plist (rwrr root:wheel). In /Library/LaunchDaemons/org.jenkins-ci.jenkins.plist I placed:
Ramsey Gurley 68.1 53
54 {{code value="xml"}}
55
56 <?xml version="1.0" encoding="UTF-8"?>
57 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
58 <plist version="1.0">
59 <dict>
60 <key>UserName</key>
61 <string>jenkins</string>
62 <key>Label</key>
63 <string>org.jenkins-ci.jenkins</string>
64 <key>EnvironmentVariables</key>
65 <dict>
66 <key>JENKINS_HOME</key>
67 <string>/usr/local/jenkins/.jenkins</string>
68 </dict>
69 <key>ProgramArguments</key>
70 <array>
71 <string>/usr/bin/java</string>
72 <string>-jar</string>
73 <string>/usr/local/jenkins/jenkins.war</string>
74 <string>--httpPort=-1</string>
75 <string>--httpsPort=8080</string>
76 <string>--httpsKeyStore=/usr/local/jenkins/keystore.jks</string>
77 <string>--httpsKeyStorePassword=Jenkins123</string>
78 <string>--httpsKeyStorePassword=Jenkins123</string>
79 </array>
80 <key>StandardOutPath</key>
81 <string>/usr/local/jenkins/.jenkins/log/out.txt</string>
82 <key>StandardErrorPath</key>
83 <string>/usr/local/jenkins/.jenkins/log/err.txt</string>
84 <key>Disabled</key>
85 <false/>
86 <key>KeepAlive</key>
87 <true/>
88 <key>RunAtLoad</key>
89 <true/>
90 </dict>
91 </plist>
92
93 {{/code}}
94
Pascal Robert 37.1 95 === Servlet Container Installation on Mac OS X (10.5, 10.6) ===
96
97 1. Install Tomcat from [[http://www.macports.org]] with the command
98
99 {{noformat}}
100
101 sudo /opt/local/bin/port install tomcat6
102
103 {{/noformat}}
104
105 1. Create an administrative user in ##/opt/local/share/java/tomcat6/conf/tomcat-users.xml##.
106
107 {{code value="xml"}}
108
109 <?xml version='1.0' encoding='utf-8'?>
110 <tomcat-users>
111 <role rolename="manager"/>
112 <role rolename="admin"/>
113 <user username="tomcat" password="tomcat" roles="admin,manager"/>
114 </tomcat-users>
115
116 {{/code}}
117
118 {{panel bgColor="#F7D6C1"}}
119
120 Don't forget to change the username and password after you have finished checking out the build server and start using it in production.
121
122 {{/panel}}
123
124 1. Start Tomcat.
125
126 {{noformat}}
127
128 sudo launchctl load -w /Library/LaunchDaemons/org.macports.tomcat6.plist
129
130 {{/noformat}}
131
David Avendasora 66.1 132 1. [[Download Hudson>>http://hudson-ci.org/latest/hudson.war]], saving ##hudson.war## somewhere for later.
133 1. Create a folder for Hudson to work in: ##/opt/local/var/db/hudson##
134 1. Change ownership of that folder: ##chown www:_www /opt/local/var/db/hudson##
Pascal Robert 37.1 135 1. Add the following to ##/opt/local/share/java/tomcat6/conf/setenv.local##:
136
137 {{noformat}}
138
David Avendasora 66.1 139 export HUDSON_HOME=/opt/local/var/db/hudson
Pascal Robert 37.1 140 export JAVA_OPTS=-Djava.awt.headless=true
141
142 {{/noformat}}
143
David Avendasora 66.1 144 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.
145 1. Goto [[http://localhost:8080/hudson]] and you can start configuring your Hudson build server.
Pascal Robert 37.1 146
147 === {{color value="#000000"}}{*}Servlet Container Installation on Mac OS X Server (10.6)*{{/color}} ===
148
149 1. Tomcat is by default installed on Mac OS X Server.
150 1. Create an administrative user in&nbsp;##/Library/Tomcat/conf/tomcat-users.xml##.
151
152 {{code value="xml"}}
153
154 <?xml version='1.0' encoding='utf-8'?>
155 <tomcat-users>
156 <role rolename="manager"/>
157 <role rolename="admin"/>
158 <user username="tomcat" password="tomcat" roles="admin,manager"/>
159 </tomcat-users> 
160
161 {{/code}}
162
163 {{panel bgColor="#F7D6C1"}}
164
165 {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}
166
167 {{/panel}}
168
169 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;
David Avendasora 66.1 170 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.
171 1. Create a folder for Hudson to work in:&nbsp;##/Library/hudson##
172 1. Change ownership of that folder:&nbsp;##chown appserver:sys /Library/Hudson##
173 1. Add the following to&nbsp;##/Library/Tomcat/bin/setenv.sh##:
Pascal Robert 37.1 174
David Avendasora 66.1 175 {{noformat}}
Pascal Robert 37.1 176
David Avendasora 66.1 177 export HUDSON_HOME=/Library/Hudson
Pascal Robert 37.1 178 export JAVA_OPTS=-Djava.awt.headless=true
179
David Avendasora 66.1 180 {{/noformat}}
Pascal Robert 37.1 181
David Avendasora 66.1 182 1. Make sure that you are using UTF8 in the Connector, by adding
Pascal Robert 37.1 183
David Avendasora 66.1 184 {{noformat}}
Pascal Robert 37.1 185
David Avendasora 66.1 186 URIEncoding="UTF-8"
187
188 {{/noformat}}
189
190 to the Connector in /Library/tomcat/conf/server.xml in such a way:
191
192 {{noformat}}
193
David Avendasora 54.1 194 <Connector port="8080" protocol="HTTP/1.1"
Ramsey Gurley 50.1 195 connectionTimeout="20000"
196 redirectPort="8443" URIEncoding="UTF-8"/>
Pascal Robert 49.1 197
David Avendasora 66.1 198 {{/noformat}}
Pascal Robert 49.1 199
David Avendasora 66.1 200 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 201
David Avendasora 66.1 202 1. Goto [[http://localhost:8080/hudson]]&nbsp;and you can start configuring your Hudson build server.
203
Ramsey Gurley 50.1 204 == Building WO Apps ==
205
David Avendasora 66.1 206 * Check out [[^setupWorkspace.sh]]