Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-20682

Starting Jenkins with defined --webroot or JETTY_HOME not working.

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Critical
    • Resolution: Duplicate
    • Component/s: core
    • Labels:
      None
    • Environment:
      - 8Gb RAM
      - 8 CPUs
      - 300Gb disk
      - Ubuntu 12.04
      Jenkins installed via 'apt-get install -y jenkins'
    • Similar Issues:

      Description

      For our environment it is required to load webapp into /var/cache/jenkins.
      With previous version (1.509.3) setting /etc/default/jenkins with:
      JENKINS_ARGS="--webroot=/var/cache/jenkins/war --httpPort=$HTTP_PORT --ajp13Port=$AJP_PORT"

      has always loaded webroot/webapp to this location.
      Installing the latest jenkins with 'apt-get install -y jenkins' using our existing /etc/default/jenkins file not passing the --webroot parameter/location. Starting Jenkins with /etc/init.d/jenkins start

      Jenkins:IIRC suggestions to use (command-line or /etc/default/jenkins):
      $ export JETTY_HOME=/var/cache/jenkins/war
      $ export JENKINS_HOME=/home/username/jenkins
      $ /usr/bin/java -Xmx512m -jar /usr/share/jenkins/jenkins-1.540.war --webroot=/var/cache/jenkins/war --httpPort=8080 --ajp13Port=-1

      However, it still continuously loads into: /tmp/jetty-0.0.0.0-8080-jenkins-1.540.war-any/webapp

      /var/log/jenkins/jenkins.log:
      INFO: Extract jar:file:/usr/share/jenkins/jenkins-1.540.war!/ to /tmp/jetty-0.0.0.0-8080-jenkins-1.540.war-any/webapp

      Using previous 1.509.3 jenkins.war (and prior) versions does not have this behavior.

      Is this change by design?
      Can you please provide a workaround so we can specify --webroot or jetty_home, etc.?

        Attachments

          Issue Links

            Activity

            Hide
            oldelvet Richard Mortimer added a comment -

            The Jetty documentation shows how the location of the temporary directories can be controlled
            http://www.eclipse.org/jetty/documentation/current/ref-temporary-directories.html

            I just did a quick experiment by adding a call to WebAppContext#setTempDirectory() in HostConfiguration#create()
            https://github.com/jenkinsci/winstone/blob/master/src/java/winstone/HostConfiguration.java

            i.e.

            wac.setTempDirectory(new File("/var/cache/jenkins/temp"));
            

            When jenkins.war was built with a version of winstone.jar containing that the Jetty temporary directory moved away from /tmp into /var/cache/jenkins/temp

            That isn't a full solution to the problem because it needs hooking into the --webroot argument to jenkins.

            There are other issues relating to how it works with multiple webapps (they should not share the same temp directory) and the usage of the temp folder is slightly different (it uses a /webapp subdirectory) to the old native winstone behaviour.

            I don't know the internal plumbing of Winstone/Jenkins well enough to make a stab at a full fix for this.

            Show
            oldelvet Richard Mortimer added a comment - The Jetty documentation shows how the location of the temporary directories can be controlled http://www.eclipse.org/jetty/documentation/current/ref-temporary-directories.html I just did a quick experiment by adding a call to WebAppContext#setTempDirectory() in HostConfiguration#create() https://github.com/jenkinsci/winstone/blob/master/src/java/winstone/HostConfiguration.java i.e. wac.setTempDirectory( new File( "/ var /cache/jenkins/temp" )); When jenkins.war was built with a version of winstone.jar containing that the Jetty temporary directory moved away from /tmp into /var/cache/jenkins/temp That isn't a full solution to the problem because it needs hooking into the --webroot argument to jenkins. There are other issues relating to how it works with multiple webapps (they should not share the same temp directory) and the usage of the temp folder is slightly different (it uses a /webapp subdirectory) to the old native winstone behaviour. I don't know the internal plumbing of Winstone/Jenkins well enough to make a stab at a full fix for this.
            Hide
            julio_r julio rincon added a comment -

            I bumped into this issue trying to run jenkins in my NAS where the tmp is just 30MBs. Overriding the java system property (java.io.tmpdir) worked for me!

            E.g.

            nohup java -Djava.io.tmpdir=./webroot -jar jenkins.war --httpPort=9999 > ./jenkins.log 2>&1 &

            Show
            julio_r julio rincon added a comment - I bumped into this issue trying to run jenkins in my NAS where the tmp is just 30MBs. Overriding the java system property (java.io.tmpdir) worked for me! E.g. nohup java -Djava.io.tmpdir=./webroot -jar jenkins.war --httpPort=9999 > ./jenkins.log 2>&1 &
            Hide
            gcummings Geoff Cummings added a comment -

            The following worked better for me:

            Set the jetty.home to Jenkins directory on the java opts when starting Jenkins

            -Djetty.home=$JENKINS_HOME

            Create a directory called "work" in Jenkins Home directory, or wherever you have set jetty.home

            That will cause Jetty to use that work directory instead of whatever the java.io.tmpdir property is set to.

            Show
            gcummings Geoff Cummings added a comment - The following worked better for me: Set the jetty.home to Jenkins directory on the java opts when starting Jenkins -Djetty.home=$JENKINS_HOME Create a directory called "work" in Jenkins Home directory, or wherever you have set jetty.home That will cause Jetty to use that work directory instead of whatever the java.io.tmpdir property is set to.
            Hide
            oldelvet Richard Mortimer added a comment -

            See JENKINS-22442
            It should fix the issue reported here.

            Show
            oldelvet Richard Mortimer added a comment - See JENKINS-22442 It should fix the issue reported here.
            Hide
            oldelvet Richard Mortimer added a comment -

            Duplicate of JENKINS-22442

            Show
            oldelvet Richard Mortimer added a comment - Duplicate of JENKINS-22442

              People

              • Assignee:
                kohsuke Kohsuke Kawaguchi
                Reporter:
                gmarquez GMarquez
              • Votes:
                13 Vote for this issue
                Watchers:
                17 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: