If you are one of the less lucky ones that do have to use OS X instead of Linux for installing a Hudson CI you could follow this guide because most of other resources I found were incomplete or obsolete, even the ones referring to tomcat. So here is my small contribution to the community.
Here is the quick guide:
- install macports
suport port upgrade
sudo port upgrade outdated.
sudo port install tomcat6, or if you want other version check
port list|grep tomcat
- config is now at:
- startup script:
cp /opt/local/share/java/tomcat6/conf/tomcat-users.xml.sample /opt/local/share/java/tomcat6/conf/tomcat-users.xml nano /opt/local/share/java/tomcat6/conf/tomcat-users.xml
Activate at least the tomcat user and make it a manager.
For running tomcat as a daemon on port 8080 but enable also port 80 by using a firewall redirection edit
/opt/local/share/java/tomcat6/conf/server.xml and add
proxyport="80" URIEncoding="UTF-8" inside
For forwarding port 80 to 8080 run this line and add it do
ipfw add 100 fwd 127.0.0.1,8080 tcp from any to any 80 in
Set proper memory limits for Java machine running tomcat or you may be in trouble later. Inside
export JAVA_JVM_VERSION=CurrentJDK export JAVA_OPTS="-Xmx3000M -Xms3000M -Djava.awt.headless=true -Duser.timezone=UTC"
In my example, I allocated ~3Gb or RAM but you can adapt this, anyway don’t put less than 1GB if you are running
hudson inside tomcat.
Running as a service (daemon)
nano /Library/LaunchDaemons/org.apache.tomcat.plist and paste the code below:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Disabled</key> <false/> <key>Label</key> <string>org.apache.tomcat</string> <key>ProgramArguments</key> <array> <string>/opt/local/share/java/tomcat6/bin/catalina.sh</string> <string>run</string> </array> <key>RunAtLoad</key> <true/> </dict> </plist>
Check that launchd detected your new daemon, if not reboot
launchctl list|grep tomcat
Start tomcat manually.
launchctl start org.apache.tomcat
If the status is something else than
-, you have a problem and you should investigate it:
launchctl log level debug and check
Adding hudson to tomcat
This is the easy part, just do:
cd /opt/local/share/java/tomcat6/webapps wget http://hudson-ci.org/latest/hudson.war chown _www:_www hudson.war
Now go to http://localhost/manager/ and start hudson.