Thursday, November 10, 2011

Upstart + Jenkins

I've been playing with Jenkins for CI of Python projects. I run Jenkins on 127.0.0.1:8081, and then use Apache2 to proxy a domain to it. Here's a simple virtual host configuration I found somewhere:


<VirtualHost *:80>
    ServerName jenkins
    ProxyPass         /  http://localhost:8081/
    ProxyPassReverse  /  http://localhost:8081/
    ProxyRequests     Off
    # Local reverse proxy authorization override
    # Most unix distribution deny proxy by default (ie
    # /etc/apache2/mods-enabled/proxy.conf in Ubuntu)
    <Proxy http://localhost:8081*>
      Order deny,allow
      Allow from all
    </Proxy>
</VirtualHost>


Lastly I wrote an Upstart job in /etc/init/jenkins.conf to keep it running across restarts:


description "Jenkins"


respawn
start on started network-services
stop on stopping network-services


script
cd /home/jenkins
sudo -Hu jenkins java -jar jenkins.war -Djava.awt.headless=true --httpPort=8081 --httpListenAddress=127.0.0.1
end script

2 comments:

  1. This doesn't seem to allow Jenkins to restart itself. Have you run into the same problem?

    ReplyDelete
    Replies
    1. It appears to be a coincidence. :-)

      https://issues.jenkins-ci.org/browse/JENKINS-22818?page=com.atlassian.streams.streams-jira-plugin:activity-stream-issue-tab

      Delete