Thursday 14 July 2011

Jenkins Apache Setup

After installing Jenkins with the MacOSX installer I wanted to put apache in the front end (in addition to RhodeCode). I had to modify the start up daemon script to listen to a different port as I use 8080 for grails dev. The following is my /Library/LaunchDaemons/org.jenkins-ci.plist:




 EnvironmentVariables
 
  JENKINS_HOME
  /Users/Shared/Jenkins/Home
 
 GroupName
 daemon
 KeepAlive
 
 Label
 org.jenkins-ci
 ProgramArguments
 
  /usr/bin/java
  -Xmx512m
  -Duser.home=/Users/Shared/Jenkins/Home
  -Djava.awt.headless=true
  -jar
  /Applications/Jenkins/jenkins.war
  --httpPort=8989
  --httpListenAddress=127.0.0.1
  --prefix=/jenkins
  --ajp13Port=-1
 
 RunAtLoad
 
 UserName
 daemon


Note that AJP couldn't be used due to an issue. Also note setting -Duser.home, this seems to be a problem where changing users causes Jenkins to put the .m2 Maven directory in the root's home directory which fails due to lack of permissions.

I then added the following to my SSL virtual host:

  ProxyPass http://127.0.0.1:8989/jenkins
  ProxyPassReverse http://127.0.0.1:8989/jenkins

Don't forget to update http://localhost:8989/jenkins/configure/ "Jenkins URL".

Restart Jenkins and Apache:
launchctl unload -w /Library/LaunchDaemons/org.jenkins-ci.plist
launchctl load -w /Library/LaunchDaemons/org.jenkins-ci.plist
sudo apachectl restart

No comments:

Post a Comment